From 327acdf5622fa46ee01328cb2ffe8fbfef6ab95b Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Wed, 13 Mar 2019 20:12:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AA=92=E4=BD=93=E6=BA=90=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E6=97=B6=E5=BC=BA=E5=88=B6=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZLToolKit | 2 +- src/Common/MediaSource.cpp | 25 ++++++++++--------------- src/Common/MediaSource.h | 2 +- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/ZLToolKit b/ZLToolKit index 0d785acf..346e3330 160000 --- a/ZLToolKit +++ b/ZLToolKit @@ -1 +1 @@ -Subproject commit 0d785acfc0069f589b59901cca574ea77422c4da +Subproject commit 346e3330f8219fbb5c974a703831a25a01c86656 diff --git a/src/Common/MediaSource.cpp b/src/Common/MediaSource.cpp index 2a9c79e2..c1567825 100644 --- a/src/Common/MediaSource.cpp +++ b/src/Common/MediaSource.cpp @@ -71,25 +71,20 @@ MediaSource::Ptr MediaSource::find( return ret; } -bool MediaSource::regist() { +void MediaSource::regist() { //注册该源,注册后服务器才能找到该源 - bool success; { lock_guard 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() { //反注册该源 diff --git a/src/Common/MediaSource.h b/src/Common/MediaSource.h index 8a2de2da..0bff2a4e 100644 --- a/src/Common/MediaSource.h +++ b/src/Common/MediaSource.h @@ -167,7 +167,7 @@ public: } protected: - bool regist() ; + void regist() ; bool unregist() ; private: template