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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/inter_arrival_unittest.cc

Issue 2126793002: Reset InterArrival if arrival time clock makes a jump. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Cleanup Created 4 years, 5 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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 ((static_cast<uint64_t>(us) << 18) + 500000) / 1000000) & 0x00FFFFFFul; 159 ((static_cast<uint64_t>(us) << 18) + 500000) / 1000000) & 0x00FFFFFFul;
160 return absolute_send_time << 8; 160 return absolute_send_time << 8;
161 } 161 }
162 162
163 static void InternalExpectFalse(InterArrival* inter_arrival, 163 static void InternalExpectFalse(InterArrival* inter_arrival,
164 uint32_t timestamp, int64_t arrival_time_ms, 164 uint32_t timestamp, int64_t arrival_time_ms,
165 size_t packet_size) { 165 size_t packet_size) {
166 uint32_t dummy_timestamp = 101; 166 uint32_t dummy_timestamp = 101;
167 int64_t dummy_arrival_time_ms = 303; 167 int64_t dummy_arrival_time_ms = 303;
168 int dummy_packet_size = 909; 168 int dummy_packet_size = 909;
169 bool computed = inter_arrival->ComputeDeltas(timestamp, 169 bool computed = inter_arrival->ComputeDeltas(
170 arrival_time_ms, 170 timestamp, arrival_time_ms, arrival_time_ms, packet_size,
171 packet_size, 171 &dummy_timestamp, &dummy_arrival_time_ms, &dummy_packet_size);
172 &dummy_timestamp,
173 &dummy_arrival_time_ms,
174 &dummy_packet_size);
175 EXPECT_EQ(computed, false); 172 EXPECT_EQ(computed, false);
176 EXPECT_EQ(101ul, dummy_timestamp); 173 EXPECT_EQ(101ul, dummy_timestamp);
177 EXPECT_EQ(303, dummy_arrival_time_ms); 174 EXPECT_EQ(303, dummy_arrival_time_ms);
178 EXPECT_EQ(909, dummy_packet_size); 175 EXPECT_EQ(909, dummy_packet_size);
179 } 176 }
180 177
181 static void InternalExpectTrue(InterArrival* inter_arrival, 178 static void InternalExpectTrue(InterArrival* inter_arrival,
182 uint32_t timestamp, int64_t arrival_time_ms, 179 uint32_t timestamp, int64_t arrival_time_ms,
183 size_t packet_size, 180 size_t packet_size,
184 uint32_t expected_timestamp_delta, 181 uint32_t expected_timestamp_delta,
185 int64_t expected_arrival_time_delta_ms, 182 int64_t expected_arrival_time_delta_ms,
186 int expected_packet_size_delta, 183 int expected_packet_size_delta,
187 uint32_t timestamp_near) { 184 uint32_t timestamp_near) {
188 uint32_t delta_timestamp = 101; 185 uint32_t delta_timestamp = 101;
189 int64_t delta_arrival_time_ms = 303; 186 int64_t delta_arrival_time_ms = 303;
190 int delta_packet_size = 909; 187 int delta_packet_size = 909;
191 bool computed = inter_arrival->ComputeDeltas(timestamp, 188 bool computed = inter_arrival->ComputeDeltas(
192 arrival_time_ms, 189 timestamp, arrival_time_ms, arrival_time_ms, packet_size,
193 packet_size, 190 &delta_timestamp, &delta_arrival_time_ms, &delta_packet_size);
194 &delta_timestamp,
195 &delta_arrival_time_ms,
196 &delta_packet_size);
197 EXPECT_EQ(true, computed); 191 EXPECT_EQ(true, computed);
198 EXPECT_NEAR(expected_timestamp_delta, delta_timestamp, timestamp_near); 192 EXPECT_NEAR(expected_timestamp_delta, delta_timestamp, timestamp_near);
199 EXPECT_EQ(expected_arrival_time_delta_ms, delta_arrival_time_ms); 193 EXPECT_EQ(expected_arrival_time_delta_ms, delta_arrival_time_ms);
200 EXPECT_EQ(expected_packet_size_delta, delta_packet_size); 194 EXPECT_EQ(expected_packet_size_delta, delta_packet_size);
201 } 195 }
202 196
203 std::unique_ptr<InterArrival> inter_arrival_rtp_; 197 std::unique_ptr<InterArrival> inter_arrival_rtp_;
204 std::unique_ptr<InterArrival> inter_arrival_ast_; 198 std::unique_ptr<InterArrival> inter_arrival_ast_;
205 }; 199 };
206 200
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 408
415 TEST_F(InterArrivalTest, RtpTimestampWrapOutOfOrderWithinGroup) { 409 TEST_F(InterArrivalTest, RtpTimestampWrapOutOfOrderWithinGroup) {
416 WrapTestHelper(kStartRtpTimestampWrapUs, 1, true); 410 WrapTestHelper(kStartRtpTimestampWrapUs, 1, true);
417 } 411 }
418 412
419 TEST_F(InterArrivalTest, AbsSendTimeWrapOutOfOrderWithinGroup) { 413 TEST_F(InterArrivalTest, AbsSendTimeWrapOutOfOrderWithinGroup) {
420 WrapTestHelper(kStartAbsSendTimeWrapUs, 1, true); 414 WrapTestHelper(kStartAbsSendTimeWrapUs, 1, true);
421 } 415 }
422 } // namespace testing 416 } // namespace testing
423 } // namespace webrtc 417 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698