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 1e78db8fc6106b5dbb82b855efa90bebbfeb592a..c0044bb36f53b5cf3abb0e49504efccfc70e4af5 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 |
@@ -22,14 +22,12 @@ FrameLengthController::Config::Config( |
int initial_frame_length_ms, |
float fl_increasing_packet_loss_fraction, |
float fl_decreasing_packet_loss_fraction, |
- int fl_20ms_to_60ms_bandwidth_bps, |
- int fl_60ms_to_20ms_bandwidth_bps) |
+ const std::map<FrameLengthChange, int>& frame_length_change_criteria) |
: encoder_frame_lengths_ms(encoder_frame_lengths_ms), |
initial_frame_length_ms(initial_frame_length_ms), |
fl_increasing_packet_loss_fraction(fl_increasing_packet_loss_fraction), |
fl_decreasing_packet_loss_fraction(fl_decreasing_packet_loss_fraction), |
- fl_20ms_to_60ms_bandwidth_bps(fl_20ms_to_60ms_bandwidth_bps), |
- fl_60ms_to_20ms_bandwidth_bps(fl_60ms_to_20ms_bandwidth_bps) {} |
+ frame_length_change_criteria(frame_length_change_criteria) {} |
FrameLengthController::Config::Config(const Config& other) = default; |
@@ -42,11 +40,6 @@ FrameLengthController::FrameLengthController(const Config& config) |
config_.initial_frame_length_ms); |
// |encoder_frame_lengths_ms| must contain |initial_frame_length_ms|. |
RTC_DCHECK(frame_length_ms_ != config_.encoder_frame_lengths_ms.end()); |
- |
- frame_length_change_criteria_.insert(std::make_pair( |
- FrameLengthChange(20, 60), config_.fl_20ms_to_60ms_bandwidth_bps)); |
- frame_length_change_criteria_.insert(std::make_pair( |
- FrameLengthChange(60, 20), config_.fl_60ms_to_20ms_bandwidth_bps)); |
} |
FrameLengthController::~FrameLengthController() = default; |
@@ -99,10 +92,10 @@ bool FrameLengthController::FrameLengthIncreasingDecision( |
if (longer_frame_length_ms == config_.encoder_frame_lengths_ms.end()) |
return false; |
- auto increase_threshold = frame_length_change_criteria_.find( |
+ auto increase_threshold = config_.frame_length_change_criteria.find( |
FrameLengthChange(*frame_length_ms_, *longer_frame_length_ms)); |
- if (increase_threshold == frame_length_change_criteria_.end()) |
+ if (increase_threshold == config_.frame_length_change_criteria.end()) |
return false; |
return (uplink_bandwidth_bps_ && |
@@ -124,10 +117,10 @@ bool FrameLengthController::FrameLengthDecreasingDecision( |
return false; |
auto shorter_frame_length_ms = std::prev(frame_length_ms_); |
- auto decrease_threshold = frame_length_change_criteria_.find( |
+ auto decrease_threshold = config_.frame_length_change_criteria.find( |
FrameLengthChange(*frame_length_ms_, *shorter_frame_length_ms)); |
- if (decrease_threshold == frame_length_change_criteria_.end()) |
+ if (decrease_threshold == config_.frame_length_change_criteria.end()) |
return false; |
return (uplink_bandwidth_bps_ && |