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

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

Issue 2728553007: Use pacing info in ProbeBitrateEstimator to validate probe results. (Closed)
Patch Set: Rebase + comments. Created 3 years, 9 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 | « no previous file | webrtc/modules/congestion_controller/delay_based_bwe_unittest_helper.cc » ('j') | 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) 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 const PacedPacketInfo kPacingInfo0(0, 5, 2000); 22 constexpr int kNumProbes0 = 5;
terelius 2017/03/09 13:42:57 The names are unclear to me. How should I interpre
philipel 2017/03/09 14:13:44 Change to kNumProbesCluster0.
23 const PacedPacketInfo kPacingInfo1(1, 8, 4000); 23 constexpr int kNumProbes1 = 8;
24 constexpr int kNumProbes = 5; 24 const PacedPacketInfo kPacingInfo0(0, kNumProbes0, 2000);
25 const PacedPacketInfo kPacingInfo1(1, kNumProbes1, 4000);
25 } // namespace 26 } // namespace
26 27
27 TEST_F(DelayBasedBweTest, ProbeDetection) { 28 TEST_F(DelayBasedBweTest, ProbeDetection) {
28 int64_t now_ms = clock_.TimeInMilliseconds(); 29 int64_t now_ms = clock_.TimeInMilliseconds();
29 uint16_t seq_num = 0; 30 uint16_t seq_num = 0;
30 31
31 // First burst sent at 8 * 1000 / 10 = 800 kbps. 32 // First burst sent at 8 * 1000 / 10 = 800 kbps.
32 for (int i = 0; i < kNumProbes; ++i) { 33 for (int i = 0; i < kNumProbes0; ++i) {
33 clock_.AdvanceTimeMilliseconds(10); 34 clock_.AdvanceTimeMilliseconds(10);
34 now_ms = clock_.TimeInMilliseconds(); 35 now_ms = clock_.TimeInMilliseconds();
35 IncomingFeedback(now_ms, now_ms, seq_num++, 1000, kPacingInfo0); 36 IncomingFeedback(now_ms, now_ms, seq_num++, 1000, kPacingInfo0);
36 } 37 }
37 EXPECT_TRUE(bitrate_observer_.updated()); 38 EXPECT_TRUE(bitrate_observer_.updated());
38 39
39 // Second burst sent at 8 * 1000 / 5 = 1600 kbps. 40 // Second burst sent at 8 * 1000 / 5 = 1600 kbps.
40 for (int i = 0; i < kNumProbes; ++i) { 41 for (int i = 0; i < kNumProbes1; ++i) {
41 clock_.AdvanceTimeMilliseconds(5); 42 clock_.AdvanceTimeMilliseconds(5);
42 now_ms = clock_.TimeInMilliseconds(); 43 now_ms = clock_.TimeInMilliseconds();
43 IncomingFeedback(now_ms, now_ms, seq_num++, 1000, kPacingInfo1); 44 IncomingFeedback(now_ms, now_ms, seq_num++, 1000, kPacingInfo1);
44 } 45 }
45 46
46 EXPECT_TRUE(bitrate_observer_.updated()); 47 EXPECT_TRUE(bitrate_observer_.updated());
47 EXPECT_GT(bitrate_observer_.latest_bitrate(), 1500000u); 48 EXPECT_GT(bitrate_observer_.latest_bitrate(), 1500000u);
48 } 49 }
49 50
50 TEST_F(DelayBasedBweTest, ProbeDetectionNonPacedPackets) { 51 TEST_F(DelayBasedBweTest, ProbeDetectionNonPacedPackets) {
51 int64_t now_ms = clock_.TimeInMilliseconds(); 52 int64_t now_ms = clock_.TimeInMilliseconds();
52 uint16_t seq_num = 0; 53 uint16_t seq_num = 0;
53 // First burst sent at 8 * 1000 / 10 = 800 kbps, but with every other packet 54 // First burst sent at 8 * 1000 / 10 = 800 kbps, but with every other packet
54 // not being paced which could mess things up. 55 // not being paced which could mess things up.
55 for (int i = 0; i < kNumProbes; ++i) { 56 for (int i = 0; i < kNumProbes0; ++i) {
56 clock_.AdvanceTimeMilliseconds(5); 57 clock_.AdvanceTimeMilliseconds(5);
57 now_ms = clock_.TimeInMilliseconds(); 58 now_ms = clock_.TimeInMilliseconds();
58 IncomingFeedback(now_ms, now_ms, seq_num++, 1000, kPacingInfo0); 59 IncomingFeedback(now_ms, now_ms, seq_num++, 1000, kPacingInfo0);
59 // Non-paced packet, arriving 5 ms after. 60 // Non-paced packet, arriving 5 ms after.
60 clock_.AdvanceTimeMilliseconds(5); 61 clock_.AdvanceTimeMilliseconds(5);
61 IncomingFeedback(now_ms, now_ms, seq_num++, 100, PacedPacketInfo()); 62 IncomingFeedback(now_ms, now_ms, seq_num++, 100, PacedPacketInfo());
62 } 63 }
63 64
64 EXPECT_TRUE(bitrate_observer_.updated()); 65 EXPECT_TRUE(bitrate_observer_.updated());
65 EXPECT_GT(bitrate_observer_.latest_bitrate(), 800000u); 66 EXPECT_GT(bitrate_observer_.latest_bitrate(), 800000u);
66 } 67 }
67 68
68 TEST_F(DelayBasedBweTest, ProbeDetectionFasterArrival) { 69 TEST_F(DelayBasedBweTest, ProbeDetectionFasterArrival) {
69 int64_t now_ms = clock_.TimeInMilliseconds(); 70 int64_t now_ms = clock_.TimeInMilliseconds();
70 uint16_t seq_num = 0; 71 uint16_t seq_num = 0;
71 // First burst sent at 8 * 1000 / 10 = 800 kbps. 72 // First burst sent at 8 * 1000 / 10 = 800 kbps.
72 // Arriving at 8 * 1000 / 5 = 1600 kbps. 73 // Arriving at 8 * 1000 / 5 = 1600 kbps.
73 int64_t send_time_ms = 0; 74 int64_t send_time_ms = 0;
74 for (int i = 0; i < kNumProbes; ++i) { 75 for (int i = 0; i < kNumProbes0; ++i) {
75 clock_.AdvanceTimeMilliseconds(1); 76 clock_.AdvanceTimeMilliseconds(1);
76 send_time_ms += 10; 77 send_time_ms += 10;
77 now_ms = clock_.TimeInMilliseconds(); 78 now_ms = clock_.TimeInMilliseconds();
78 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, kPacingInfo0); 79 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, kPacingInfo0);
79 } 80 }
80 81
81 EXPECT_FALSE(bitrate_observer_.updated()); 82 EXPECT_FALSE(bitrate_observer_.updated());
82 } 83 }
83 84
84 TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrival) { 85 TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrival) {
85 int64_t now_ms = clock_.TimeInMilliseconds(); 86 int64_t now_ms = clock_.TimeInMilliseconds();
86 uint16_t seq_num = 0; 87 uint16_t seq_num = 0;
87 // First burst sent at 8 * 1000 / 5 = 1600 kbps. 88 // First burst sent at 8 * 1000 / 5 = 1600 kbps.
88 // Arriving at 8 * 1000 / 7 = 1142 kbps. 89 // Arriving at 8 * 1000 / 7 = 1142 kbps.
89 int64_t send_time_ms = 0; 90 int64_t send_time_ms = 0;
90 for (int i = 0; i < kNumProbes; ++i) { 91 for (int i = 0; i < kNumProbes1; ++i) {
91 clock_.AdvanceTimeMilliseconds(7); 92 clock_.AdvanceTimeMilliseconds(7);
92 send_time_ms += 5; 93 send_time_ms += 5;
93 now_ms = clock_.TimeInMilliseconds(); 94 now_ms = clock_.TimeInMilliseconds();
94 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, kPacingInfo1); 95 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, kPacingInfo1);
95 } 96 }
96 97
97 EXPECT_TRUE(bitrate_observer_.updated()); 98 EXPECT_TRUE(bitrate_observer_.updated());
98 EXPECT_NEAR(bitrate_observer_.latest_bitrate(), 1140000u, 10000u); 99 EXPECT_NEAR(bitrate_observer_.latest_bitrate(), 1140000u, 10000u);
99 } 100 }
100 101
101 TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrivalHighBitrate) { 102 TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrivalHighBitrate) {
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 // Burst sent at 8 * 1000 / 1 = 8000 kbps. 105 // Burst sent at 8 * 1000 / 1 = 8000 kbps.
105 // Arriving at 8 * 1000 / 2 = 4000 kbps. 106 // Arriving at 8 * 1000 / 2 = 4000 kbps.
106 int64_t send_time_ms = 0; 107 int64_t send_time_ms = 0;
107 for (int i = 0; i < kNumProbes; ++i) { 108 for (int i = 0; i < kNumProbes1; ++i) {
108 clock_.AdvanceTimeMilliseconds(2); 109 clock_.AdvanceTimeMilliseconds(2);
109 send_time_ms += 1; 110 send_time_ms += 1;
110 now_ms = clock_.TimeInMilliseconds(); 111 now_ms = clock_.TimeInMilliseconds();
111 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, kPacingInfo1); 112 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, kPacingInfo1);
112 } 113 }
113 114
114 EXPECT_TRUE(bitrate_observer_.updated()); 115 EXPECT_TRUE(bitrate_observer_.updated());
115 EXPECT_NEAR(bitrate_observer_.latest_bitrate(), 4000000u, 10000u); 116 EXPECT_NEAR(bitrate_observer_.latest_bitrate(), 4000000u, 10000u);
116 } 117 }
117 118
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 259
259 TEST_F(DelayBasedBweMedianSlopeExperimentTest, CapacityDropNegOffsetChange) { 260 TEST_F(DelayBasedBweMedianSlopeExperimentTest, CapacityDropNegOffsetChange) {
260 CapacityDropTestHelper(1, false, 1267, -30000); 261 CapacityDropTestHelper(1, false, 1267, -30000);
261 } 262 }
262 263
263 TEST_F(DelayBasedBweMedianSlopeExperimentTest, CapacityDropOneStreamWrap) { 264 TEST_F(DelayBasedBweMedianSlopeExperimentTest, CapacityDropOneStreamWrap) {
264 CapacityDropTestHelper(1, true, 600, 0); 265 CapacityDropTestHelper(1, true, 600, 0);
265 } 266 }
266 267
267 } // namespace webrtc 268 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/congestion_controller/delay_based_bwe_unittest_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698