| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } | 60 } |
| 61 | 61 |
| 62 TEST(SendSideBweTest, InitialDelayBasedBweWithProbing) { | 62 TEST(SendSideBweTest, InitialDelayBasedBweWithProbing) { |
| 63 TestProbing(true); | 63 TestProbing(true); |
| 64 } | 64 } |
| 65 | 65 |
| 66 TEST(SendSideBweTest, DoesntReapplyBitrateDecreaseWithoutFollowingRemb) { | 66 TEST(SendSideBweTest, DoesntReapplyBitrateDecreaseWithoutFollowingRemb) { |
| 67 MockRtcEventLog event_log; | 67 MockRtcEventLog event_log; |
| 68 EXPECT_CALL(event_log, | 68 EXPECT_CALL(event_log, |
| 69 LogBwePacketLossEvent(testing::Gt(0), testing::Gt(0), 0)) | 69 LogBwePacketLossEvent(testing::Gt(0), testing::Gt(0), 0)) |
| 70 .Times(3); | 70 .Times(2); |
| 71 SendSideBandwidthEstimation bwe(&event_log); | 71 SendSideBandwidthEstimation bwe(&event_log); |
| 72 static const int kMinBitrateBps = 100000; | 72 static const int kMinBitrateBps = 100000; |
| 73 static const int kInitialBitrateBps = 1000000; | 73 static const int kInitialBitrateBps = 1000000; |
| 74 bwe.SetMinMaxBitrate(kMinBitrateBps, 1500000); | 74 bwe.SetMinMaxBitrate(kMinBitrateBps, 1500000); |
| 75 bwe.SetSendBitrate(kInitialBitrateBps); | 75 bwe.SetSendBitrate(kInitialBitrateBps); |
| 76 | 76 |
| 77 static const uint8_t kFractionLoss = 128; | 77 static const uint8_t kFractionLoss = 128; |
| 78 static const int64_t kRttMs = 50; | 78 static const int64_t kRttMs = 50; |
| 79 | 79 |
| 80 int64_t now_ms = 0; | 80 int64_t now_ms = 0; |
| 81 int bitrate_bps; | 81 int bitrate_bps; |
| 82 uint8_t fraction_loss; | 82 uint8_t fraction_loss; |
| 83 int64_t rtt_ms; | 83 int64_t rtt_ms; |
| 84 bwe.CurrentEstimate(&bitrate_bps, &fraction_loss, &rtt_ms); | 84 bwe.CurrentEstimate(&bitrate_bps, &fraction_loss, &rtt_ms); |
| 85 EXPECT_EQ(kInitialBitrateBps, bitrate_bps); | 85 EXPECT_EQ(kInitialBitrateBps, bitrate_bps); |
| 86 EXPECT_EQ(0, fraction_loss); | 86 EXPECT_EQ(0, fraction_loss); |
| 87 EXPECT_EQ(0, rtt_ms); | 87 EXPECT_EQ(0, rtt_ms); |
| 88 | 88 |
| 89 // Signal heavy loss to go down in bitrate. | 89 // Signal heavy loss to go down in bitrate. |
| 90 bwe.UpdateReceiverBlock(kFractionLoss, kRttMs, 100, now_ms); | 90 bwe.UpdateReceiverBlock(kFractionLoss, kRttMs, 100, now_ms); |
| 91 // Trigger an update 2 seconds later to not be rate limited. | 91 // Trigger an update 2 seconds later to not be rate limited. |
| 92 now_ms += 2000; | 92 now_ms += 1000; |
| 93 bwe.UpdateEstimate(now_ms); | 93 bwe.UpdateEstimate(now_ms); |
| 94 | 94 |
| 95 bwe.CurrentEstimate(&bitrate_bps, &fraction_loss, &rtt_ms); | 95 bwe.CurrentEstimate(&bitrate_bps, &fraction_loss, &rtt_ms); |
| 96 EXPECT_LT(bitrate_bps, kInitialBitrateBps); | 96 EXPECT_LT(bitrate_bps, kInitialBitrateBps); |
| 97 // Verify that the obtained bitrate isn't hitting the min bitrate, or this | 97 // Verify that the obtained bitrate isn't hitting the min bitrate, or this |
| 98 // test doesn't make sense. If this ever happens, update the thresholds or | 98 // test doesn't make sense. If this ever happens, update the thresholds or |
| 99 // loss rates so that it doesn't hit min bitrate after one bitrate update. | 99 // loss rates so that it doesn't hit min bitrate after one bitrate update. |
| 100 EXPECT_GT(bitrate_bps, kMinBitrateBps); | 100 EXPECT_GT(bitrate_bps, kMinBitrateBps); |
| 101 EXPECT_EQ(kFractionLoss, fraction_loss); | 101 EXPECT_EQ(kFractionLoss, fraction_loss); |
| 102 EXPECT_EQ(kRttMs, rtt_ms); | 102 EXPECT_EQ(kRttMs, rtt_ms); |
| 103 | 103 |
| 104 // Triggering an update shouldn't apply further downgrade nor upgrade since | 104 // Triggering an update shouldn't apply further downgrade nor upgrade since |
| 105 // there's no intermediate receiver block received indicating whether this is | 105 // there's no intermediate receiver block received indicating whether this is |
| 106 // currently good or not. | 106 // currently good or not. |
| 107 int last_bitrate_bps = bitrate_bps; | 107 int last_bitrate_bps = bitrate_bps; |
| 108 // Trigger an update 2 seconds later to not be rate limited (but it still | 108 // Trigger an update 2 seconds later to not be rate limited (but it still |
| 109 // shouldn't update). | 109 // shouldn't update). |
| 110 now_ms += 2000; | 110 now_ms += 1000; |
| 111 bwe.UpdateEstimate(now_ms); | 111 bwe.UpdateEstimate(now_ms); |
| 112 bwe.CurrentEstimate(&bitrate_bps, &fraction_loss, &rtt_ms); | 112 bwe.CurrentEstimate(&bitrate_bps, &fraction_loss, &rtt_ms); |
| 113 | 113 |
| 114 EXPECT_EQ(last_bitrate_bps, bitrate_bps); | 114 EXPECT_EQ(last_bitrate_bps, bitrate_bps); |
| 115 // The old loss rate should still be applied though. | 115 // The old loss rate should still be applied though. |
| 116 EXPECT_EQ(kFractionLoss, fraction_loss); | 116 EXPECT_EQ(kFractionLoss, fraction_loss); |
| 117 EXPECT_EQ(kRttMs, rtt_ms); | 117 EXPECT_EQ(kRttMs, rtt_ms); |
| 118 } | 118 } |
| 119 | 119 |
| 120 } // namespace webrtc | 120 } // namespace webrtc |
| OLD | NEW |