From 387574a80293642581fb990dee97105ad8e297b8 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 18 Apr 2021 21:27:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?rtp=E4=B8=BB=E5=8A=A8=E6=8E=A8=E6=B5=81?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E8=A7=A6=E5=8F=91=E6=97=A0=E4=BA=BA=E8=A7=82?= =?UTF-8?q?=E7=9C=8B=E4=BA=8B=E4=BB=B6:#799?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/MediaSource.cpp | 1 + src/Common/MultiMediaSourceMuxer.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/Common/MediaSource.cpp b/src/Common/MediaSource.cpp index ae4a47c8..56c1aa10 100644 --- a/src/Common/MediaSource.cpp +++ b/src/Common/MediaSource.cpp @@ -520,6 +520,7 @@ MediaSource::Ptr MediaSource::createFromMP4(const string &schema, const string & void MediaSourceEvent::onReaderChanged(MediaSource &sender, int size){ if (size || totalReaderCount(sender)) { //还有人观看该视频,不触发关闭事件 + _async_close_timer = nullptr; return; } //没有任何人观看该视频源,表明该源可以关闭了 diff --git a/src/Common/MultiMediaSourceMuxer.cpp b/src/Common/MultiMediaSourceMuxer.cpp index 1a86083d..52e34657 100644 --- a/src/Common/MultiMediaSourceMuxer.cpp +++ b/src/Common/MultiMediaSourceMuxer.cpp @@ -307,7 +307,11 @@ void MultiMediaSourceMuxer::setTrackListener(const std::weak_ptrtotalReaderCount() + _rtp_sender.size(); +#else return _muxer->totalReaderCount(); +#endif } void MultiMediaSourceMuxer::setTimeStamp(uint32_t stamp) { @@ -358,6 +362,10 @@ void MultiMediaSourceMuxer::startSendRtp(MediaSource &sender, const string &dst_ bool MultiMediaSourceMuxer::stopSendRtp(MediaSource &sender, const string& ssrc){ #if defined(ENABLE_RTPPROXY) + onceToken token(nullptr, [&]() { + //关闭rtp推流,可能触发无人观看事件 + MediaSourceEventInterceptor::onReaderChanged(sender, totalReaderCount()); + }); if (ssrc.empty()) { //关闭全部 lock_guard lck(_rtp_sender_mtx); From 4a6a3746dd6227558d4f23cca9bedcceac09d71c Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 18 Apr 2021 23:11:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0ZLToolKit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rdpart/ZLToolKit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdpart/ZLToolKit b/3rdpart/ZLToolKit index 9dac2536..ea1da5cc 160000 --- a/3rdpart/ZLToolKit +++ b/3rdpart/ZLToolKit @@ -1 +1 @@ -Subproject commit 9dac2536b1ee04e5cbfe78fe1d0e701b5b929a03 +Subproject commit ea1da5cc85c48baa8ddf8c3c229b09cd9f5056cd