OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 std::unique_ptr<FecControllerRplrBased> CreateFecControllerRplrBased( | 62 std::unique_ptr<FecControllerRplrBased> CreateFecControllerRplrBased( |
63 bool initial_fec_enabled) { | 63 bool initial_fec_enabled) { |
64 using Threshold = FecControllerRplrBased::Config::Threshold; | 64 using Threshold = FecControllerRplrBased::Config::Threshold; |
65 return std::unique_ptr<FecControllerRplrBased>( | 65 return std::unique_ptr<FecControllerRplrBased>( |
66 new FecControllerRplrBased(FecControllerRplrBased::Config( | 66 new FecControllerRplrBased(FecControllerRplrBased::Config( |
67 initial_fec_enabled, | 67 initial_fec_enabled, |
68 Threshold( | 68 Threshold( |
69 kEnablingBandwidthLow, kEnablingRecoverablePacketLossAtLowBw, | 69 kEnablingBandwidthLow, kEnablingRecoverablePacketLossAtLowBw, |
70 kEnablingBandwidthHigh, kEnablingRecoverablePacketLossAtHighBw), | 70 kEnablingBandwidthHigh, kEnablingRecoverablePacketLossAtHighBw), |
71 Threshold( | 71 Threshold(kDisablingBandwidthLow, |
72 kDisablingBandwidthLow, kDisablingRecoverablePacketLossAtLowBw, | 72 kDisablingRecoverablePacketLossAtLowBw, |
73 kDisablingBandwidthHigh, kDisablingRecoverablePacketLossAtHighBw), | 73 kDisablingBandwidthHigh, |
74 0, nullptr))); | 74 kDisablingRecoverablePacketLossAtHighBw)))); |
75 } | 75 } |
76 | 76 |
77 void UpdateNetworkMetrics( | 77 void UpdateNetworkMetrics( |
78 FecControllerRplrBased* controller, | 78 FecControllerRplrBased* controller, |
79 const rtc::Optional<int>& uplink_bandwidth_bps, | 79 const rtc::Optional<int>& uplink_bandwidth_bps, |
80 const rtc::Optional<float>& uplink_packet_loss, | 80 const rtc::Optional<float>& uplink_packet_loss, |
81 const rtc::Optional<float>& uplink_recoveralbe_packet_loss) { | 81 const rtc::Optional<float>& uplink_recoveralbe_packet_loss) { |
82 // UpdateNetworkMetrics can accept multiple network metric updates at once. | 82 // UpdateNetworkMetrics can accept multiple network metric updates at once. |
83 // However, currently, the most used case is to update one metric at a time. | 83 // However, currently, the most used case is to update one metric at a time. |
84 // To reflect this fact, we separate the calls. | 84 // To reflect this fact, we separate the calls. |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 constexpr int kEnablingBandwidthHigh = kEnablingBandwidthLow; | 365 constexpr int kEnablingBandwidthHigh = kEnablingBandwidthLow; |
366 constexpr float kDisablingRecoverablePacketLossAtLowBw = | 366 constexpr float kDisablingRecoverablePacketLossAtLowBw = |
367 kDisablingRecoverablePacketLossAtHighBw; | 367 kDisablingRecoverablePacketLossAtHighBw; |
368 using Threshold = FecControllerRplrBased::Config::Threshold; | 368 using Threshold = FecControllerRplrBased::Config::Threshold; |
369 FecControllerRplrBased controller(FecControllerRplrBased::Config( | 369 FecControllerRplrBased controller(FecControllerRplrBased::Config( |
370 true, | 370 true, |
371 Threshold(kEnablingBandwidthLow, kEnablingRecoverablePacketLossAtLowBw, | 371 Threshold(kEnablingBandwidthLow, kEnablingRecoverablePacketLossAtLowBw, |
372 kEnablingBandwidthHigh, kEnablingRecoverablePacketLossAtHighBw), | 372 kEnablingBandwidthHigh, kEnablingRecoverablePacketLossAtHighBw), |
373 Threshold(kDisablingBandwidthLow, kDisablingRecoverablePacketLossAtLowBw, | 373 Threshold(kDisablingBandwidthLow, kDisablingRecoverablePacketLossAtLowBw, |
374 kDisablingBandwidthHigh, | 374 kDisablingBandwidthHigh, |
375 kDisablingRecoverablePacketLossAtHighBw), | 375 kDisablingRecoverablePacketLossAtHighBw))); |
376 0, nullptr)); | |
377 | 376 |
378 UpdateNetworkMetrics(&controller, | 377 UpdateNetworkMetrics(&controller, |
379 rtc::Optional<int>(kDisablingBandwidthLow - 1), | 378 rtc::Optional<int>(kDisablingBandwidthLow - 1), |
380 rtc::Optional<float>(1.0)); | 379 rtc::Optional<float>(1.0)); |
381 CheckDecision(&controller, false, 1.0); | 380 CheckDecision(&controller, false, 1.0); |
382 | 381 |
383 UpdateNetworkMetrics( | 382 UpdateNetworkMetrics( |
384 &controller, rtc::Optional<int>(kEnablingBandwidthLow), | 383 &controller, rtc::Optional<int>(kEnablingBandwidthLow), |
385 rtc::Optional<float>(kEnablingRecoverablePacketLossAtHighBw * 0.99f)); | 384 rtc::Optional<float>(kEnablingRecoverablePacketLossAtHighBw * 0.99f)); |
386 CheckDecision(&controller, false, | 385 CheckDecision(&controller, false, |
(...skipping 18 matching lines...) Expand all Loading... |
405 | 404 |
406 #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) | 405 #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) |
407 TEST(FecControllerRplrBasedDeathTest, InvalidConfig) { | 406 TEST(FecControllerRplrBasedDeathTest, InvalidConfig) { |
408 using Threshold = FecControllerRplrBased::Config::Threshold; | 407 using Threshold = FecControllerRplrBased::Config::Threshold; |
409 EXPECT_DEATH( | 408 EXPECT_DEATH( |
410 FecControllerRplrBased controller(FecControllerRplrBased::Config( | 409 FecControllerRplrBased controller(FecControllerRplrBased::Config( |
411 true, | 410 true, |
412 Threshold( | 411 Threshold( |
413 kDisablingBandwidthLow - 1, kEnablingRecoverablePacketLossAtLowBw, | 412 kDisablingBandwidthLow - 1, kEnablingRecoverablePacketLossAtLowBw, |
414 kEnablingBandwidthHigh, kEnablingRecoverablePacketLossAtHighBw), | 413 kEnablingBandwidthHigh, kEnablingRecoverablePacketLossAtHighBw), |
415 Threshold( | 414 Threshold(kDisablingBandwidthLow, |
416 kDisablingBandwidthLow, kDisablingRecoverablePacketLossAtLowBw, | 415 kDisablingRecoverablePacketLossAtLowBw, |
417 kDisablingBandwidthHigh, kDisablingRecoverablePacketLossAtHighBw), | 416 kDisablingBandwidthHigh, |
418 0, nullptr)), | 417 kDisablingRecoverablePacketLossAtHighBw))), |
419 "Check failed"); | 418 "Check failed"); |
420 } | 419 } |
421 #endif | 420 #endif |
422 | 421 |
423 } // namespace webrtc | 422 } // namespace webrtc |
OLD | NEW |