Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(659)

Unified Diff: webrtc/modules/audio_coding/audio_network_adaptor/channel_controller.cc

Issue 2643133003: Instantly pass network changes to controllers in audio network adaptor. (Closed)
Patch Set: fixing unittests Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}

Powered by Google App Engine
This is Rietveld 408576698