Chromium Code Reviews| 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 fl_changing_bandwidths_bps.insert( | |
| 87 std::make_pair(FrameLengthController::Config::FrameLengthChange(20, 60), | |
| 88 config.fl_20ms_to_60ms_bandwidth_bps())); | |
| 89 fl_changing_bandwidths_bps.insert( | |
| 90 std::make_pair(FrameLengthController::Config::FrameLengthChange(60, 20), | |
| 91 config.fl_60ms_to_20ms_bandwidth_bps())); | |
|
kwiberg-webrtc
2017/02/02 12:34:02
I think you can replace line 84-91 with something
michaelt
2017/02/02 13:04:34
Cool
kwiberg-webrtc
2017/02/02 13:18:40
Nice. I suspect it's a bit more efficient, but mai
| |
| 92 if (config.has_fl_60ms_to_120ms_bandwidth_bps() && | |
| 93 config.has_fl_120ms_to_60ms_bandwidth_bps()) { | |
| 94 fl_changing_bandwidths_bps.insert(std::make_pair( | |
| 95 FrameLengthController::Config::FrameLengthChange(60, 120), | |
| 96 config.fl_60ms_to_120ms_bandwidth_bps())); | |
| 97 fl_changing_bandwidths_bps.insert(std::make_pair( | |
| 98 FrameLengthController::Config::FrameLengthChange(120, 60), | |
| 99 config.fl_120ms_to_60ms_bandwidth_bps())); | |
| 100 } | |
| 101 | |
| 84 FrameLengthController::Config ctor_config( | 102 FrameLengthController::Config ctor_config( |
| 85 std::vector<int>(), initial_frame_length_ms, | 103 std::vector<int>(), initial_frame_length_ms, |
| 86 config.fl_increasing_packet_loss_fraction(), | 104 config.fl_increasing_packet_loss_fraction(), |
| 87 config.fl_decreasing_packet_loss_fraction(), | 105 config.fl_decreasing_packet_loss_fraction(), fl_changing_bandwidths_bps); |
|
kwiberg-webrtc
2017/02/02 12:34:02
If you std::move fl_changing_bandwidths_bps here a
michaelt
2017/02/02 13:04:34
Done.
| |
| 88 config.fl_20ms_to_60ms_bandwidth_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 |