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

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

Issue 2708873003: Propagate packet pacing information to SendTimeHistory. (Closed)
Patch Set: TransportFeedbackAdapterTest fix. Created 3 years, 10 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 22 const PacedPacketInfo kPacingInfo0(0, 5, 2000);
23 const PacedPacketInfo kPacingInfo1(1, 8, 4000);
23 constexpr int kNumProbes = 5; 24 constexpr int kNumProbes = 5;
24 } // namespace 25 } // namespace
25 26
26 TEST_F(DelayBasedBweTest, ProbeDetection) { 27 TEST_F(DelayBasedBweTest, ProbeDetection) {
27 int64_t now_ms = clock_.TimeInMilliseconds(); 28 int64_t now_ms = clock_.TimeInMilliseconds();
28 uint16_t seq_num = 0; 29 uint16_t seq_num = 0;
29 30
30 // First burst sent at 8 * 1000 / 10 = 800 kbps. 31 // First burst sent at 8 * 1000 / 10 = 800 kbps.
31 for (int i = 0; i < kNumProbes; ++i) { 32 for (int i = 0; i < kNumProbes; ++i) {
32 clock_.AdvanceTimeMilliseconds(10); 33 clock_.AdvanceTimeMilliseconds(10);
33 now_ms = clock_.TimeInMilliseconds(); 34 now_ms = clock_.TimeInMilliseconds();
34 IncomingFeedback(now_ms, now_ms, seq_num++, 1000, 0); 35 IncomingFeedback(now_ms, now_ms, seq_num++, 1000, kPacingInfo0);
35 } 36 }
36 EXPECT_TRUE(bitrate_observer_.updated()); 37 EXPECT_TRUE(bitrate_observer_.updated());
37 38
38 // Second burst sent at 8 * 1000 / 5 = 1600 kbps. 39 // Second burst sent at 8 * 1000 / 5 = 1600 kbps.
39 for (int i = 0; i < kNumProbes; ++i) { 40 for (int i = 0; i < kNumProbes; ++i) {
40 clock_.AdvanceTimeMilliseconds(5); 41 clock_.AdvanceTimeMilliseconds(5);
41 now_ms = clock_.TimeInMilliseconds(); 42 now_ms = clock_.TimeInMilliseconds();
42 IncomingFeedback(now_ms, now_ms, seq_num++, 1000, 1); 43 IncomingFeedback(now_ms, now_ms, seq_num++, 1000, kPacingInfo1);
43 } 44 }
44 45
45 EXPECT_TRUE(bitrate_observer_.updated()); 46 EXPECT_TRUE(bitrate_observer_.updated());
46 EXPECT_GT(bitrate_observer_.latest_bitrate(), 1500000u); 47 EXPECT_GT(bitrate_observer_.latest_bitrate(), 1500000u);
47 } 48 }
48 49
49 TEST_F(DelayBasedBweTest, ProbeDetectionNonPacedPackets) { 50 TEST_F(DelayBasedBweTest, ProbeDetectionNonPacedPackets) {
50 int64_t now_ms = clock_.TimeInMilliseconds(); 51 int64_t now_ms = clock_.TimeInMilliseconds();
51 uint16_t seq_num = 0; 52 uint16_t seq_num = 0;
52 // First burst sent at 8 * 1000 / 10 = 800 kbps, but with every other packet 53 // First burst sent at 8 * 1000 / 10 = 800 kbps, but with every other packet
53 // not being paced which could mess things up. 54 // not being paced which could mess things up.
54 for (int i = 0; i < kNumProbes; ++i) { 55 for (int i = 0; i < kNumProbes; ++i) {
55 clock_.AdvanceTimeMilliseconds(5); 56 clock_.AdvanceTimeMilliseconds(5);
56 now_ms = clock_.TimeInMilliseconds(); 57 now_ms = clock_.TimeInMilliseconds();
57 IncomingFeedback(now_ms, now_ms, seq_num++, 1000, 0); 58 IncomingFeedback(now_ms, now_ms, seq_num++, 1000, kPacingInfo0);
58 // Non-paced packet, arriving 5 ms after. 59 // Non-paced packet, arriving 5 ms after.
59 clock_.AdvanceTimeMilliseconds(5); 60 clock_.AdvanceTimeMilliseconds(5);
60 IncomingFeedback(now_ms, now_ms, seq_num++, 100, 61 IncomingFeedback(now_ms, now_ms, seq_num++, 100, PacedPacketInfo());
61 PacedPacketInfo::kNotAProbe);
62 } 62 }
63 63
64 EXPECT_TRUE(bitrate_observer_.updated()); 64 EXPECT_TRUE(bitrate_observer_.updated());
65 EXPECT_GT(bitrate_observer_.latest_bitrate(), 800000u); 65 EXPECT_GT(bitrate_observer_.latest_bitrate(), 800000u);
66 } 66 }
67 67
68 TEST_F(DelayBasedBweTest, ProbeDetectionFasterArrival) { 68 TEST_F(DelayBasedBweTest, ProbeDetectionFasterArrival) {
69 int64_t now_ms = clock_.TimeInMilliseconds(); 69 int64_t now_ms = clock_.TimeInMilliseconds();
70 uint16_t seq_num = 0; 70 uint16_t seq_num = 0;
71 // First burst sent at 8 * 1000 / 10 = 800 kbps. 71 // First burst sent at 8 * 1000 / 10 = 800 kbps.
72 // Arriving at 8 * 1000 / 5 = 1600 kbps. 72 // Arriving at 8 * 1000 / 5 = 1600 kbps.
73 int64_t send_time_ms = 0; 73 int64_t send_time_ms = 0;
74 for (int i = 0; i < kNumProbes; ++i) { 74 for (int i = 0; i < kNumProbes; ++i) {
75 clock_.AdvanceTimeMilliseconds(1); 75 clock_.AdvanceTimeMilliseconds(1);
76 send_time_ms += 10; 76 send_time_ms += 10;
77 now_ms = clock_.TimeInMilliseconds(); 77 now_ms = clock_.TimeInMilliseconds();
78 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, 0); 78 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, kPacingInfo0);
79 } 79 }
80 80
81 EXPECT_FALSE(bitrate_observer_.updated()); 81 EXPECT_FALSE(bitrate_observer_.updated());
82 } 82 }
83 83
84 TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrival) { 84 TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrival) {
85 int64_t now_ms = clock_.TimeInMilliseconds(); 85 int64_t now_ms = clock_.TimeInMilliseconds();
86 uint16_t seq_num = 0; 86 uint16_t seq_num = 0;
87 // First burst sent at 8 * 1000 / 5 = 1600 kbps. 87 // First burst sent at 8 * 1000 / 5 = 1600 kbps.
88 // Arriving at 8 * 1000 / 7 = 1142 kbps. 88 // Arriving at 8 * 1000 / 7 = 1142 kbps.
89 int64_t send_time_ms = 0; 89 int64_t send_time_ms = 0;
90 for (int i = 0; i < kNumProbes; ++i) { 90 for (int i = 0; i < kNumProbes; ++i) {
91 clock_.AdvanceTimeMilliseconds(7); 91 clock_.AdvanceTimeMilliseconds(7);
92 send_time_ms += 5; 92 send_time_ms += 5;
93 now_ms = clock_.TimeInMilliseconds(); 93 now_ms = clock_.TimeInMilliseconds();
94 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, 1); 94 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, kPacingInfo1);
95 } 95 }
96 96
97 EXPECT_TRUE(bitrate_observer_.updated()); 97 EXPECT_TRUE(bitrate_observer_.updated());
98 EXPECT_NEAR(bitrate_observer_.latest_bitrate(), 1140000u, 10000u); 98 EXPECT_NEAR(bitrate_observer_.latest_bitrate(), 1140000u, 10000u);
99 } 99 }
100 100
101 TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrivalHighBitrate) { 101 TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrivalHighBitrate) {
102 int64_t now_ms = clock_.TimeInMilliseconds(); 102 int64_t now_ms = clock_.TimeInMilliseconds();
103 uint16_t seq_num = 0; 103 uint16_t seq_num = 0;
104 // Burst sent at 8 * 1000 / 1 = 8000 kbps. 104 // Burst sent at 8 * 1000 / 1 = 8000 kbps.
105 // Arriving at 8 * 1000 / 2 = 4000 kbps. 105 // Arriving at 8 * 1000 / 2 = 4000 kbps.
106 int64_t send_time_ms = 0; 106 int64_t send_time_ms = 0;
107 for (int i = 0; i < kNumProbes; ++i) { 107 for (int i = 0; i < kNumProbes; ++i) {
108 clock_.AdvanceTimeMilliseconds(2); 108 clock_.AdvanceTimeMilliseconds(2);
109 send_time_ms += 1; 109 send_time_ms += 1;
110 now_ms = clock_.TimeInMilliseconds(); 110 now_ms = clock_.TimeInMilliseconds();
111 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, 1); 111 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, kPacingInfo1);
112 } 112 }
113 113
114 EXPECT_TRUE(bitrate_observer_.updated()); 114 EXPECT_TRUE(bitrate_observer_.updated());
115 EXPECT_NEAR(bitrate_observer_.latest_bitrate(), 4000000u, 10000u); 115 EXPECT_NEAR(bitrate_observer_.latest_bitrate(), 4000000u, 10000u);
116 } 116 }
117 117
118 TEST_F(DelayBasedBweTest, GetProbingInterval) { 118 TEST_F(DelayBasedBweTest, GetProbingInterval) {
119 int64_t default_interval_ms = bitrate_estimator_->GetProbingIntervalMs(); 119 int64_t default_interval_ms = bitrate_estimator_->GetProbingIntervalMs();
120 EXPECT_GT(default_interval_ms, 0); 120 EXPECT_GT(default_interval_ms, 0);
121 CapacityDropTestHelper(1, true, 567, 0); 121 CapacityDropTestHelper(1, true, 567, 0);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 258
259 TEST_F(DelayBasedBweMedianSlopeExperimentTest, CapacityDropNegOffsetChange) { 259 TEST_F(DelayBasedBweMedianSlopeExperimentTest, CapacityDropNegOffsetChange) {
260 CapacityDropTestHelper(1, false, 1267, -30000); 260 CapacityDropTestHelper(1, false, 1267, -30000);
261 } 261 }
262 262
263 TEST_F(DelayBasedBweMedianSlopeExperimentTest, CapacityDropOneStreamWrap) { 263 TEST_F(DelayBasedBweMedianSlopeExperimentTest, CapacityDropOneStreamWrap) {
264 CapacityDropTestHelper(1, true, 600, 0); 264 CapacityDropTestHelper(1, true, 600, 0);
265 } 265 }
266 266
267 } // namespace webrtc 267 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698