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

Side by Side Diff: webrtc/modules/audio_coding/audio_network_adaptor/controller_manager.cc

Issue 2684773002: Experiment-driven configuration of PLR/RPLR-based FecController (Closed)
Patch Set: Remove Clock from RplrBasedFecController Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/modules/audio_coding/audio_network_adaptor/controller_manager.h " 11 #include "webrtc/modules/audio_coding/audio_network_adaptor/controller_manager.h "
12 12
13 #include <cmath> 13 #include <cmath>
14 #include <utility> 14 #include <utility>
15 15
16 #include "webrtc/base/ignore_wundef.h" 16 #include "webrtc/base/ignore_wundef.h"
17 #include "webrtc/modules/audio_coding/audio_network_adaptor/bitrate_controller.h " 17 #include "webrtc/modules/audio_coding/audio_network_adaptor/bitrate_controller.h "
18 #include "webrtc/modules/audio_coding/audio_network_adaptor/channel_controller.h " 18 #include "webrtc/modules/audio_coding/audio_network_adaptor/channel_controller.h "
19 #include "webrtc/modules/audio_coding/audio_network_adaptor/dtx_controller.h" 19 #include "webrtc/modules/audio_coding/audio_network_adaptor/dtx_controller.h"
20 #include "webrtc/modules/audio_coding/audio_network_adaptor/fec_controller_plr_b ased.h" 20 #include "webrtc/modules/audio_coding/audio_network_adaptor/fec_controller_plr_b ased.h"
21 #include "webrtc/modules/audio_coding/audio_network_adaptor/fec_controller_rplr_ based.h"
21 #include "webrtc/modules/audio_coding/audio_network_adaptor/frame_length_control ler.h" 22 #include "webrtc/modules/audio_coding/audio_network_adaptor/frame_length_control ler.h"
22 #include "webrtc/system_wrappers/include/clock.h" 23 #include "webrtc/system_wrappers/include/clock.h"
23 24
24 #ifdef WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP 25 #ifdef WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP
25 RTC_PUSH_IGNORING_WUNDEF() 26 RTC_PUSH_IGNORING_WUNDEF()
26 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD 27 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD
27 #include "external/webrtc/webrtc/modules/audio_coding/audio_network_adaptor/conf ig.pb.h" 28 #include "external/webrtc/webrtc/modules/audio_coding/audio_network_adaptor/conf ig.pb.h"
28 #else 29 #else
29 #include "webrtc/modules/audio_coding/audio_network_adaptor/config.pb.h" 30 #include "webrtc/modules/audio_coding/audio_network_adaptor/config.pb.h"
30 #endif 31 #endif
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 fec_enabling_threshold.high_bandwidth_bps(), 67 fec_enabling_threshold.high_bandwidth_bps(),
67 fec_enabling_threshold.high_bandwidth_packet_loss()), 68 fec_enabling_threshold.high_bandwidth_packet_loss()),
68 FecControllerPlrBased::Config::Threshold( 69 FecControllerPlrBased::Config::Threshold(
69 fec_disabling_threshold.low_bandwidth_bps(), 70 fec_disabling_threshold.low_bandwidth_bps(),
70 fec_disabling_threshold.low_bandwidth_packet_loss(), 71 fec_disabling_threshold.low_bandwidth_packet_loss(),
71 fec_disabling_threshold.high_bandwidth_bps(), 72 fec_disabling_threshold.high_bandwidth_bps(),
72 fec_disabling_threshold.high_bandwidth_packet_loss()), 73 fec_disabling_threshold.high_bandwidth_packet_loss()),
73 config.time_constant_ms(), clock))); 74 config.time_constant_ms(), clock)));
74 } 75 }
75 76
77 std::unique_ptr<FecControllerRplrBased> CreateFecControllerRplrBased(
78 const audio_network_adaptor::config::FecControllerRplrBased& config,
79 bool initial_fec_enabled) {
80 RTC_CHECK(config.has_fec_enabling_threshold());
81 RTC_CHECK(config.has_fec_disabling_threshold());
82
83 auto& fec_enabling_threshold = config.fec_enabling_threshold();
84 RTC_CHECK(fec_enabling_threshold.has_low_bandwidth_bps());
85 RTC_CHECK(fec_enabling_threshold.has_low_bandwidth_recoverable_packet_loss());
86 RTC_CHECK(fec_enabling_threshold.has_high_bandwidth_bps());
87 RTC_CHECK(
88 fec_enabling_threshold.has_high_bandwidth_recoverable_packet_loss());
89
90 auto& fec_disabling_threshold = config.fec_disabling_threshold();
91 RTC_CHECK(fec_disabling_threshold.has_low_bandwidth_bps());
92 RTC_CHECK(
93 fec_disabling_threshold.has_low_bandwidth_recoverable_packet_loss());
94 RTC_CHECK(fec_disabling_threshold.has_high_bandwidth_bps());
95 RTC_CHECK(
96 fec_disabling_threshold.has_high_bandwidth_recoverable_packet_loss());
97
98 return std::unique_ptr<FecControllerRplrBased>(
99 new FecControllerRplrBased(FecControllerRplrBased::Config(
100 initial_fec_enabled,
101 FecControllerRplrBased::Config::Threshold(
102 fec_enabling_threshold.low_bandwidth_bps(),
103 fec_enabling_threshold.low_bandwidth_recoverable_packet_loss(),
104 fec_enabling_threshold.high_bandwidth_bps(),
105 fec_enabling_threshold.high_bandwidth_recoverable_packet_loss()),
106 FecControllerRplrBased::Config::Threshold(
107 fec_disabling_threshold.low_bandwidth_bps(),
108 fec_disabling_threshold.low_bandwidth_recoverable_packet_loss(),
109 fec_disabling_threshold.high_bandwidth_bps(),
110 fec_disabling_threshold
111 .high_bandwidth_recoverable_packet_loss()))));
112 }
113
76 std::unique_ptr<FrameLengthController> CreateFrameLengthController( 114 std::unique_ptr<FrameLengthController> CreateFrameLengthController(
77 const audio_network_adaptor::config::FrameLengthController& config, 115 const audio_network_adaptor::config::FrameLengthController& config,
78 rtc::ArrayView<const int> encoder_frame_lengths_ms, 116 rtc::ArrayView<const int> encoder_frame_lengths_ms,
79 int initial_frame_length_ms, 117 int initial_frame_length_ms,
80 int min_encoder_bitrate_bps) { 118 int min_encoder_bitrate_bps) {
81 RTC_CHECK(config.has_fl_increasing_packet_loss_fraction()); 119 RTC_CHECK(config.has_fl_increasing_packet_loss_fraction());
82 RTC_CHECK(config.has_fl_decreasing_packet_loss_fraction()); 120 RTC_CHECK(config.has_fl_decreasing_packet_loss_fraction());
83 RTC_CHECK(config.has_fl_20ms_to_60ms_bandwidth_bps()); 121 RTC_CHECK(config.has_fl_20ms_to_60ms_bandwidth_bps());
84 RTC_CHECK(config.has_fl_60ms_to_20ms_bandwidth_bps()); 122 RTC_CHECK(config.has_fl_60ms_to_20ms_bandwidth_bps());
85 123
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 std::map<const Controller*, std::pair<int, float>> chracteristic_points; 214 std::map<const Controller*, std::pair<int, float>> chracteristic_points;
177 215
178 for (int i = 0; i < controller_manager_config.controllers_size(); ++i) { 216 for (int i = 0; i < controller_manager_config.controllers_size(); ++i) {
179 auto& controller_config = controller_manager_config.controllers(i); 217 auto& controller_config = controller_manager_config.controllers(i);
180 std::unique_ptr<Controller> controller; 218 std::unique_ptr<Controller> controller;
181 switch (controller_config.controller_case()) { 219 switch (controller_config.controller_case()) {
182 case audio_network_adaptor::config::Controller::kFecController: 220 case audio_network_adaptor::config::Controller::kFecController:
183 controller = CreateFecControllerPlrBased( 221 controller = CreateFecControllerPlrBased(
184 controller_config.fec_controller(), initial_fec_enabled, clock); 222 controller_config.fec_controller(), initial_fec_enabled, clock);
185 break; 223 break;
224 case audio_network_adaptor::config::Controller::kFecControllerRplrBased:
225 controller = CreateFecControllerRplrBased(
226 controller_config.fec_controller_rplr_based(), initial_fec_enabled);
227 break;
186 case audio_network_adaptor::config::Controller::kFrameLengthController: 228 case audio_network_adaptor::config::Controller::kFrameLengthController:
187 controller = CreateFrameLengthController( 229 controller = CreateFrameLengthController(
188 controller_config.frame_length_controller(), 230 controller_config.frame_length_controller(),
189 encoder_frame_lengths_ms, initial_frame_length_ms, 231 encoder_frame_lengths_ms, initial_frame_length_ms,
190 min_encoder_bitrate_bps); 232 min_encoder_bitrate_bps);
191 break; 233 break;
192 case audio_network_adaptor::config::Controller::kChannelController: 234 case audio_network_adaptor::config::Controller::kChannelController:
193 controller = CreateChannelController( 235 controller = CreateChannelController(
194 controller_config.channel_controller(), num_encoder_channels, 236 controller_config.channel_controller(), num_encoder_channels,
195 intial_channels_to_encode); 237 intial_channels_to_encode);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 NormalizeUplinkBandwidth(scoring_point.uplink_bandwidth_bps) - 387 NormalizeUplinkBandwidth(scoring_point.uplink_bandwidth_bps) -
346 NormalizeUplinkBandwidth(uplink_bandwidth_bps); 388 NormalizeUplinkBandwidth(uplink_bandwidth_bps);
347 float diff_normalized_packet_loss = 389 float diff_normalized_packet_loss =
348 NormalizePacketLossFraction(scoring_point.uplink_packet_loss_fraction) - 390 NormalizePacketLossFraction(scoring_point.uplink_packet_loss_fraction) -
349 NormalizePacketLossFraction(uplink_packet_loss_fraction); 391 NormalizePacketLossFraction(uplink_packet_loss_fraction);
350 return std::pow(diff_normalized_bitrate_bps, 2) + 392 return std::pow(diff_normalized_bitrate_bps, 2) +
351 std::pow(diff_normalized_packet_loss, 2); 393 std::pow(diff_normalized_packet_loss, 2);
352 } 394 }
353 395
354 } // namespace webrtc 396 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698