Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: webrtc/modules/bitrate_controller/send_side_bandwidth_estimation_unittest.cc

Issue 1417723005: Prevent BWE rampdowns without new loss reports. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: comments Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Verify that the obtained bitrate isn't hitting the min bitrate, or this
76 // test doesn't make sense. If this ever happens, update the thresholds or
77 // loss rates so that it doesn't hit min bitrate after one bitrate update.
78 EXPECT_GT(bitrate_bps, kMinBitrateBps);
79 EXPECT_EQ(kFractionLoss, fraction_loss);
80 EXPECT_EQ(kRttMs, rtt_ms);
81
82 // Triggering an update shouldn't apply further downgrade nor upgrade since
83 // there's no intermediate receiver block received indicating whether this is
84 // currently good or not.
85 int last_bitrate_bps = bitrate_bps;
86 // Trigger an update 2 seconds later to not be rate limited (but it still
87 // shouldn't update).
88 now_ms += 2000;
89 bwe.UpdateEstimate(now_ms);
90 bwe.CurrentEstimate(&bitrate_bps, &fraction_loss, &rtt_ms);
91
92 EXPECT_EQ(last_bitrate_bps, bitrate_bps);
93 // The old loss rate should still be applied though.
94 EXPECT_EQ(kFractionLoss, fraction_loss);
95 EXPECT_EQ(kRttMs, rtt_ms);
96 }
97
47 } // namespace webrtc 98 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698