From 6a97fcb3de08fb0b2ba573301cf0364f5792cc72 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sat, 1 Feb 2020 22:57:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AA=92=E4=BD=93=E6=B3=A8=E5=86=8C=E3=80=81?= =?UTF-8?q?=E9=87=8D=E7=BD=AE=E4=BA=8B=E4=BB=B6=E6=94=B9=E6=88=90=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E8=A7=A6=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/MediaSource.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/Common/MediaSource.cpp b/src/Common/MediaSource.cpp index 7ab8b574..2b2f5b35 100644 --- a/src/Common/MediaSource.cpp +++ b/src/Common/MediaSource.cpp @@ -78,14 +78,7 @@ vector MediaSource::getTracks(bool trackReady) const { void MediaSource::setTrackSource(const std::weak_ptr &track_src) { _track_source = track_src; - weak_ptr weakPtr = shared_from_this(); - EventPollerPool::Instance().getPoller()->async([weakPtr,this](){ - auto strongPtr = weakPtr.lock(); - if (!strongPtr) { - return; - } - NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaResetTracks, *this); - },false); + NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaResetTracks, *this); } void MediaSource::setListener(const std::weak_ptr &listener){ @@ -293,14 +286,7 @@ void MediaSource::regist() { g_mapMediaSrc[_strSchema][_strVhost][_strApp][_strId] = shared_from_this(); } InfoL << _strSchema << " " << _strVhost << " " << _strApp << " " << _strId; - weak_ptr weakPtr = shared_from_this(); - EventPollerPool::Instance().getPoller()->async([weakPtr,this](){ - auto strongPtr = weakPtr.lock(); - if (!strongPtr) { - return; - } - NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaChanged, true, *this); - },false); + NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaChanged, true, *this); } bool MediaSource::unregist() { //反注册该源