媒体源注册时强制覆盖

This commit is contained in:
xiongziliang 2019-03-13 20:12:34 +08:00
parent 9dfb275ad5
commit 327acdf562
3 changed files with 12 additions and 17 deletions

@ -1 +1 @@
Subproject commit 0d785acfc0069f589b59901cca574ea77422c4da
Subproject commit 346e3330f8219fbb5c974a703831a25a01c86656

View File

@ -71,25 +71,20 @@ MediaSource::Ptr MediaSource::find(
return ret;
}
bool MediaSource::regist() {
void MediaSource::regist() {
//注册该源,注册后服务器才能找到该源
bool success;
{
lock_guard<recursive_mutex> lock(g_mtxMediaSrc);
auto pr = g_mapMediaSrc[_strSchema][_strVhost][_strApp].emplace(_strId, shared_from_this());
success = pr.second;
g_mapMediaSrc[_strSchema][_strVhost][_strApp][_strId] = shared_from_this();
}
if(success){
InfoL << _strSchema << " " << _strVhost << " " << _strApp << " " << _strId;
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaChanged,
true,
_strSchema,
_strVhost,
_strApp,
_strId,
*this);
}
return success;
InfoL << _strSchema << " " << _strVhost << " " << _strApp << " " << _strId;
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaChanged,
true,
_strSchema,
_strVhost,
_strApp,
_strId,
*this);
}
bool MediaSource::unregist() {
//反注册该源

View File

@ -167,7 +167,7 @@ public:
}
protected:
bool regist() ;
void regist() ;
bool unregist() ;
private:
template <typename FUN>