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 <ossu@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25448}
This commit is contained in:
Sebastian Jansson 2018-10-24 11:18:07 +02:00 committed by Commit Bot
parent 69807e8871
commit ed45c57d98

View file

@ -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();