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 <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34358}
This commit is contained in:
Markus Handell
2021-06-22 10:46:48 +02:00
committed by WebRTC LUCI CQ
parent 6e65f6a428
commit eb61b7f620
37 changed files with 59 additions and 335 deletions

View File

@ -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<RtpSenderContext>(configuration);
@ -131,39 +126,6 @@ std::unique_ptr<ModuleRtpRtcpImpl2> ModuleRtpRtcpImpl2::Create(
return std::make_unique<ModuleRtpRtcpImpl2>(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<int64_t>(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<unsigned int> 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_);