| Index: webrtc/modules/audio_coding/audio_network_adaptor/frame_length_controller.cc
|
| diff --git a/webrtc/modules/audio_coding/audio_network_adaptor/frame_length_controller.cc b/webrtc/modules/audio_coding/audio_network_adaptor/frame_length_controller.cc
|
| index 4dd60888295316fa1eba57128695dbd4ba6fbeff..2cb016a7e6b39f6b6ea092e11bfe24048542e4e8 100644
|
| --- a/webrtc/modules/audio_coding/audio_network_adaptor/frame_length_controller.cc
|
| +++ b/webrtc/modules/audio_coding/audio_network_adaptor/frame_length_controller.cc
|
| @@ -32,12 +32,16 @@ FrameLengthController::Config::Config(
|
| int min_encoder_bitrate_bps,
|
| float fl_increasing_packet_loss_fraction,
|
| float fl_decreasing_packet_loss_fraction,
|
| + int fl_increase_overhead_offset,
|
| + int fl_decrease_overhead_offset,
|
| std::map<FrameLengthChange, int> fl_changing_bandwidths_bps)
|
| : encoder_frame_lengths_ms(encoder_frame_lengths_ms),
|
| initial_frame_length_ms(initial_frame_length_ms),
|
| min_encoder_bitrate_bps(min_encoder_bitrate_bps),
|
| fl_increasing_packet_loss_fraction(fl_increasing_packet_loss_fraction),
|
| fl_decreasing_packet_loss_fraction(fl_decreasing_packet_loss_fraction),
|
| + fl_increase_overhead_offset(fl_increase_overhead_offset),
|
| + fl_decrease_overhead_offset(fl_decrease_overhead_offset),
|
| fl_changing_bandwidths_bps(std::move(fl_changing_bandwidths_bps)) {}
|
|
|
| FrameLengthController::Config::Config(const Config& other) = default;
|
| @@ -71,9 +75,12 @@ void FrameLengthController::MakeDecision(AudioEncoderRuntimeConfig* config) {
|
|
|
| if (FrameLengthIncreasingDecision(*config)) {
|
| ++frame_length_ms_;
|
| + prev_decision_increase_ = true;
|
| } else if (FrameLengthDecreasingDecision(*config)) {
|
| --frame_length_ms_;
|
| + prev_decision_increase_ = false;
|
| }
|
| + config->last_fl_change_increase = prev_decision_increase_;
|
| config->frame_length_ms = rtc::Optional<int>(*frame_length_ms_);
|
| }
|
|
|
| @@ -113,7 +120,9 @@ bool FrameLengthController::FrameLengthIncreasingDecision(
|
| if (uplink_bandwidth_bps_ && overhead_bytes_per_packet_ &&
|
| *uplink_bandwidth_bps_ <=
|
| config_.min_encoder_bitrate_bps + kPreventOveruseMarginBps +
|
| - OverheadRateBps(*overhead_bytes_per_packet_, *frame_length_ms_)) {
|
| + OverheadRateBps(*overhead_bytes_per_packet_ +
|
| + config_.fl_increase_overhead_offset,
|
| + *frame_length_ms_)) {
|
| return true;
|
| }
|
|
|
| @@ -145,10 +154,11 @@ bool FrameLengthController::FrameLengthDecreasingDecision(
|
| return false;
|
|
|
| if (uplink_bandwidth_bps_ && overhead_bytes_per_packet_ &&
|
| - *uplink_bandwidth_bps_ <= config_.min_encoder_bitrate_bps +
|
| - kPreventOveruseMarginBps +
|
| - OverheadRateBps(*overhead_bytes_per_packet_,
|
| - *shorter_frame_length_ms)) {
|
| + *uplink_bandwidth_bps_ <=
|
| + config_.min_encoder_bitrate_bps + kPreventOveruseMarginBps +
|
| + OverheadRateBps(*overhead_bytes_per_packet_ +
|
| + config_.fl_decrease_overhead_offset,
|
| + *shorter_frame_length_ms)) {
|
| return false;
|
| }
|
|
|
|
|