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

Side by Side Diff: modules/congestion_controller/send_side_congestion_controller_unittest.cc

Issue 3004783002: Push back on the video encoder to avoid building queues in the pacer. (Closed)
Patch Set: Rebase Created 3 years, 2 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 | « modules/congestion_controller/send_side_congestion_controller.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) 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 "modules/congestion_controller/include/send_side_congestion_controller. h"
12 #include "logging/rtc_event_log/mock/mock_rtc_event_log.h" 11 #include "logging/rtc_event_log/mock/mock_rtc_event_log.h"
13 #include "modules/bitrate_controller/include/bitrate_controller.h" 12 #include "modules/bitrate_controller/include/bitrate_controller.h"
14 #include "modules/congestion_controller/congestion_controller_unittests_helper.h " 13 #include "modules/congestion_controller/congestion_controller_unittests_helper.h "
15 #include "modules/congestion_controller/include/mock/mock_congestion_observer.h" 14 #include "modules/congestion_controller/include/mock/mock_congestion_observer.h"
15 #include "modules/congestion_controller/include/send_side_congestion_controller. h"
16 #include "modules/pacing/mock/mock_paced_sender.h" 16 #include "modules/pacing/mock/mock_paced_sender.h"
17 #include "modules/remote_bitrate_estimator/include/bwe_defines.h" 17 #include "modules/remote_bitrate_estimator/include/bwe_defines.h"
18 #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" 18 #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
19 #include "modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" 19 #include "modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
20 #include "rtc_base/socket.h" 20 #include "rtc_base/socket.h"
21 #include "system_wrappers/include/clock.h" 21 #include "system_wrappers/include/clock.h"
22 #include "test/field_trial.h"
22 #include "test/gmock.h" 23 #include "test/gmock.h"
23 #include "test/gtest.h" 24 #include "test/gtest.h"
24 25
25 using testing::_; 26 using testing::_;
26 using testing::AtLeast; 27 using testing::AtLeast;
28 using testing::Ge;
27 using testing::NiceMock; 29 using testing::NiceMock;
28 using testing::Return; 30 using testing::Return;
29 using testing::SaveArg; 31 using testing::SaveArg;
30 using testing::StrictMock; 32 using testing::StrictMock;
31 33
32 namespace webrtc { 34 namespace webrtc {
33 35
34 namespace { 36 namespace {
35 const webrtc::PacedPacketInfo kPacingInfo0(0, 5, 2000); 37 const webrtc::PacedPacketInfo kPacingInfo0(0, 5, 2000);
36 const webrtc::PacedPacketInfo kPacingInfo1(1, 8, 4000); 38 const webrtc::PacedPacketInfo kPacingInfo1(1, 8, 4000);
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 // simulates no bandwidth limitation, and therefore not built-up delay. 450 // simulates no bandwidth limitation, and therefore not built-up delay.
449 PacketTransmissionAndFeedbackBlock(&seq_num, kRunTimeMs, 0); 451 PacketTransmissionAndFeedbackBlock(&seq_num, kRunTimeMs, 0);
450 ASSERT_TRUE(target_bitrate_bps_); 452 ASSERT_TRUE(target_bitrate_bps_);
451 453
452 // Repeat, but this time with a building delay, and make sure that the 454 // Repeat, but this time with a building delay, and make sure that the
453 // estimation is adjusted downwards. 455 // estimation is adjusted downwards.
454 uint32_t bitrate_before_delay = *target_bitrate_bps_; 456 uint32_t bitrate_before_delay = *target_bitrate_bps_;
455 PacketTransmissionAndFeedbackBlock(&seq_num, kRunTimeMs, 50); 457 PacketTransmissionAndFeedbackBlock(&seq_num, kRunTimeMs, 50);
456 EXPECT_LT(*target_bitrate_bps_, bitrate_before_delay); 458 EXPECT_LT(*target_bitrate_bps_, bitrate_before_delay);
457 } 459 }
460
461 TEST_F(SendSideCongestionControllerTest, PacerQueueEncodeRatePushback) {
462 ScopedFieldTrials pushback_field_trial(
463 "WebRTC-PacerPushbackExperiment/Enabled/");
464 SetUp();
465
466 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs()).WillOnce(Return(0));
467 controller_->Process();
468
469 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs()).WillOnce(Return(100));
470 EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps * 0.9, _, _, _));
471 controller_->Process();
472
473 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs()).WillOnce(Return(50));
474 controller_->Process();
475
476 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs()).WillOnce(Return(0));
477 EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps, _, _, _));
478 controller_->Process();
479
480 const uint32_t kMinAdjustedBps = 50000;
481 int expected_queue_threshold =
482 1000 - kMinAdjustedBps * 1000.0 / kInitialBitrateBps;
483
484 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs())
485 .WillOnce(Return(expected_queue_threshold));
486 EXPECT_CALL(observer_, OnNetworkChanged(Ge(kMinAdjustedBps), _, _, _));
487 controller_->Process();
488
489 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs())
490 .WillOnce(Return(expected_queue_threshold + 1));
491 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _, _));
492 controller_->Process();
493
494 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs()).WillOnce(Return(0));
495 EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps, _, _, _));
496 controller_->Process();
497 }
498
458 } // namespace test 499 } // namespace test
459 } // namespace webrtc 500 } // namespace webrtc
OLDNEW
« no previous file with comments | « modules/congestion_controller/send_side_congestion_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698