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

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

Issue 2468413009: Revert of Change TWCC send interval to reduce overhead on low BW situations. (Closed)
Patch Set: Created 4 years, 1 month 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 24 matching lines...) Expand all
35 void IncomingPacket(uint16_t seq, int64_t time_ms) { 35 void IncomingPacket(uint16_t seq, int64_t time_ms) {
36 RTPHeader header; 36 RTPHeader header;
37 header.extension.hasTransportSequenceNumber = true; 37 header.extension.hasTransportSequenceNumber = true;
38 header.extension.transportSequenceNumber = seq; 38 header.extension.transportSequenceNumber = seq;
39 header.ssrc = kMediaSsrc; 39 header.ssrc = kMediaSsrc;
40 proxy_.IncomingPacket(time_ms, kDefaultPacketSize, header); 40 proxy_.IncomingPacket(time_ms, kDefaultPacketSize, header);
41 } 41 }
42 42
43 void Process() { 43 void Process() {
44 clock_.AdvanceTimeMilliseconds( 44 clock_.AdvanceTimeMilliseconds(
45 RemoteEstimatorProxy::kDefaultSendIntervalMs); 45 RemoteEstimatorProxy::kDefaultProcessIntervalMs);
46 proxy_.Process(); 46 proxy_.Process();
47 } 47 }
48 48
49 SimulatedClock clock_; 49 SimulatedClock clock_;
50 testing::StrictMock<MockPacketRouter> router_; 50 testing::StrictMock<MockPacketRouter> router_;
51 RemoteEstimatorProxy proxy_; 51 RemoteEstimatorProxy proxy_;
52 52
53 const size_t kDefaultPacketSize = 100; 53 const size_t kDefaultPacketSize = 100;
54 const uint32_t kMediaSsrc = 456; 54 const uint32_t kMediaSsrc = 456;
55 const uint16_t kBaseSeq = 10; 55 const uint16_t kBaseSeq = 10;
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 EXPECT_EQ(kBaseTimeMs - 1, 343 EXPECT_EQ(kBaseTimeMs - 1,
344 (packet->GetBaseTimeUs() + delta_vec[0]) / 1000); 344 (packet->GetBaseTimeUs() + delta_vec[0]) / 1000);
345 EXPECT_EQ(kTimeoutTimeMs - kBaseTimeMs, delta_vec[1] / 1000); 345 EXPECT_EQ(kTimeoutTimeMs - kBaseTimeMs, delta_vec[1] / 1000);
346 EXPECT_EQ(1, delta_vec[2] / 1000); 346 EXPECT_EQ(1, delta_vec[2] / 1000);
347 return true; 347 return true;
348 })); 348 }));
349 349
350 Process(); 350 Process();
351 } 351 }
352 352
353 TEST_F(RemoteEstimatorProxyTest, TimeUntilNextProcessIsZeroBeforeFirstProcess) {
354 EXPECT_EQ(0, proxy_.TimeUntilNextProcess());
355 }
356
357 TEST_F(RemoteEstimatorProxyTest, TimeUntilNextProcessIsDefaultOnUnkownBitrate) {
358 Process();
359 EXPECT_EQ(RemoteEstimatorProxy::kDefaultSendIntervalMs,
360 proxy_.TimeUntilNextProcess());
361 }
362
363 TEST_F(RemoteEstimatorProxyTest, TimeUntilNextProcessIsMinIntervalOn300kbps) {
364 Process();
365 proxy_.OnBitrateChanged(300000);
366 EXPECT_EQ(RemoteEstimatorProxy::kMinSendIntervalMs,
367 proxy_.TimeUntilNextProcess());
368 }
369
370 TEST_F(RemoteEstimatorProxyTest, TimeUntilNextProcessIsMaxIntervalOn20kbps) {
371 Process();
372 proxy_.OnBitrateChanged(20000);
373 EXPECT_EQ(RemoteEstimatorProxy::kMaxSendIntervalMs,
374 proxy_.TimeUntilNextProcess());
375 }
376
377 TEST_F(RemoteEstimatorProxyTest, TwccReportsUse5PercentOfAvailableBandwidth) {
378 Process();
379 proxy_.OnBitrateChanged(80000);
380 // 80kbps * 0.05 = TwccReportSize(68B * 8b/B) * 1000ms / SendInterval(136ms)
381 EXPECT_EQ(136, proxy_.TimeUntilNextProcess());
382 }
383
384 } // namespace webrtc 353 } // 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