From ed45c57d9818fe8bcb91f15cfa53568ee35f0bf3 Mon Sep 17 00:00:00 2001 From: Sebastian Jansson Date: Wed, 24 Oct 2018 11:18:07 +0200 Subject: [PATCH] Corrects audio overhead correction in Scenario test. This makes the calculation more similar to the one in WebRTCVoiceEngine. Bug: webrtc:9510 Change-Id: Ibca69842726e51c07b9cc9550ff9f15a24161e28 Reviewed-on: https://webrtc-review.googlesource.com/c/107653 Reviewed-by: Oskar Sundbom Commit-Queue: Sebastian Jansson Cr-Commit-Position: refs/heads/master@{#25448} --- test/scenario/audio_stream.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/test/scenario/audio_stream.cc b/test/scenario/audio_stream.cc index ceefb6c555..521bcb7fbb 100644 --- a/test/scenario/audio_stream.cc +++ b/test/scenario/audio_stream.cc @@ -106,20 +106,19 @@ SendAudioStream::SendAudioStream( max_rate = *config.encoder.max_rate; } if (field_trial::IsEnabled("WebRTC-SendSideBwe-WithOverhead")) { - TimeDelta min_frame_length = config.encoder.initial_frame_length; - TimeDelta max_frame_length = config.encoder.initial_frame_length; - if (field_trial::IsEnabled("WebRTC-Audio-FrameLengthAdaptation") && - !config.adapt.frame.min_rate_for_20_ms.IsZero()) { - if (!config.adapt.frame.min_rate_for_60_ms.IsZero()) { - max_frame_length = TimeDelta::ms(120); - } else { - max_frame_length = TimeDelta::ms(60); - } - } + TimeDelta min_frame_length = TimeDelta::ms(20); + // Note, depends on WEBRTC_OPUS_SUPPORT_120MS_PTIME being set, which is + // the default. + TimeDelta max_frame_length = TimeDelta::ms(120); DataSize rtp_overhead = DataSize::bytes(12); + // Note that this does not include rtp extension overhead and will not + // follow updates in the transport overhead over time. DataSize total_overhead = sender_->transport_.packet_overhead() + rtp_overhead; + min_rate += total_overhead / max_frame_length; + // In WebRTCVoiceEngine the max rate is also based on the max frame + // length. max_rate += total_overhead / min_frame_length; } send_config.min_bitrate_bps = min_rate.bps();