From b8d17565d7d1e0e6d0a5640a28c8980c9f4bdb4d Mon Sep 17 00:00:00 2001 From: dingcan <627403134@qq.com> Date: Tue, 26 Jul 2022 14:42:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtp/RtpProcess.cpp | 15 +++++++++------ src/Rtp/RtpProcess.h | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Rtp/RtpProcess.cpp b/src/Rtp/RtpProcess.cpp index d004110b..b8c497a6 100644 --- a/src/Rtp/RtpProcess.cpp +++ b/src/Rtp/RtpProcess.cpp @@ -280,19 +280,22 @@ std::shared_ptr RtpProcess::getOriginSock(MediaSource &sender) const { toolkit::EventPoller::Ptr RtpProcess::getOwnerPoller(MediaSource &sender) { return _sock ? _sock->getPoller() : nullptr; } -void RtpProcess::setHelper(const std::weak_ptr &help) -{ - _help=help; + +void RtpProcess::setHelper(const std::weak_ptr help){ + _help = std::move(help); } -int RtpProcess::getLossRate(MediaSource &sender, TrackType type) -{ + +int RtpProcess::getLossRate(MediaSource &sender, TrackType type){ auto help = _help.lock(); + if(!help){ + return -1; + } auto expected = help->getExpectedPacketsInterval(); if (!expected) { return 0; } - return help->geLostInterval() * 100 / expected; } + }//namespace mediakit #endif//defined(ENABLE_RTPPROXY) \ No newline at end of file diff --git a/src/Rtp/RtpProcess.h b/src/Rtp/RtpProcess.h index 1241c21d..89e9b575 100644 --- a/src/Rtp/RtpProcess.h +++ b/src/Rtp/RtpProcess.h @@ -67,7 +67,7 @@ public: int getTotalReaderCount(); void setListener(const std::weak_ptr &listener); - void setHelper(const std::weak_ptr &help); + void setHelper(const std::weak_ptr help); int getLossRate(MediaSource &sender, TrackType type) override; protected: bool inputFrame(const Frame::Ptr &frame) override;