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

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

Issue 2157843002: Fix crash which happens when there's reordering in the beginning of a call. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comment. 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
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc ('k') | no next file » | 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) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 30 matching lines...) Expand all
41 proxy_.IncomingPacket(time_ms, kDefaultPacketSize, header); 41 proxy_.IncomingPacket(time_ms, kDefaultPacketSize, header);
42 } 42 }
43 43
44 void Process() { 44 void Process() {
45 clock_.AdvanceTimeMilliseconds( 45 clock_.AdvanceTimeMilliseconds(
46 RemoteEstimatorProxy::kDefaultProcessIntervalMs); 46 RemoteEstimatorProxy::kDefaultProcessIntervalMs);
47 proxy_.Process(); 47 proxy_.Process();
48 } 48 }
49 49
50 SimulatedClock clock_; 50 SimulatedClock clock_;
51 MockPacketRouter router_; 51 testing::StrictMock<MockPacketRouter> router_;
52 RemoteEstimatorProxy proxy_; 52 RemoteEstimatorProxy proxy_;
53 53
54 const size_t kDefaultPacketSize = 100; 54 const size_t kDefaultPacketSize = 100;
55 const uint32_t kMediaSsrc = 456; 55 const uint32_t kMediaSsrc = 456;
56 const uint16_t kBaseSeq = 10; 56 const uint16_t kBaseSeq = 10;
57 const int64_t kBaseTimeMs = 123; 57 const int64_t kBaseTimeMs = 123;
58 const int64_t kMaxSmallDeltaMs = 58 const int64_t kMaxSmallDeltaMs =
59 (rtcp::TransportFeedback::kDeltaScaleFactor * 0xFF) / 1000; 59 (rtcp::TransportFeedback::kDeltaScaleFactor * 0xFF) / 1000;
60 }; 60 };
61 61
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 EXPECT_EQ(1u, delta_vec.size()); 218 EXPECT_EQ(1u, delta_vec.size());
219 EXPECT_EQ(kBaseTimeMs + kTooLargeDelta, 219 EXPECT_EQ(kBaseTimeMs + kTooLargeDelta,
220 (packet->GetBaseTimeUs() + delta_vec[0]) / 1000); 220 (packet->GetBaseTimeUs() + delta_vec[0]) / 1000);
221 return true; 221 return true;
222 })) 222 }))
223 .RetiresOnSaturation(); 223 .RetiresOnSaturation();
224 224
225 Process(); 225 Process();
226 } 226 }
227 227
228 TEST_F(RemoteEstimatorProxyTest, GracefullyHandlesReorderingAndWrap) {
229 const int64_t kDeltaMs = 1000;
230 const uint16_t kLargeSeq = 62762;
231 IncomingPacket(kBaseSeq, kBaseTimeMs);
232 IncomingPacket(kLargeSeq, kBaseTimeMs + kDeltaMs);
233
234 EXPECT_CALL(router_, SendFeedback(_))
235 .Times(1)
236 .WillOnce(Invoke([this](rtcp::TransportFeedback* packet) {
237 packet->Build();
238 EXPECT_EQ(kBaseSeq, packet->GetBaseSequence());
239 EXPECT_EQ(kMediaSsrc, packet->GetMediaSourceSsrc());
240
241 std::vector<int64_t> delta_vec = packet->GetReceiveDeltasUs();
242 EXPECT_EQ(1u, delta_vec.size());
243 EXPECT_EQ(kBaseTimeMs, (packet->GetBaseTimeUs() + delta_vec[0]) / 1000);
244 return true;
245 }));
246
247 Process();
248 }
249
228 TEST_F(RemoteEstimatorProxyTest, ResendsTimestampsOnReordering) { 250 TEST_F(RemoteEstimatorProxyTest, ResendsTimestampsOnReordering) {
229 IncomingPacket(kBaseSeq, kBaseTimeMs); 251 IncomingPacket(kBaseSeq, kBaseTimeMs);
230 IncomingPacket(kBaseSeq + 2, kBaseTimeMs + 2); 252 IncomingPacket(kBaseSeq + 2, kBaseTimeMs + 2);
231 253
232 EXPECT_CALL(router_, SendFeedback(_)) 254 EXPECT_CALL(router_, SendFeedback(_))
233 .Times(1) 255 .Times(1)
234 .WillOnce(Invoke([this](rtcp::TransportFeedback* packet) { 256 .WillOnce(Invoke([this](rtcp::TransportFeedback* packet) {
235 packet->Build(); 257 packet->Build();
236 EXPECT_EQ(kBaseSeq, packet->GetBaseSequence()); 258 EXPECT_EQ(kBaseSeq, packet->GetBaseSequence());
237 EXPECT_EQ(kMediaSsrc, packet->GetMediaSourceSsrc()); 259 EXPECT_EQ(kMediaSsrc, packet->GetMediaSourceSsrc());
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 (packet->GetBaseTimeUs() + delta_vec[0]) / 1000); 345 (packet->GetBaseTimeUs() + delta_vec[0]) / 1000);
324 EXPECT_EQ(kTimeoutTimeMs - kBaseTimeMs, delta_vec[1] / 1000); 346 EXPECT_EQ(kTimeoutTimeMs - kBaseTimeMs, delta_vec[1] / 1000);
325 EXPECT_EQ(1, delta_vec[2] / 1000); 347 EXPECT_EQ(1, delta_vec[2] / 1000);
326 return true; 348 return true;
327 })); 349 }));
328 350
329 Process(); 351 Process();
330 } 352 }
331 353
332 } // namespace webrtc 354 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698