diff --git a/src/sip/sipcall.cpp b/src/sip/sipcall.cpp index 70cd5b24c2fa4e21307671a335f7cc749d09b206..a253ed344eb33a14b6375dfc719daba3ec5f0a9c 100644 --- a/src/sip/sipcall.cpp +++ b/src/sip/sipcall.cpp @@ -2147,18 +2147,18 @@ SIPCall::stopAllMedia() audioRtp->stop(); #ifdef ENABLE_VIDEO auto const& videoRtp = getVideoRtp(); - { std::lock_guard<std::mutex> lk(sinksMtx_); - auto& videoReceive = videoRtp->getVideoReceive(); - if (videoReceive) { - auto& sink = videoReceive->getSink(); - for (auto it = callSinksMap_.begin(); it != callSinksMap_.end();) { - sink->detach(it->second.get()); - - it->second->stop(); - it = callSinksMap_.erase(it); + for (auto it = callSinksMap_.begin(); it != callSinksMap_.end();) { + if (videoRtp) { + auto& videoReceive = videoRtp->getVideoReceive(); + if (videoReceive) { + auto& sink = videoReceive->getSink(); + sink->detach(it->second.get()); + } } + it->second->stop(); + it = callSinksMap_.erase(it); } }