diff --git a/src/sip/sipcall.cpp b/src/sip/sipcall.cpp index cf541fc85526e102840746d46828b94249cb275f..c4e1c578f988e4ad06275ec5079c961b96b4da08 100644 --- a/src/sip/sipcall.cpp +++ b/src/sip/sipcall.cpp @@ -929,7 +929,6 @@ SIPCall::getAudioCodec() const void SIPCall::startAllMedia() { - std::lock_guard<std::recursive_mutex> lock(callMutex_); if (!transport_) return; JAMI_WARN("[call:%s] startAllMedia()", getCallId().c_str()); if (isSecure() && not transport_->isSecure()) { @@ -1135,6 +1134,7 @@ SIPCall::onMediaUpdate() // to a negotiated transport. runOnMainThread([w = weak()] { if (auto this_ = w.lock()) { + std::lock_guard<std::recursive_mutex> lk {this_->callMutex_}; // The call is already ended, so we don't need to restart medias if (!this_->inv or this_->inv->state == PJSIP_INV_STATE_DISCONNECTED) return; // If ICE is not used, start medias now @@ -1185,6 +1185,7 @@ SIPCall::waitForIceAndStartMedia() // Negotiation waiting task Manager::instance().addTask([weak_call] { if (auto call = weak_call.lock()) { + std::lock_guard<std::recursive_mutex> lk {call->callMutex_}; auto ice = call->getIceMediaTransport(); if (not ice or ice->isFailed()) { diff --git a/src/sip/sipcall.h b/src/sip/sipcall.h index 167323e3293ceb49bb7d238ca70774a75fc8d2bc..9e2cd2b27313fc35642900671f4c129d069f75c6 100644 --- a/src/sip/sipcall.h +++ b/src/sip/sipcall.h @@ -222,8 +222,6 @@ public: // NOT SIP RELATED (good candidates to be moved elsewhere) void generateMediaPorts(); - void startAllMedia(); - void openPortsUPnP(); void setPeerRegistredName(const std::string& name) { @@ -256,6 +254,7 @@ private: void waitForIceAndStartMedia(); + void startAllMedia(); void stopAllMedia(); /**