OLD | NEW |
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 | 18 |
18 namespace webrtc { | 19 namespace webrtc { |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 constexpr int kNumProbes = 5; | 23 constexpr int kNumProbes = 5; |
23 } // namespace | 24 } // namespace |
24 | 25 |
25 TEST_F(DelayBasedBweTest, ProbeDetection) { | 26 TEST_F(DelayBasedBweTest, ProbeDetection) { |
26 int64_t now_ms = clock_.TimeInMilliseconds(); | 27 int64_t now_ms = clock_.TimeInMilliseconds(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 137 } |
137 | 138 |
138 TEST_F(DelayBasedBweTest, CapacityDropNegOffsetChange) { | 139 TEST_F(DelayBasedBweTest, CapacityDropNegOffsetChange) { |
139 CapacityDropTestHelper(1, false, 733, -30000); | 140 CapacityDropTestHelper(1, false, 733, -30000); |
140 } | 141 } |
141 | 142 |
142 TEST_F(DelayBasedBweTest, CapacityDropOneStreamWrap) { | 143 TEST_F(DelayBasedBweTest, CapacityDropOneStreamWrap) { |
143 CapacityDropTestHelper(1, true, 633, 0); | 144 CapacityDropTestHelper(1, true, 633, 0); |
144 } | 145 } |
145 | 146 |
146 TEST_F(DelayBasedBweTest, CapacityDropTwoStreamsWrap) { | |
147 CapacityDropTestHelper(2, true, 767, 0); | |
148 } | |
149 | |
150 TEST_F(DelayBasedBweTest, CapacityDropThreeStreamsWrap) { | |
151 CapacityDropTestHelper(3, true, 633, 0); | |
152 } | |
153 | |
154 TEST_F(DelayBasedBweTest, CapacityDropThirteenStreamsWrap) { | |
155 CapacityDropTestHelper(13, true, 733, 0); | |
156 } | |
157 | |
158 TEST_F(DelayBasedBweTest, CapacityDropNineteenStreamsWrap) { | |
159 CapacityDropTestHelper(19, true, 667, 0); | |
160 } | |
161 | |
162 TEST_F(DelayBasedBweTest, CapacityDropThirtyStreamsWrap) { | |
163 CapacityDropTestHelper(30, true, 667, 0); | |
164 } | |
165 | |
166 TEST_F(DelayBasedBweTest, TestTimestampGrouping) { | 147 TEST_F(DelayBasedBweTest, TestTimestampGrouping) { |
167 TestTimestampGroupingTestHelper(); | 148 TestTimestampGroupingTestHelper(); |
168 } | 149 } |
169 | 150 |
170 TEST_F(DelayBasedBweTest, TestShortTimeoutAndWrap) { | 151 TEST_F(DelayBasedBweTest, TestShortTimeoutAndWrap) { |
171 // Simulate a client leaving and rejoining the call after 35 seconds. This | 152 // Simulate a client leaving and rejoining the call after 35 seconds. This |
172 // will make abs send time wrap, so if streams aren't timed out properly | 153 // will make abs send time wrap, so if streams aren't timed out properly |
173 // the next 30 seconds of packets will be out of order. | 154 // the next 30 seconds of packets will be out of order. |
174 TestWrappingHelper(35); | 155 TestWrappingHelper(35); |
175 } | 156 } |
176 | 157 |
177 TEST_F(DelayBasedBweTest, TestLongTimeoutAndWrap) { | 158 TEST_F(DelayBasedBweTest, TestLongTimeoutAndWrap) { |
178 // Simulate a client leaving and rejoining the call after some multiple of | 159 // Simulate a client leaving and rejoining the call after some multiple of |
179 // 64 seconds later. This will cause a zero difference in abs send times due | 160 // 64 seconds later. This will cause a zero difference in abs send times due |
180 // to the wrap, but a big difference in arrival time, if streams aren't | 161 // to the wrap, but a big difference in arrival time, if streams aren't |
181 // properly timed out. | 162 // properly timed out. |
182 TestWrappingHelper(10 * 64); | 163 TestWrappingHelper(10 * 64); |
183 } | 164 } |
| 165 |
| 166 class DelayBasedBweExperimentTest : public DelayBasedBweTest { |
| 167 public: |
| 168 DelayBasedBweExperimentTest() |
| 169 : override_field_trials_("WebRTC-ImprovedBitrateEstimate/Enabled/") {} |
| 170 |
| 171 protected: |
| 172 void SetUp() override { |
| 173 bitrate_estimator_.reset(new DelayBasedBwe(&clock_)); |
| 174 } |
| 175 |
| 176 test::ScopedFieldTrials override_field_trials_; |
| 177 }; |
| 178 |
| 179 TEST_F(DelayBasedBweExperimentTest, RateIncreaseRtpTimestamps) { |
| 180 RateIncreaseRtpTimestampsTestHelper(1288); |
| 181 } |
| 182 |
| 183 TEST_F(DelayBasedBweExperimentTest, CapacityDropOneStream) { |
| 184 CapacityDropTestHelper(1, false, 333, 0); |
| 185 } |
| 186 |
| 187 TEST_F(DelayBasedBweExperimentTest, CapacityDropPosOffsetChange) { |
| 188 CapacityDropTestHelper(1, false, 300, 30000); |
| 189 } |
| 190 |
| 191 TEST_F(DelayBasedBweExperimentTest, CapacityDropNegOffsetChange) { |
| 192 CapacityDropTestHelper(1, false, 300, -30000); |
| 193 } |
| 194 |
| 195 TEST_F(DelayBasedBweExperimentTest, CapacityDropOneStreamWrap) { |
| 196 CapacityDropTestHelper(1, true, 333, 0); |
| 197 } |
184 } // namespace webrtc | 198 } // namespace webrtc |
OLD | NEW |