From 8d4638f985d5585ed543fff28e00d8f8c8832e3b Mon Sep 17 00:00:00 2001 From: Danil Chapovalov Date: Fri, 27 Sep 2024 14:38:58 +0200 Subject: [PATCH] Delete deprecated variant of ReceiveStatistics::SetMaxReorderingThreshold MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed: webrtc:42220729 Change-Id: I87c08769d33746e40dcdbf213096fc9732f82a07 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/363962 Auto-Submit: Danil Chapovalov Reviewed-by: Jakob Ivarsson‎ Commit-Queue: Jakob Ivarsson‎ Commit-Queue: Danil Chapovalov Cr-Commit-Position: refs/heads/main@{#43095} --- audio/channel_receive.cc | 5 +-- modules/rtp_rtcp/include/receive_statistics.h | 5 --- .../source/receive_statistics_impl.cc | 33 +++++-------------- .../rtp_rtcp/source/receive_statistics_impl.h | 27 ++++----------- 4 files changed, 18 insertions(+), 52 deletions(-) diff --git a/audio/channel_receive.cc b/audio/channel_receive.cc index 37bafaf94e..ca5f916ea4 100644 --- a/audio/channel_receive.cc +++ b/audio/channel_receive.cc @@ -898,11 +898,12 @@ void ChannelReceive::SetNACKStatus(bool enable, int max_packets) { RTC_DCHECK_RUN_ON(&worker_thread_checker_); // None of these functions can fail. if (enable) { - rtp_receive_statistics_->SetMaxReorderingThreshold(max_packets); + rtp_receive_statistics_->SetMaxReorderingThreshold(remote_ssrc_, + max_packets); neteq_->EnableNack(max_packets); } else { rtp_receive_statistics_->SetMaxReorderingThreshold( - kDefaultMaxReorderingThreshold); + remote_ssrc_, kDefaultMaxReorderingThreshold); neteq_->DisableNack(); } } diff --git a/modules/rtp_rtcp/include/receive_statistics.h b/modules/rtp_rtcp/include/receive_statistics.h index 5faea1539e..90b3499f02 100644 --- a/modules/rtp_rtcp/include/receive_statistics.h +++ b/modules/rtp_rtcp/include/receive_statistics.h @@ -66,11 +66,6 @@ class ReceiveStatistics : public ReceiveStatisticsProvider, // Returns a pointer to the statistician of an ssrc. virtual StreamStatistician* GetStatistician(uint32_t ssrc) const = 0; - // TODO(bugs.webrtc.org/10669): Deprecated, delete as soon as downstream - // projects are updated. This method sets the max reordering threshold of all - // current and future streams. - virtual void SetMaxReorderingThreshold(int max_reordering_threshold) = 0; - // Sets the max reordering threshold in number of packets. virtual void SetMaxReorderingThreshold(uint32_t ssrc, int max_reordering_threshold) = 0; diff --git a/modules/rtp_rtcp/source/receive_statistics_impl.cc b/modules/rtp_rtcp/source/receive_statistics_impl.cc index abdd76cd96..989cd2315f 100644 --- a/modules/rtp_rtcp/source/receive_statistics_impl.cc +++ b/modules/rtp_rtcp/source/receive_statistics_impl.cc @@ -41,14 +41,12 @@ TimeDelta UnixEpochDelta(Clock& clock) { StreamStatistician::~StreamStatistician() {} -StreamStatisticianImpl::StreamStatisticianImpl(uint32_t ssrc, - Clock* clock, - int max_reordering_threshold) +StreamStatisticianImpl::StreamStatisticianImpl(uint32_t ssrc, Clock* clock) : ssrc_(ssrc), clock_(clock), delta_internal_unix_epoch_(UnixEpochDelta(*clock_)), incoming_bitrate_(/*max_window_size=*/kStatisticsProcessInterval), - max_reordering_threshold_(max_reordering_threshold), + max_reordering_threshold_(kDefaultMaxReorderingThreshold), enable_retransmit_detection_(false), cumulative_loss_is_capped_(false), jitter_q4_(0), @@ -334,18 +332,16 @@ bool StreamStatisticianImpl::IsRetransmitOfOldPacket( std::unique_ptr ReceiveStatistics::Create(Clock* clock) { return std::make_unique( - clock, [](uint32_t ssrc, Clock* clock, int max_reordering_threshold) { - return std::make_unique( - ssrc, clock, max_reordering_threshold); + clock, [](uint32_t ssrc, Clock* clock) { + return std::make_unique(ssrc, clock); }); } std::unique_ptr ReceiveStatistics::CreateThreadCompatible( Clock* clock) { return std::make_unique( - clock, [](uint32_t ssrc, Clock* clock, int max_reordering_threshold) { - return std::make_unique( - ssrc, clock, max_reordering_threshold); + clock, [](uint32_t ssrc, Clock* clock) { + return std::make_unique(ssrc, clock); }); } @@ -353,12 +349,10 @@ ReceiveStatisticsImpl::ReceiveStatisticsImpl( Clock* clock, std::function( uint32_t ssrc, - Clock* clock, - int max_reordering_threshold)> stream_statistician_factory) + Clock* clock)> stream_statistician_factory) : clock_(clock), stream_statistician_factory_(std::move(stream_statistician_factory)), - last_returned_ssrc_idx_(0), - max_reordering_threshold_(kDefaultMaxReorderingThreshold) {} + last_returned_ssrc_idx_(0) {} void ReceiveStatisticsImpl::OnRtpPacket(const RtpPacketReceived& packet) { // StreamStatisticianImpl instance is created once and only destroyed when @@ -380,21 +374,12 @@ StreamStatisticianImplInterface* ReceiveStatisticsImpl::GetOrCreateStatistician( uint32_t ssrc) { std::unique_ptr& impl = statisticians_[ssrc]; if (impl == nullptr) { // new element - impl = - stream_statistician_factory_(ssrc, clock_, max_reordering_threshold_); + impl = stream_statistician_factory_(ssrc, clock_); all_ssrcs_.push_back(ssrc); } return impl.get(); } -void ReceiveStatisticsImpl::SetMaxReorderingThreshold( - int max_reordering_threshold) { - max_reordering_threshold_ = max_reordering_threshold; - for (auto& statistician : statisticians_) { - statistician.second->SetMaxReorderingThreshold(max_reordering_threshold); - } -} - void ReceiveStatisticsImpl::SetMaxReorderingThreshold( uint32_t ssrc, int max_reordering_threshold) { diff --git a/modules/rtp_rtcp/source/receive_statistics_impl.h b/modules/rtp_rtcp/source/receive_statistics_impl.h index a6e2d8bf7c..f73a582f92 100644 --- a/modules/rtp_rtcp/source/receive_statistics_impl.h +++ b/modules/rtp_rtcp/source/receive_statistics_impl.h @@ -44,9 +44,7 @@ class StreamStatisticianImplInterface : public StreamStatistician { // Thread-compatible implementation of StreamStatisticianImplInterface. class StreamStatisticianImpl : public StreamStatisticianImplInterface { public: - StreamStatisticianImpl(uint32_t ssrc, - Clock* clock, - int max_reordering_threshold); + StreamStatisticianImpl(uint32_t ssrc, Clock* clock); ~StreamStatisticianImpl() override; // Implements StreamStatistician @@ -119,10 +117,7 @@ class StreamStatisticianImpl : public StreamStatisticianImplInterface { // Thread-safe implementation of StreamStatisticianImplInterface. class StreamStatisticianLocked : public StreamStatisticianImplInterface { public: - StreamStatisticianLocked(uint32_t ssrc, - Clock* clock, - int max_reordering_threshold) - : impl_(ssrc, clock, max_reordering_threshold) {} + StreamStatisticianLocked(uint32_t ssrc, Clock* clock) : impl_(ssrc, clock) {} ~StreamStatisticianLocked() override = default; RtpReceiveStats GetStats() const override { @@ -171,8 +166,7 @@ class ReceiveStatisticsImpl : public ReceiveStatistics { Clock* clock, std::function( uint32_t ssrc, - Clock* clock, - int max_reordering_threshold)> stream_statistician_factory); + Clock* clock)> stream_statistician_factory); ~ReceiveStatisticsImpl() override = default; // Implements ReceiveStatisticsProvider. @@ -183,7 +177,6 @@ class ReceiveStatisticsImpl : public ReceiveStatistics { // Implements ReceiveStatistics. StreamStatistician* GetStatistician(uint32_t ssrc) const override; - void SetMaxReorderingThreshold(int max_reordering_threshold) override; void SetMaxReorderingThreshold(uint32_t ssrc, int max_reordering_threshold) override; void EnableRetransmitDetection(uint32_t ssrc, bool enable) override; @@ -192,15 +185,12 @@ class ReceiveStatisticsImpl : public ReceiveStatistics { StreamStatisticianImplInterface* GetOrCreateStatistician(uint32_t ssrc); Clock* const clock_; - std::function( - uint32_t ssrc, - Clock* clock, - int max_reordering_threshold)> + std::function(uint32_t ssrc, + Clock* clock)> stream_statistician_factory_; // The index within `all_ssrcs_` that was last returned. size_t last_returned_ssrc_idx_; std::vector all_ssrcs_; - int max_reordering_threshold_; flat_map> statisticians_; }; @@ -213,8 +203,7 @@ class ReceiveStatisticsLocked : public ReceiveStatistics { Clock* clock, std::function( uint32_t ssrc, - Clock* clock, - int max_reordering_threshold)> stream_statitician_factory) + Clock* clock)> stream_statitician_factory) : impl_(clock, std::move(stream_statitician_factory)) {} ~ReceiveStatisticsLocked() override = default; std::vector RtcpReportBlocks(size_t max_blocks) override { @@ -229,10 +218,6 @@ class ReceiveStatisticsLocked : public ReceiveStatistics { MutexLock lock(&receive_statistics_lock_); return impl_.GetStatistician(ssrc); } - void SetMaxReorderingThreshold(int max_reordering_threshold) override { - MutexLock lock(&receive_statistics_lock_); - return impl_.SetMaxReorderingThreshold(max_reordering_threshold); - } void SetMaxReorderingThreshold(uint32_t ssrc, int max_reordering_threshold) override { MutexLock lock(&receive_statistics_lock_);