Commit 62d56ff3 by xiongziliang

修复一个可能导致死锁的bug

parent 823d887b
...@@ -73,9 +73,12 @@ MediaSource::Ptr MediaSource::find( ...@@ -73,9 +73,12 @@ MediaSource::Ptr MediaSource::find(
} }
bool MediaSource::regist() { bool MediaSource::regist() {
//注册该源,注册后服务器才能找到该源 //注册该源,注册后服务器才能找到该源
lock_guard<recursive_mutex> lock(g_mtxMediaSrc); bool success;
auto pr = g_mapMediaSrc[_strSchema][_strVhost][_strApp].emplace(_strId,shared_from_this()); {
auto success = pr.second; lock_guard<recursive_mutex> lock(g_mtxMediaSrc);
auto pr = g_mapMediaSrc[_strSchema][_strVhost][_strApp].emplace(_strId, shared_from_this());
success = pr.second;
}
if(success){ if(success){
InfoL << _strSchema << " " << _strVhost << " " << _strApp << " " << _strId; InfoL << _strSchema << " " << _strVhost << " " << _strApp << " " << _strId;
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaChanged, NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaChanged,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论