Index: webrtc/modules/audio_coding/audio_network_adaptor/channel_controller.cc |
diff --git a/webrtc/modules/audio_coding/audio_network_adaptor/channel_controller.cc b/webrtc/modules/audio_coding/audio_network_adaptor/channel_controller.cc |
index e06b46f3a06852b32779b28ffd0a4a01da02fe17..77217a381c4274b289b7015ef5bce7eabb307311 100644 |
--- a/webrtc/modules/audio_coding/audio_network_adaptor/channel_controller.cc |
+++ b/webrtc/modules/audio_coding/audio_network_adaptor/channel_controller.cc |
@@ -33,19 +33,25 @@ ChannelController::ChannelController(const Config& config) |
config_.intial_channels_to_encode); |
} |
+ChannelController::~ChannelController() = default; |
+ |
+void ChannelController::UpdateNetworkMetrics( |
+ const NetworkMetrics& network_metrics) { |
+ if (network_metrics.uplink_bandwidth_bps) |
+ uplink_bandwidth_bps_ = network_metrics.uplink_bandwidth_bps; |
+} |
+ |
void ChannelController::MakeDecision( |
- const NetworkMetrics& metrics, |
AudioNetworkAdaptor::EncoderRuntimeConfig* config) { |
// Decision on |num_channels| should not have been made. |
RTC_DCHECK(!config->num_channels); |
- if (metrics.uplink_bandwidth_bps) { |
+ if (uplink_bandwidth_bps_) { |
if (channels_to_encode_ == 2 && |
- *metrics.uplink_bandwidth_bps <= config_.channel_2_to_1_bandwidth_bps) { |
+ *uplink_bandwidth_bps_ <= config_.channel_2_to_1_bandwidth_bps) { |
channels_to_encode_ = 1; |
} else if (channels_to_encode_ == 1 && |
- *metrics.uplink_bandwidth_bps >= |
- config_.channel_1_to_2_bandwidth_bps) { |
+ *uplink_bandwidth_bps_ >= config_.channel_1_to_2_bandwidth_bps) { |
channels_to_encode_ = |
std::min(static_cast<size_t>(2), config_.num_encoder_channels); |
} |