From bef818d4d9ee176fe1d67c3c261699515c94a4f2 Mon Sep 17 00:00:00 2001 From: Sebastian Jansson Date: Thu, 30 Jan 2020 14:09:48 +0100 Subject: [PATCH] Default disables legacy overhead calculation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This ensures that overhead calculation is correct by default when enabling the WebRTC-SendSideBwe-WithOverhead field trial. We keep the legacy mode to allow downstream projects already relying on WebRTC-SendSideBwe-WithOverhead to preserve the current behavior. Bug: webrtc:6762 Change-Id: I84369c760d59345a48ec352997dbed6d2db21d13 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/167862 Commit-Queue: Sebastian Jansson Reviewed-by: Erik Språng Reviewed-by: Sam Zackrisson Cr-Commit-Position: refs/heads/master@{#30424} --- audio/audio_send_stream.cc | 2 +- modules/pacing/pacing_controller.cc | 2 +- modules/pacing/round_robin_packet_queue.cc | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc index ba13fcbe8b..96dcf75875 100644 --- a/audio/audio_send_stream.cc +++ b/audio/audio_send_stream.cc @@ -154,7 +154,7 @@ AudioSendStream::AudioSendStream( channel_send_(std::move(channel_send)), event_log_(event_log), use_legacy_overhead_calculation_( - !field_trial::IsDisabled("WebRTC-Audio-LegacyOverhead")), + field_trial::IsEnabled("WebRTC-Audio-LegacyOverhead")), bitrate_allocator_(bitrate_allocator), rtp_transport_(rtp_transport), rtp_rtcp_module_(channel_send_->GetRtpRtcp()), diff --git a/modules/pacing/pacing_controller.cc b/modules/pacing/pacing_controller.cc index f2b21492de..1f3849e8e9 100644 --- a/modules/pacing/pacing_controller.cc +++ b/modules/pacing/pacing_controller.cc @@ -100,7 +100,7 @@ PacingController::PacingController(Clock* clock, small_first_probe_packet_( IsEnabled(*field_trials_, "WebRTC-Pacer-SmallFirstProbePacket")), ignore_transport_overhead_( - !IsDisabled(*field_trials_, "WebRTC-Pacer-IgnoreTransportOverhead")), + IsEnabled(*field_trials_, "WebRTC-Pacer-IgnoreTransportOverhead")), min_packet_limit_(kDefaultMinPacketLimit), transport_overhead_per_packet_(DataSize::Zero()), last_timestamp_(clock_->CurrentTime()), diff --git a/modules/pacing/round_robin_packet_queue.cc b/modules/pacing/round_robin_packet_queue.cc index 32f288c209..7c2a7d2ae8 100644 --- a/modules/pacing/round_robin_packet_queue.cc +++ b/modules/pacing/round_robin_packet_queue.cc @@ -260,6 +260,15 @@ void RoundRobinPacketQueue::SetIncludeOverhead() { } void RoundRobinPacketQueue::SetTransportOverhead(DataSize overhead_per_packet) { + if (include_overhead_) { + DataSize previous_overhead = transport_overhead_per_packet_; + // We need to update the size to reflect overhead for existing packets. + for (const auto& stream : streams_) { + int packets = stream.second.packet_queue.size(); + size_ -= packets * previous_overhead; + size_ += packets * overhead_per_packet; + } + } transport_overhead_per_packet_ = overhead_per_packet; }