From eb61b7f620c1f84cb9d34c7752cea65fe5d1d721 Mon Sep 17 00:00:00 2001 From: Markus Handell Date: Tue, 22 Jun 2021 10:46:48 +0200 Subject: ModuleRtcRtcpImpl2: remove Module inheritance. This change achieves an Idle Wakeup savings of 200 Hz. ModuleRtcRtcpImpl2 had Process() logic only active if TMMBR() is enabled in RtcpSender, which it never is. Hence the Module inheritance could be removed. The change removes all known dependencies of the module inheritance, and any related mentions of ProcessThread. Fixed: webrtc:11581 Change-Id: I440942f07187fdb9ac18186dab088633969b340e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/222604 Reviewed-by: Tommi Reviewed-by: Harald Alvestrand Commit-Queue: Markus Handell Cr-Commit-Position: refs/heads/master@{#34358} --- modules/rtp_rtcp/source/rtp_rtcp_impl2.cc | 45 ------------------------------- 1 file changed, 45 deletions(-) (limited to 'modules/rtp_rtcp/source/rtp_rtcp_impl2.cc') diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc index 77054576a8..7fae1e3bd0 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc @@ -39,7 +39,6 @@ namespace webrtc { namespace { -const int64_t kRtpRtcpMaxIdleTimeProcessMs = 5; const int64_t kDefaultExpectedRetransmissionTimeMs = 125; constexpr TimeDelta kRttUpdateInterval = TimeDelta::Millis(1000); @@ -84,9 +83,6 @@ ModuleRtpRtcpImpl2::ModuleRtpRtcpImpl2(const Configuration& configuration) })), rtcp_receiver_(configuration, this), clock_(configuration.clock), - last_rtt_process_time_(clock_->TimeInMilliseconds()), - next_process_time_(clock_->TimeInMilliseconds() + - kRtpRtcpMaxIdleTimeProcessMs), packet_overhead_(28), // IPV4 UDP. nack_last_time_sent_full_ms_(0), nack_last_seq_number_sent_(0), @@ -94,7 +90,6 @@ ModuleRtpRtcpImpl2::ModuleRtpRtcpImpl2(const Configuration& configuration) rtt_stats_(configuration.rtt_stats), rtt_ms_(0) { RTC_DCHECK(worker_queue_); - process_thread_checker_.Detach(); packet_sequence_checker_.Detach(); if (!configuration.receiver_only) { rtp_sender_ = std::make_unique(configuration); @@ -131,39 +126,6 @@ std::unique_ptr ModuleRtpRtcpImpl2::Create( return std::make_unique(configuration); } -// Returns the number of milliseconds until the module want a worker thread -// to call Process. -int64_t ModuleRtpRtcpImpl2::TimeUntilNextProcess() { - RTC_DCHECK_RUN_ON(&process_thread_checker_); - return std::max(0, - next_process_time_ - clock_->TimeInMilliseconds()); -} - -// Process any pending tasks such as timeouts (non time critical events). -void ModuleRtpRtcpImpl2::Process() { - RTC_DCHECK_RUN_ON(&process_thread_checker_); - - const Timestamp now = clock_->CurrentTime(); - - // TODO(bugs.webrtc.org/11581): Figure out why we need to call Process() 200 - // times a second. - next_process_time_ = now.ms() + kRtpRtcpMaxIdleTimeProcessMs; - - // TODO(bugs.webrtc.org/11581): once we don't use Process() to trigger - // calls to SendRTCP(), the only remaining timer will require remote_bitrate_ - // to be not null. In that case, we can disable the timer when it is null. - if (remote_bitrate_ && rtcp_sender_.Sending() && rtcp_sender_.TMMBR()) { - unsigned int target_bitrate = 0; - std::vector ssrcs; - if (remote_bitrate_->LatestEstimate(&ssrcs, &target_bitrate)) { - if (!ssrcs.empty()) { - target_bitrate = target_bitrate / ssrcs.size(); - } - rtcp_sender_.SetTargetBitrate(target_bitrate); - } - } -} - void ModuleRtpRtcpImpl2::SetRtxSendStatus(int mode) { rtp_sender_->packet_generator.SetRtxStatus(mode); } @@ -780,13 +742,6 @@ void ModuleRtpRtcpImpl2::PeriodicUpdate() { rtt_stats_->OnRttUpdate(rtt->ms()); set_rtt_ms(rtt->ms()); } - - // kTmmbrTimeoutIntervalMs is 25 seconds, so an order of seconds. - // Instead of this polling approach, consider having an optional timer in the - // RTCPReceiver class that is started/stopped based on the state of - // rtcp_sender_.TMMBR(). - if (rtcp_sender_.TMMBR() && rtcp_receiver_.UpdateTmmbrTimers()) - rtcp_receiver_.NotifyTmmbrUpdated(); } // RTC_RUN_ON(worker_queue_); -- cgit v1.2.3