Chromium Code Reviews| 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 26 matching lines...) Expand all Loading... | |
| 37 EXPECT_EQ(kRembBps, bitrate); | 37 EXPECT_EQ(kRembBps, bitrate); |
| 38 | 38 |
| 39 // Second REMB doesn't apply immediately. | 39 // Second REMB doesn't apply immediately. |
| 40 now_ms += 2001; | 40 now_ms += 2001; |
| 41 bwe.UpdateReceiverEstimate(now_ms, kSecondRembBps); | 41 bwe.UpdateReceiverEstimate(now_ms, kSecondRembBps); |
| 42 bwe.UpdateEstimate(now_ms); | 42 bwe.UpdateEstimate(now_ms); |
| 43 bitrate = 0; | 43 bitrate = 0; |
| 44 bwe.CurrentEstimate(&bitrate, &fraction_loss, &rtt); | 44 bwe.CurrentEstimate(&bitrate, &fraction_loss, &rtt); |
| 45 EXPECT_EQ(kRembBps, bitrate); | 45 EXPECT_EQ(kRembBps, bitrate); |
| 46 } | 46 } |
| 47 | |
| 48 TEST(SendSideBweTest, DoesntReapplyBitrateDecreaseWithoutFollowingRemb) { | |
| 49 SendSideBandwidthEstimation bwe; | |
| 50 static const int kMinBitrateBps = 100000; | |
| 51 static const int kInitialBitrateBps = 1000000; | |
| 52 bwe.SetMinMaxBitrate(kMinBitrateBps, 1500000); | |
| 53 bwe.SetSendBitrate(kInitialBitrateBps); | |
| 54 | |
| 55 static const uint8_t kFractionLoss = 128; | |
| 56 static const int64_t kRttMs = 50; | |
| 57 | |
| 58 int64_t now_ms = 0; | |
| 59 int bitrate_bps; | |
| 60 uint8_t fraction_loss; | |
| 61 int64_t rtt_ms; | |
| 62 bwe.CurrentEstimate(&bitrate_bps, &fraction_loss, &rtt_ms); | |
| 63 EXPECT_EQ(kInitialBitrateBps, bitrate_bps); | |
| 64 EXPECT_EQ(0, fraction_loss); | |
| 65 EXPECT_EQ(0, rtt_ms); | |
| 66 | |
| 67 // Signal heavy loss to go down in bitrate. | |
| 68 bwe.UpdateReceiverBlock(kFractionLoss, kRttMs, 100, now_ms); | |
| 69 // Trigger an update 2 seconds later to not be rate limited. | |
| 70 now_ms += 2000; | |
| 71 bwe.UpdateEstimate(now_ms); | |
| 72 | |
| 73 bwe.CurrentEstimate(&bitrate_bps, &fraction_loss, &rtt_ms); | |
| 74 EXPECT_LT(bitrate_bps, kInitialBitrateBps); | |
| 75 EXPECT_GT(bitrate_bps, kMinBitrateBps); | |
|
stefan-webrtc
2015/10/22 09:20:47
GE
pbos-webrtc
2015/10/22 13:16:06
GT or the next check doesn't verify anything (we c
stefan-webrtc
2015/10/22 13:38:04
I see, good point. Add a comment :)
pbos-webrtc
2015/10/22 13:49:19
Done.
| |
| 76 EXPECT_EQ(kFractionLoss, fraction_loss); | |
| 77 EXPECT_EQ(kRttMs, rtt_ms); | |
| 78 | |
| 79 // Triggering an update shouldn't apply further downgrade nor upgrade since | |
| 80 // there's no intermediate receiver block received indicating whether this is | |
| 81 // currently good or not. | |
| 82 int last_bitrate_bps = bitrate_bps; | |
| 83 // Trigger an update 2 seconds later to not be rate limited (but it still | |
| 84 // shouldn't update). | |
| 85 now_ms += 2000; | |
| 86 bwe.UpdateEstimate(now_ms); | |
| 87 bwe.CurrentEstimate(&bitrate_bps, &fraction_loss, &rtt_ms); | |
| 88 | |
| 89 EXPECT_EQ(last_bitrate_bps, bitrate_bps); | |
| 90 // The old loss rate should still be applied though. | |
| 91 EXPECT_EQ(kFractionLoss, fraction_loss); | |
| 92 EXPECT_EQ(kRttMs, rtt_ms); | |
| 93 | |
| 94 } | |
| 95 | |
| 47 } // namespace webrtc | 96 } // namespace webrtc |
| OLD | NEW |