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

Side by Side Diff: webrtc/modules/congestion_controller/delay_based_bwe_unittest.cc

Issue 2949203002: Only use 95% of the link capacity if the true link capacity is found by probing. (Closed)
Patch Set: Nit Created 3 years, 6 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
OLDNEW
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
11 #include "webrtc/test/gtest.h" 11 #include "webrtc/test/gtest.h"
12 #include "webrtc/base/constructormagic.h" 12 #include "webrtc/base/constructormagic.h"
13 #include "webrtc/modules/pacing/paced_sender.h" 13 #include "webrtc/modules/pacing/paced_sender.h"
14 #include "webrtc/modules/congestion_controller/delay_based_bwe.h" 14 #include "webrtc/modules/congestion_controller/delay_based_bwe.h"
15 #include "webrtc/modules/congestion_controller/delay_based_bwe_unittest_helper.h " 15 #include "webrtc/modules/congestion_controller/delay_based_bwe_unittest_helper.h "
16 #include "webrtc/system_wrappers/include/clock.h" 16 #include "webrtc/system_wrappers/include/clock.h"
17 #include "webrtc/test/field_trial.h" 17 #include "webrtc/test/field_trial.h"
18 18
19 namespace webrtc { 19 namespace webrtc {
20 20
21 namespace { 21 namespace {
22 constexpr int kNumProbesCluster0 = 5; 22 constexpr int kNumProbesCluster0 = 5;
23 constexpr int kNumProbesCluster1 = 8; 23 constexpr int kNumProbesCluster1 = 8;
24 const PacedPacketInfo kPacingInfo0(0, kNumProbesCluster0, 2000); 24 const PacedPacketInfo kPacingInfo0(0, kNumProbesCluster0, 2000);
25 const PacedPacketInfo kPacingInfo1(1, kNumProbesCluster1, 4000); 25 const PacedPacketInfo kPacingInfo1(1, kNumProbesCluster1, 4000);
26 constexpr float kTargetUtilizationFraction = 0.95f;
26 } // namespace 27 } // namespace
27 28
28 TEST_F(DelayBasedBweTest, NoCrashEmptyFeedback) { 29 TEST_F(DelayBasedBweTest, NoCrashEmptyFeedback) {
29 std::vector<PacketFeedback> packet_feedback_vector; 30 std::vector<PacketFeedback> packet_feedback_vector;
30 bitrate_estimator_->IncomingPacketFeedbackVector(packet_feedback_vector, 31 bitrate_estimator_->IncomingPacketFeedbackVector(packet_feedback_vector,
31 rtc::Optional<uint32_t>()); 32 rtc::Optional<uint32_t>());
32 } 33 }
33 34
34 TEST_F(DelayBasedBweTest, NoCrashOnlyLostFeedback) { 35 TEST_F(DelayBasedBweTest, NoCrashOnlyLostFeedback) {
35 std::vector<PacketFeedback> packet_feedback_vector; 36 std::vector<PacketFeedback> packet_feedback_vector;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 97 }
97 98
98 EXPECT_FALSE(bitrate_observer_.updated()); 99 EXPECT_FALSE(bitrate_observer_.updated());
99 } 100 }
100 101
101 TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrival) { 102 TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrival) {
102 int64_t now_ms = clock_.TimeInMilliseconds(); 103 int64_t now_ms = clock_.TimeInMilliseconds();
103 uint16_t seq_num = 0; 104 uint16_t seq_num = 0;
104 // First burst sent at 8 * 1000 / 5 = 1600 kbps. 105 // First burst sent at 8 * 1000 / 5 = 1600 kbps.
105 // Arriving at 8 * 1000 / 7 = 1142 kbps. 106 // Arriving at 8 * 1000 / 7 = 1142 kbps.
107 // Since the receive rate is significantly below the send rate, we expect to
108 // use 95% of the estimated capacity.
106 int64_t send_time_ms = 0; 109 int64_t send_time_ms = 0;
107 for (int i = 0; i < kNumProbesCluster1; ++i) { 110 for (int i = 0; i < kNumProbesCluster1; ++i) {
108 clock_.AdvanceTimeMilliseconds(7); 111 clock_.AdvanceTimeMilliseconds(7);
109 send_time_ms += 5; 112 send_time_ms += 5;
110 now_ms = clock_.TimeInMilliseconds(); 113 now_ms = clock_.TimeInMilliseconds();
111 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, kPacingInfo1); 114 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, kPacingInfo1);
112 } 115 }
113 116
114 EXPECT_TRUE(bitrate_observer_.updated()); 117 EXPECT_TRUE(bitrate_observer_.updated());
115 EXPECT_NEAR(bitrate_observer_.latest_bitrate(), 1140000u, 10000u); 118 EXPECT_NEAR(bitrate_observer_.latest_bitrate(),
119 kTargetUtilizationFraction * 1140000u, 10000u);
116 } 120 }
117 121
118 TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrivalHighBitrate) { 122 TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrivalHighBitrate) {
119 int64_t now_ms = clock_.TimeInMilliseconds(); 123 int64_t now_ms = clock_.TimeInMilliseconds();
120 uint16_t seq_num = 0; 124 uint16_t seq_num = 0;
121 // Burst sent at 8 * 1000 / 1 = 8000 kbps. 125 // Burst sent at 8 * 1000 / 1 = 8000 kbps.
122 // Arriving at 8 * 1000 / 2 = 4000 kbps. 126 // Arriving at 8 * 1000 / 2 = 4000 kbps.
127 // Since the receive rate is significantly below the send rate, we expect to
128 // use 95% of the estimated capacity.
123 int64_t send_time_ms = 0; 129 int64_t send_time_ms = 0;
124 for (int i = 0; i < kNumProbesCluster1; ++i) { 130 for (int i = 0; i < kNumProbesCluster1; ++i) {
125 clock_.AdvanceTimeMilliseconds(2); 131 clock_.AdvanceTimeMilliseconds(2);
126 send_time_ms += 1; 132 send_time_ms += 1;
127 now_ms = clock_.TimeInMilliseconds(); 133 now_ms = clock_.TimeInMilliseconds();
128 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, kPacingInfo1); 134 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, kPacingInfo1);
129 } 135 }
130 136
131 EXPECT_TRUE(bitrate_observer_.updated()); 137 EXPECT_TRUE(bitrate_observer_.updated());
132 EXPECT_NEAR(bitrate_observer_.latest_bitrate(), 4000000u, 10000u); 138 EXPECT_NEAR(bitrate_observer_.latest_bitrate(),
139 kTargetUtilizationFraction * 4000000u, 10000u);
133 } 140 }
134 141
135 TEST_F(DelayBasedBweTest, GetExpectedBwePeriodMs) { 142 TEST_F(DelayBasedBweTest, GetExpectedBwePeriodMs) {
136 int64_t default_interval_ms = bitrate_estimator_->GetExpectedBwePeriodMs(); 143 int64_t default_interval_ms = bitrate_estimator_->GetExpectedBwePeriodMs();
137 EXPECT_GT(default_interval_ms, 0); 144 EXPECT_GT(default_interval_ms, 0);
138 CapacityDropTestHelper(1, true, 333, 0); 145 CapacityDropTestHelper(1, true, 333, 0);
139 int64_t interval_ms = bitrate_estimator_->GetExpectedBwePeriodMs(); 146 int64_t interval_ms = bitrate_estimator_->GetExpectedBwePeriodMs();
140 EXPECT_GT(interval_ms, 0); 147 EXPECT_GT(interval_ms, 0);
141 EXPECT_NE(interval_ms, default_interval_ms); 148 EXPECT_NE(interval_ms, default_interval_ms);
142 } 149 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 188
182 TEST_F(DelayBasedBweTest, TestLongTimeoutAndWrap) { 189 TEST_F(DelayBasedBweTest, TestLongTimeoutAndWrap) {
183 // Simulate a client leaving and rejoining the call after some multiple of 190 // Simulate a client leaving and rejoining the call after some multiple of
184 // 64 seconds later. This will cause a zero difference in abs send times due 191 // 64 seconds later. This will cause a zero difference in abs send times due
185 // to the wrap, but a big difference in arrival time, if streams aren't 192 // to the wrap, but a big difference in arrival time, if streams aren't
186 // properly timed out. 193 // properly timed out.
187 TestWrappingHelper(10 * 64); 194 TestWrappingHelper(10 * 64);
188 } 195 }
189 196
190 } // namespace webrtc 197 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698