Skip to content
Snippets Groups Projects
Unverified Commit 0932ef43 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

sipcall: fix asan crash on callAVStreams

Change-Id: I6463e8315a84df28fb7a7e8b52f6c8e18899fa44
GitLab: #359
parent 5674423f
No related branches found
No related tags found
No related merge requests found
......@@ -162,12 +162,16 @@ SIPCall::createCallAVStream(const StreamData& StreamData,
const std::shared_ptr<MediaStreamSubject>& mediaStreamSubject)
{
const std::string AVStreamId = StreamData.id + std::to_string(StreamData.direction);
callAVStreams[AVStreamId] = mediaStreamSubject;
streamSource.attachPriorityObserver(callAVStreams[AVStreamId]);
std::lock_guard<std::mutex> lk(avStreamsMtx_);
auto it = callAVStreams.find(AVStreamId);
if (it != callAVStreams.end())
return;
it = callAVStreams.insert(it, {AVStreamId, mediaStreamSubject});
streamSource.attachPriorityObserver(it->second);
jami::Manager::instance()
.getJamiPluginManager()
.getCallServicesManager()
.createAVSubject(StreamData, callAVStreams[AVStreamId]);
.createAVSubject(StreamData, it->second);
}
#endif // ENABLE_PLUGIN
......@@ -1251,8 +1255,11 @@ SIPCall::stopAllMedia()
videortp_->stop();
#endif
#ifdef ENABLE_PLUGIN
callAVStreams.erase(getCallId() + "0");
callAVStreams.erase(getCallId() + "1");
{
std::lock_guard<std::mutex> lk(avStreamsMtx_);
callAVStreams.erase(getCallId() + "0");
callAVStreams.erase(getCallId() + "1");
}
jami::Manager::instance().getJamiPluginManager().getCallServicesManager().clearAVSubject(
getCallId());
#endif
......
......@@ -279,6 +279,7 @@ private:
void createCallAVStreams();
#endif // ENABLE_PLUGIN
std::mutex avStreamsMtx_ {};
std::map<std::string, std::shared_ptr<MediaStreamSubject>> callAVStreams;
void setCallMediaLocal();
......
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