| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 std::unique_ptr<MockSmoothingFilter> mock_smoothing_filter( | 56 std::unique_ptr<MockSmoothingFilter> mock_smoothing_filter( |
| 57 new NiceMock<MockSmoothingFilter>()); | 57 new NiceMock<MockSmoothingFilter>()); |
| 58 states.packet_loss_smoother = mock_smoothing_filter.get(); | 58 states.packet_loss_smoother = mock_smoothing_filter.get(); |
| 59 states.controller.reset(new FecControllerPlrBased( | 59 states.controller.reset(new FecControllerPlrBased( |
| 60 FecControllerPlrBased::Config( | 60 FecControllerPlrBased::Config( |
| 61 initial_fec_enabled, | 61 initial_fec_enabled, |
| 62 ThresholdCurve(kEnablingBandwidthLow, kEnablingPacketLossAtLowBw, | 62 ThresholdCurve(kEnablingBandwidthLow, kEnablingPacketLossAtLowBw, |
| 63 kEnablingBandwidthHigh, kEnablingPacketLossAtHighBw), | 63 kEnablingBandwidthHigh, kEnablingPacketLossAtHighBw), |
| 64 ThresholdCurve(kDisablingBandwidthLow, kDisablingPacketLossAtLowBw, | 64 ThresholdCurve(kDisablingBandwidthLow, kDisablingPacketLossAtLowBw, |
| 65 kDisablingBandwidthHigh, kDisablingPacketLossAtHighBw), | 65 kDisablingBandwidthHigh, kDisablingPacketLossAtHighBw), |
| 66 0, nullptr), | 66 0), |
| 67 std::move(mock_smoothing_filter))); | 67 std::move(mock_smoothing_filter))); |
| 68 return states; | 68 return states; |
| 69 } | 69 } |
| 70 | 70 |
| 71 void UpdateNetworkMetrics(FecControllerPlrBasedTestStates* states, | 71 void UpdateNetworkMetrics(FecControllerPlrBasedTestStates* states, |
| 72 const rtc::Optional<int>& uplink_bandwidth_bps, | 72 const rtc::Optional<int>& uplink_bandwidth_bps, |
| 73 const rtc::Optional<float>& uplink_packet_loss) { | 73 const rtc::Optional<float>& uplink_packet_loss) { |
| 74 // UpdateNetworkMetrics can accept multiple network metric updates at once. | 74 // UpdateNetworkMetrics can accept multiple network metric updates at once. |
| 75 // However, currently, the most used case is to update one metric at a time. | 75 // However, currently, the most used case is to update one metric at a time. |
| 76 // To reflect this fact, we separate the calls. | 76 // To reflect this fact, we separate the calls. |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 std::unique_ptr<MockSmoothingFilter> mock_smoothing_filter( | 312 std::unique_ptr<MockSmoothingFilter> mock_smoothing_filter( |
| 313 new NiceMock<MockSmoothingFilter>()); | 313 new NiceMock<MockSmoothingFilter>()); |
| 314 states.packet_loss_smoother = mock_smoothing_filter.get(); | 314 states.packet_loss_smoother = mock_smoothing_filter.get(); |
| 315 states.controller.reset(new FecControllerPlrBased( | 315 states.controller.reset(new FecControllerPlrBased( |
| 316 FecControllerPlrBased::Config( | 316 FecControllerPlrBased::Config( |
| 317 true, | 317 true, |
| 318 ThresholdCurve(kEnablingBandwidthLow, kEnablingPacketLossAtLowBw, | 318 ThresholdCurve(kEnablingBandwidthLow, kEnablingPacketLossAtLowBw, |
| 319 kEnablingBandwidthHigh, kEnablingPacketLossAtHighBw), | 319 kEnablingBandwidthHigh, kEnablingPacketLossAtHighBw), |
| 320 ThresholdCurve(kDisablingBandwidthLow, kDisablingPacketLossAtLowBw, | 320 ThresholdCurve(kDisablingBandwidthLow, kDisablingPacketLossAtLowBw, |
| 321 kDisablingBandwidthHigh, kDisablingPacketLossAtHighBw), | 321 kDisablingBandwidthHigh, kDisablingPacketLossAtHighBw), |
| 322 0, nullptr), | 322 0), |
| 323 std::move(mock_smoothing_filter))); | 323 std::move(mock_smoothing_filter))); |
| 324 | 324 |
| 325 UpdateNetworkMetrics(&states, rtc::Optional<int>(kDisablingBandwidthLow - 1), | 325 UpdateNetworkMetrics(&states, rtc::Optional<int>(kDisablingBandwidthLow - 1), |
| 326 rtc::Optional<float>(1.0)); | 326 rtc::Optional<float>(1.0)); |
| 327 CheckDecision(&states, false, 1.0); | 327 CheckDecision(&states, false, 1.0); |
| 328 | 328 |
| 329 UpdateNetworkMetrics( | 329 UpdateNetworkMetrics( |
| 330 &states, rtc::Optional<int>(kEnablingBandwidthLow), | 330 &states, rtc::Optional<int>(kEnablingBandwidthLow), |
| 331 rtc::Optional<float>(kEnablingPacketLossAtHighBw * 0.99f)); | 331 rtc::Optional<float>(kEnablingPacketLossAtHighBw * 0.99f)); |
| 332 CheckDecision(&states, false, kEnablingPacketLossAtHighBw * 0.99f); | 332 CheckDecision(&states, false, kEnablingPacketLossAtHighBw * 0.99f); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 354 EXPECT_DEATH( | 354 EXPECT_DEATH( |
| 355 states.controller.reset(new FecControllerPlrBased( | 355 states.controller.reset(new FecControllerPlrBased( |
| 356 FecControllerPlrBased::Config( | 356 FecControllerPlrBased::Config( |
| 357 true, | 357 true, |
| 358 ThresholdCurve(kDisablingBandwidthLow - 1, | 358 ThresholdCurve(kDisablingBandwidthLow - 1, |
| 359 kEnablingPacketLossAtLowBw, kEnablingBandwidthHigh, | 359 kEnablingPacketLossAtLowBw, kEnablingBandwidthHigh, |
| 360 kEnablingPacketLossAtHighBw), | 360 kEnablingPacketLossAtHighBw), |
| 361 ThresholdCurve( | 361 ThresholdCurve( |
| 362 kDisablingBandwidthLow, kDisablingPacketLossAtLowBw, | 362 kDisablingBandwidthLow, kDisablingPacketLossAtLowBw, |
| 363 kDisablingBandwidthHigh, kDisablingPacketLossAtHighBw), | 363 kDisablingBandwidthHigh, kDisablingPacketLossAtHighBw), |
| 364 0, nullptr), | 364 0), |
| 365 std::move(mock_smoothing_filter))), | 365 std::move(mock_smoothing_filter))), |
| 366 "Check failed"); | 366 "Check failed"); |
| 367 } | 367 } |
| 368 #endif | 368 #endif |
| 369 | 369 |
| 370 } // namespace webrtc | 370 } // namespace webrtc |
| OLD | NEW |