OLD | NEW |
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 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 std::unique_ptr<FrameLengthController> CreateFrameLengthController( | 75 std::unique_ptr<FrameLengthController> CreateFrameLengthController( |
76 const audio_network_adaptor::config::FrameLengthController& config, | 76 const audio_network_adaptor::config::FrameLengthController& config, |
77 rtc::ArrayView<const int> encoder_frame_lengths_ms, | 77 rtc::ArrayView<const int> encoder_frame_lengths_ms, |
78 int initial_frame_length_ms) { | 78 int initial_frame_length_ms) { |
79 RTC_CHECK(config.has_fl_increasing_packet_loss_fraction()); | 79 RTC_CHECK(config.has_fl_increasing_packet_loss_fraction()); |
80 RTC_CHECK(config.has_fl_decreasing_packet_loss_fraction()); | 80 RTC_CHECK(config.has_fl_decreasing_packet_loss_fraction()); |
81 RTC_CHECK(config.has_fl_20ms_to_60ms_bandwidth_bps()); | 81 RTC_CHECK(config.has_fl_20ms_to_60ms_bandwidth_bps()); |
82 RTC_CHECK(config.has_fl_60ms_to_20ms_bandwidth_bps()); | 82 RTC_CHECK(config.has_fl_60ms_to_20ms_bandwidth_bps()); |
83 | 83 |
| 84 std::map<FrameLengthController::Config::FrameLengthChange, int> |
| 85 fl_changing_bandwidths_bps = { |
| 86 {FrameLengthController::Config::FrameLengthChange(20, 60), |
| 87 config.fl_20ms_to_60ms_bandwidth_bps()}, |
| 88 {FrameLengthController::Config::FrameLengthChange(60, 20), |
| 89 config.fl_60ms_to_20ms_bandwidth_bps()}}; |
| 90 |
| 91 if (config.has_fl_60ms_to_120ms_bandwidth_bps() && |
| 92 config.has_fl_120ms_to_60ms_bandwidth_bps()) { |
| 93 fl_changing_bandwidths_bps.insert(std::make_pair( |
| 94 FrameLengthController::Config::FrameLengthChange(60, 120), |
| 95 config.fl_60ms_to_120ms_bandwidth_bps())); |
| 96 fl_changing_bandwidths_bps.insert(std::make_pair( |
| 97 FrameLengthController::Config::FrameLengthChange(120, 60), |
| 98 config.fl_120ms_to_60ms_bandwidth_bps())); |
| 99 } |
| 100 |
84 FrameLengthController::Config ctor_config( | 101 FrameLengthController::Config ctor_config( |
85 std::vector<int>(), initial_frame_length_ms, | 102 std::vector<int>(), initial_frame_length_ms, |
86 config.fl_increasing_packet_loss_fraction(), | 103 config.fl_increasing_packet_loss_fraction(), |
87 config.fl_decreasing_packet_loss_fraction(), | 104 config.fl_decreasing_packet_loss_fraction(), |
88 config.fl_20ms_to_60ms_bandwidth_bps(), | 105 std::move(fl_changing_bandwidths_bps)); |
89 config.fl_60ms_to_20ms_bandwidth_bps()); | |
90 | 106 |
91 for (auto frame_length : encoder_frame_lengths_ms) | 107 for (auto frame_length : encoder_frame_lengths_ms) |
92 ctor_config.encoder_frame_lengths_ms.push_back(frame_length); | 108 ctor_config.encoder_frame_lengths_ms.push_back(frame_length); |
93 | 109 |
94 return std::unique_ptr<FrameLengthController>( | 110 return std::unique_ptr<FrameLengthController>( |
95 new FrameLengthController(ctor_config)); | 111 new FrameLengthController(ctor_config)); |
96 } | 112 } |
97 | 113 |
98 std::unique_ptr<ChannelController> CreateChannelController( | 114 std::unique_ptr<ChannelController> CreateChannelController( |
99 const audio_network_adaptor::config::ChannelController& config, | 115 const audio_network_adaptor::config::ChannelController& config, |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 NormalizeUplinkBandwidth(scoring_point.uplink_bandwidth_bps) - | 341 NormalizeUplinkBandwidth(scoring_point.uplink_bandwidth_bps) - |
326 NormalizeUplinkBandwidth(uplink_bandwidth_bps); | 342 NormalizeUplinkBandwidth(uplink_bandwidth_bps); |
327 float diff_normalized_packet_loss = | 343 float diff_normalized_packet_loss = |
328 NormalizePacketLossFraction(scoring_point.uplink_packet_loss_fraction) - | 344 NormalizePacketLossFraction(scoring_point.uplink_packet_loss_fraction) - |
329 NormalizePacketLossFraction(uplink_packet_loss_fraction); | 345 NormalizePacketLossFraction(uplink_packet_loss_fraction); |
330 return std::pow(diff_normalized_bitrate_bps, 2) + | 346 return std::pow(diff_normalized_bitrate_bps, 2) + |
331 std::pow(diff_normalized_packet_loss, 2); | 347 std::pow(diff_normalized_packet_loss, 2); |
332 } | 348 } |
333 | 349 |
334 } // namespace webrtc | 350 } // namespace webrtc |
OLD | NEW |