Skip to content
Snippets Groups Projects
Commit c8c2bea2 authored by Sébastien Blin's avatar Sébastien Blin Committed by Adrien Béraud
Browse files

sipcall: reschedule startAllMedias on main thread to avoid deadlock

im::sendSipMessage is locking dialog when callMutex_ is locked, but
handleEvents can lock dialog then callMutex_ in startAllMedias. This
will give a deadlock, so startAllMedias should be rescheduled

Change-Id: I3d1b0b9a981419840f19bfe1832b70503713fe72
Gitlab: #175
parent 7478eb6f
No related branches found
No related tags found
No related merge requests found
......@@ -1091,22 +1091,21 @@ void
SIPCall::onMediaUpdate()
{
JAMI_WARN("[call:%s] medias changed", getCallId().c_str());
// If ICE is not used, start medias now
auto rem_ice_attrs = sdp_->getIceAttributes();
if (rem_ice_attrs.ufrag.empty() or rem_ice_attrs.pwd.empty()) {
JAMI_WARN("[call:%s] no remote ICE for medias", getCallId().c_str());
stopAllMedia();
startAllMedia();
return;
}
// Main call (no subcalls) must wait for ICE now, the rest of code needs to access
// to a negotiated transport.
runOnMainThread([w = weak()] {
if (auto this_ = w.lock())
if (auto this_ = w.lock()) {
// If ICE is not used, start medias now
auto rem_ice_attrs = this_->sdp_->getIceAttributes();
if (rem_ice_attrs.ufrag.empty() or rem_ice_attrs.pwd.empty()) {
JAMI_WARN("[call:%s] no remote ICE for medias", this_->getCallId().c_str());
this_->stopAllMedia();
this_->startAllMedia();
return;
}
if (not this_->isSubcall())
this_->waitForIceAndStartMedia();
}
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment