From c876c43374d3999ee255b3549dd4029d72eeb125 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Mon, 10 Jun 2019 12:33:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/MediaSource.h | 8 ++++++++ src/Rtmp/RtmpMediaSource.h | 6 +----- src/Rtsp/RtspMediaSource.h | 6 +----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Common/MediaSource.h b/src/Common/MediaSource.h index d3f09b44..07caa13a 100644 --- a/src/Common/MediaSource.h +++ b/src/Common/MediaSource.h @@ -158,6 +158,14 @@ public: } return listener->close(*this,force); } + + void onNoneReader(){ + auto listener = _listener.lock(); + if(!listener){ + return; + } + listener->onNoneReader(*this); + } virtual void setListener(const std::weak_ptr &listener){ _listener = listener; } diff --git a/src/Rtmp/RtmpMediaSource.h b/src/Rtmp/RtmpMediaSource.h index 04f42271..459c9283 100644 --- a/src/Rtmp/RtmpMediaSource.h +++ b/src/Rtmp/RtmpMediaSource.h @@ -141,11 +141,7 @@ private: GET_CONFIG(int,stream_none_reader_delay,General::kStreamNoneReaderDelayMS); if(_asyncEmitNoneReader && _readerTicker.elapsedTime() > stream_none_reader_delay){ _asyncEmitNoneReader = false; - auto listener = _listener.lock(); - if(!listener){ - return; - } - listener->onNoneReader(*this); + onNoneReader(); } } protected: diff --git a/src/Rtsp/RtspMediaSource.h b/src/Rtsp/RtspMediaSource.h index a3377a30..78911810 100644 --- a/src/Rtsp/RtspMediaSource.h +++ b/src/Rtsp/RtspMediaSource.h @@ -162,11 +162,7 @@ private: GET_CONFIG(int,stream_none_reader_delay,General::kStreamNoneReaderDelayMS); if(_asyncEmitNoneReader && _readerTicker.elapsedTime() > stream_none_reader_delay){ _asyncEmitNoneReader = false; - auto listener = _listener.lock(); - if(!listener){ - return; - } - listener->onNoneReader(*this); + onNoneReader(); } } protected: