pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 11 | #include <algorithm> |
| 12 | #include <vector> |
| 13 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 14 | #include "logging/rtc_event_log/mock/mock_rtc_event_log.h" |
| 15 | #include "modules/bitrate_controller/include/bitrate_controller.h" |
| 16 | #include "modules/pacing/mock/mock_paced_sender.h" |
| 17 | #include "modules/remote_bitrate_estimator/include/bwe_defines.h" |
| 18 | #include "test/field_trial.h" |
| 19 | #include "test/gtest.h" |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 20 | |
perkj | ec81bcd | 2016-05-11 06:01:13 -0700 | [diff] [blame] | 21 | using ::testing::Exactly; |
| 22 | using ::testing::Return; |
| 23 | |
perkj | e30c272 | 2016-05-09 04:57:11 -0700 | [diff] [blame] | 24 | using webrtc::BitrateController; |
perkj | ec81bcd | 2016-05-11 06:01:13 -0700 | [diff] [blame] | 25 | using webrtc::BitrateObserver; |
| 26 | using webrtc::PacedSender; |
| 27 | using webrtc::RtcpBandwidthObserver; |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 28 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 29 | uint8_t WeightedLoss(int num_packets1, |
| 30 | uint8_t fraction_loss1, |
| 31 | int num_packets2, |
| 32 | uint8_t fraction_loss2) { |
| 33 | int weighted_sum = |
| 34 | num_packets1 * fraction_loss1 + num_packets2 * fraction_loss2; |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 35 | int total_num_packets = num_packets1 + num_packets2; |
| 36 | return (weighted_sum + total_num_packets / 2) / total_num_packets; |
| 37 | } |
| 38 | |
| 39 | webrtc::RTCPReportBlock CreateReportBlock( |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 40 | uint32_t remote_ssrc, |
| 41 | uint32_t source_ssrc, |
| 42 | uint8_t fraction_lost, |
| 43 | uint32_t extended_high_sequence_number) { |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 44 | return webrtc::RTCPReportBlock(remote_ssrc, source_ssrc, fraction_lost, 0, |
| 45 | extended_high_sequence_number, 0, 0, 0); |
| 46 | } |
| 47 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 48 | class TestBitrateObserver : public BitrateObserver { |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 49 | public: |
| 50 | TestBitrateObserver() |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 51 | : last_bitrate_(0), last_fraction_loss_(0), last_rtt_(0) {} |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 52 | |
stefan@webrtc.org | edeea91 | 2014-12-08 19:46:23 +0000 | [diff] [blame] | 53 | virtual void OnNetworkChanged(uint32_t bitrate, |
| 54 | uint8_t fraction_loss, |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 55 | int64_t rtt) { |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 56 | last_bitrate_ = static_cast<int>(bitrate); |
kjellander@webrtc.org | 2e84c11 | 2012-05-31 13:55:01 +0000 | [diff] [blame] | 57 | last_fraction_loss_ = fraction_loss; |
| 58 | last_rtt_ = rtt; |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 59 | } |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 60 | int last_bitrate_; |
kjellander@webrtc.org | 2e84c11 | 2012-05-31 13:55:01 +0000 | [diff] [blame] | 61 | uint8_t last_fraction_loss_; |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 62 | int64_t last_rtt_; |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 63 | }; |
| 64 | |
| 65 | class BitrateControllerTest : public ::testing::Test { |
| 66 | protected: |
stefan@webrtc.org | 792f1a1 | 2015-03-04 12:24:26 +0000 | [diff] [blame] | 67 | BitrateControllerTest() : clock_(0) {} |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 68 | ~BitrateControllerTest() {} |
| 69 | |
| 70 | virtual void SetUp() { |
Stefan Holmer | 52200d0 | 2016-09-20 14:14:23 +0200 | [diff] [blame] | 71 | controller_.reset(BitrateController::CreateBitrateController( |
| 72 | &clock_, &bitrate_observer_, &event_log_)); |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 73 | controller_->SetStartBitrate(kStartBitrateBps); |
| 74 | EXPECT_EQ(kStartBitrateBps, bitrate_observer_.last_bitrate_); |
| 75 | controller_->SetMinMaxBitrate(kMinBitrateBps, kMaxBitrateBps); |
| 76 | EXPECT_EQ(kStartBitrateBps, bitrate_observer_.last_bitrate_); |
Sebastian Jansson | 8d9c540 | 2017-11-15 17:22:16 +0100 | [diff] [blame] | 77 | bandwidth_observer_ = controller_.get(); |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 78 | } |
| 79 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 80 | virtual void TearDown() {} |
andresp@webrtc.org | 44caf01 | 2014-03-26 21:00:21 +0000 | [diff] [blame] | 81 | |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 82 | const int kMinBitrateBps = 100000; |
| 83 | const int kStartBitrateBps = 200000; |
| 84 | const int kMaxBitrateBps = 300000; |
| 85 | |
| 86 | const int kDefaultMinBitrateBps = 10000; |
| 87 | const int kDefaultMaxBitrateBps = 1000000000; |
| 88 | |
andresp@webrtc.org | 44caf01 | 2014-03-26 21:00:21 +0000 | [diff] [blame] | 89 | webrtc::SimulatedClock clock_; |
stefan@webrtc.org | 792f1a1 | 2015-03-04 12:24:26 +0000 | [diff] [blame] | 90 | TestBitrateObserver bitrate_observer_; |
Stefan Holmer | 52200d0 | 2016-09-20 14:14:23 +0200 | [diff] [blame] | 91 | std::unique_ptr<BitrateController> controller_; |
Sebastian Jansson | 8d9c540 | 2017-11-15 17:22:16 +0100 | [diff] [blame] | 92 | RtcpBandwidthObserver* bandwidth_observer_; |
Ivo Creusen | fa1d568 | 2016-07-06 09:12:06 +0200 | [diff] [blame] | 93 | testing::NiceMock<webrtc::MockRtcEventLog> event_log_; |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 94 | }; |
| 95 | |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 96 | TEST_F(BitrateControllerTest, DefaultMinMaxBitrate) { |
| 97 | // Receive successively lower REMBs, verify the reserved bitrate is deducted. |
| 98 | controller_->SetMinMaxBitrate(0, 0); |
| 99 | EXPECT_EQ(kStartBitrateBps, bitrate_observer_.last_bitrate_); |
| 100 | bandwidth_observer_->OnReceivedEstimatedBitrate(kDefaultMinBitrateBps / 2); |
michaelt | f082c2a | 2016-11-07 04:17:14 -0800 | [diff] [blame] | 101 | EXPECT_EQ(webrtc::congestion_controller::GetMinBitrateBps(), |
| 102 | bitrate_observer_.last_bitrate_); |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 103 | bandwidth_observer_->OnReceivedEstimatedBitrate(2 * kDefaultMaxBitrateBps); |
| 104 | clock_.AdvanceTimeMilliseconds(1000); |
| 105 | controller_->Process(); |
| 106 | EXPECT_EQ(kDefaultMaxBitrateBps, bitrate_observer_.last_bitrate_); |
| 107 | } |
| 108 | |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 109 | TEST_F(BitrateControllerTest, OneBitrateObserverOneRtcpObserver) { |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 110 | // First REMB applies immediately. |
| 111 | int64_t time_ms = 1001; |
| 112 | webrtc::ReportBlockList report_blocks; |
| 113 | report_blocks.push_back(CreateReportBlock(1, 2, 0, 1)); |
| 114 | bandwidth_observer_->OnReceivedEstimatedBitrate(200000); |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 115 | EXPECT_EQ(200000, bitrate_observer_.last_bitrate_); |
stefan@webrtc.org | 792f1a1 | 2015-03-04 12:24:26 +0000 | [diff] [blame] | 116 | EXPECT_EQ(0, bitrate_observer_.last_fraction_loss_); |
| 117 | EXPECT_EQ(0, bitrate_observer_.last_rtt_); |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 118 | bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); |
| 119 | report_blocks.clear(); |
| 120 | time_ms += 2000; |
| 121 | |
| 122 | // Receive a high remb, test bitrate inc. |
| 123 | bandwidth_observer_->OnReceivedEstimatedBitrate(400000); |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 124 | |
andresp@webrtc.org | 44caf01 | 2014-03-26 21:00:21 +0000 | [diff] [blame] | 125 | // Test bitrate increase 8% per second. |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 126 | report_blocks.push_back(CreateReportBlock(1, 2, 0, 21)); |
| 127 | bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 128 | EXPECT_EQ(217000, bitrate_observer_.last_bitrate_); |
stefan@webrtc.org | 792f1a1 | 2015-03-04 12:24:26 +0000 | [diff] [blame] | 129 | EXPECT_EQ(0, bitrate_observer_.last_fraction_loss_); |
| 130 | EXPECT_EQ(50, bitrate_observer_.last_rtt_); |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 131 | time_ms += 1000; |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 132 | |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 133 | report_blocks.clear(); |
| 134 | report_blocks.push_back(CreateReportBlock(1, 2, 0, 41)); |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 135 | bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 136 | EXPECT_EQ(235360, bitrate_observer_.last_bitrate_); |
stefan@webrtc.org | 792f1a1 | 2015-03-04 12:24:26 +0000 | [diff] [blame] | 137 | EXPECT_EQ(0, bitrate_observer_.last_fraction_loss_); |
| 138 | EXPECT_EQ(50, bitrate_observer_.last_rtt_); |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 139 | time_ms += 1000; |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 140 | |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 141 | report_blocks.clear(); |
| 142 | report_blocks.push_back(CreateReportBlock(1, 2, 0, 61)); |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 143 | bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 144 | EXPECT_EQ(255189, bitrate_observer_.last_bitrate_); |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 145 | time_ms += 1000; |
| 146 | |
| 147 | report_blocks.clear(); |
| 148 | report_blocks.push_back(CreateReportBlock(1, 2, 0, 81)); |
| 149 | bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 150 | EXPECT_EQ(276604, bitrate_observer_.last_bitrate_); |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 151 | time_ms += 1000; |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 152 | |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 153 | report_blocks.clear(); |
stefan | d48717b | 2016-08-22 08:50:31 -0700 | [diff] [blame] | 154 | report_blocks.push_back(CreateReportBlock(1, 2, 0, 101)); |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 155 | bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 156 | EXPECT_EQ(299732, bitrate_observer_.last_bitrate_); |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 157 | time_ms += 1000; |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 158 | |
andresp@webrtc.org | 44caf01 | 2014-03-26 21:00:21 +0000 | [diff] [blame] | 159 | // Reach max cap. |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 160 | report_blocks.clear(); |
stefan | d48717b | 2016-08-22 08:50:31 -0700 | [diff] [blame] | 161 | report_blocks.push_back(CreateReportBlock(1, 2, 0, 121)); |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 162 | bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 163 | EXPECT_EQ(300000, bitrate_observer_.last_bitrate_); |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 164 | time_ms += 1000; |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 165 | |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 166 | report_blocks.clear(); |
| 167 | report_blocks.push_back(CreateReportBlock(1, 2, 0, 141)); |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 168 | bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 169 | EXPECT_EQ(300000, bitrate_observer_.last_bitrate_); |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 170 | |
stefan | 32f8154 | 2016-01-20 07:13:58 -0800 | [diff] [blame] | 171 | // Test that a low delay-based estimate limits the combined estimate. |
Stefan Holmer | 280de9e | 2016-09-30 10:06:51 +0200 | [diff] [blame] | 172 | webrtc::DelayBasedBwe::Result result(false, 280000); |
| 173 | controller_->OnDelayBasedBweResult(result); |
stefan | 32f8154 | 2016-01-20 07:13:58 -0800 | [diff] [blame] | 174 | EXPECT_EQ(280000, bitrate_observer_.last_bitrate_); |
| 175 | |
| 176 | // Test that a low REMB limits the combined estimate. |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 177 | bandwidth_observer_->OnReceivedEstimatedBitrate(250000); |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 178 | EXPECT_EQ(250000, bitrate_observer_.last_bitrate_); |
stefan@webrtc.org | 792f1a1 | 2015-03-04 12:24:26 +0000 | [diff] [blame] | 179 | EXPECT_EQ(0, bitrate_observer_.last_fraction_loss_); |
| 180 | EXPECT_EQ(50, bitrate_observer_.last_rtt_); |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 181 | |
| 182 | bandwidth_observer_->OnReceivedEstimatedBitrate(1000); |
stefan | 32f8154 | 2016-01-20 07:13:58 -0800 | [diff] [blame] | 183 | EXPECT_EQ(100000, bitrate_observer_.last_bitrate_); |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 184 | } |
| 185 | |
| 186 | TEST_F(BitrateControllerTest, OneBitrateObserverTwoRtcpObservers) { |
Danil Chapovalov | 7f8369a | 2017-06-08 17:22:51 +0200 | [diff] [blame] | 187 | const uint32_t kSenderSsrc1 = 1; |
| 188 | const uint32_t kSenderSsrc2 = 2; |
| 189 | const uint32_t kMediaSsrc1 = 3; |
| 190 | const uint32_t kMediaSsrc2 = 4; |
| 191 | |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 192 | int64_t time_ms = 1; |
| 193 | webrtc::ReportBlockList report_blocks; |
Danil Chapovalov | 7f8369a | 2017-06-08 17:22:51 +0200 | [diff] [blame] | 194 | report_blocks = {CreateReportBlock(kSenderSsrc1, kMediaSsrc1, 0, 1)}; |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 195 | bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 196 | time_ms += 500; |
| 197 | |
Sebastian Jansson | 8d9c540 | 2017-11-15 17:22:16 +0100 | [diff] [blame] | 198 | RtcpBandwidthObserver* second_bandwidth_observer = controller_.get(); |
Danil Chapovalov | 7f8369a | 2017-06-08 17:22:51 +0200 | [diff] [blame] | 199 | report_blocks = {CreateReportBlock(kSenderSsrc2, kMediaSsrc2, 0, 21)}; |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 200 | second_bandwidth_observer->OnReceivedRtcpReceiverReport(report_blocks, 100, |
| 201 | time_ms); |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 202 | |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 203 | // Test start bitrate. |
Stefan Holmer | 52200d0 | 2016-09-20 14:14:23 +0200 | [diff] [blame] | 204 | EXPECT_EQ(200000, bitrate_observer_.last_bitrate_); |
stefan@webrtc.org | 792f1a1 | 2015-03-04 12:24:26 +0000 | [diff] [blame] | 205 | EXPECT_EQ(0, bitrate_observer_.last_fraction_loss_); |
| 206 | EXPECT_EQ(100, bitrate_observer_.last_rtt_); |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 207 | time_ms += 500; |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 208 | |
| 209 | // Test bitrate increase 8% per second. |
Danil Chapovalov | 7f8369a | 2017-06-08 17:22:51 +0200 | [diff] [blame] | 210 | report_blocks = {CreateReportBlock(kSenderSsrc1, kMediaSsrc1, 0, 21)}; |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 211 | bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); |
| 212 | time_ms += 500; |
Danil Chapovalov | 7f8369a | 2017-06-08 17:22:51 +0200 | [diff] [blame] | 213 | |
| 214 | report_blocks = {CreateReportBlock(kSenderSsrc2, kMediaSsrc2, 0, 21)}; |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 215 | second_bandwidth_observer->OnReceivedRtcpReceiverReport(report_blocks, 100, |
| 216 | time_ms); |
Stefan Holmer | 52200d0 | 2016-09-20 14:14:23 +0200 | [diff] [blame] | 217 | EXPECT_EQ(217000, bitrate_observer_.last_bitrate_); |
stefan@webrtc.org | 792f1a1 | 2015-03-04 12:24:26 +0000 | [diff] [blame] | 218 | EXPECT_EQ(0, bitrate_observer_.last_fraction_loss_); |
| 219 | EXPECT_EQ(100, bitrate_observer_.last_rtt_); |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 220 | time_ms += 500; |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 221 | |
| 222 | // Extra report should not change estimate. |
Danil Chapovalov | 7f8369a | 2017-06-08 17:22:51 +0200 | [diff] [blame] | 223 | report_blocks = {CreateReportBlock(kSenderSsrc2, kMediaSsrc2, 0, 31)}; |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 224 | second_bandwidth_observer->OnReceivedRtcpReceiverReport(report_blocks, 100, |
| 225 | time_ms); |
Stefan Holmer | 52200d0 | 2016-09-20 14:14:23 +0200 | [diff] [blame] | 226 | EXPECT_EQ(217000, bitrate_observer_.last_bitrate_); |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 227 | time_ms += 500; |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 228 | |
Danil Chapovalov | 7f8369a | 2017-06-08 17:22:51 +0200 | [diff] [blame] | 229 | report_blocks = {CreateReportBlock(kSenderSsrc1, kMediaSsrc1, 0, 41)}; |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 230 | bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); |
Stefan Holmer | 52200d0 | 2016-09-20 14:14:23 +0200 | [diff] [blame] | 231 | EXPECT_EQ(235360, bitrate_observer_.last_bitrate_); |
pwestin@webrtc.org | a2cd732 | 2012-04-23 08:32:47 +0000 | [diff] [blame] | 232 | |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 233 | // Second report should not change estimate. |
Danil Chapovalov | 7f8369a | 2017-06-08 17:22:51 +0200 | [diff] [blame] | 234 | report_blocks = {CreateReportBlock(kSenderSsrc2, kMediaSsrc2, 0, 41)}; |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 235 | second_bandwidth_observer->OnReceivedRtcpReceiverReport(report_blocks, 100, |
| 236 | time_ms); |
Stefan Holmer | 52200d0 | 2016-09-20 14:14:23 +0200 | [diff] [blame] | 237 | EXPECT_EQ(235360, bitrate_observer_.last_bitrate_); |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 238 | time_ms += 1000; |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 239 | |
| 240 | // Reports from only one bandwidth observer is ok. |
Danil Chapovalov | 7f8369a | 2017-06-08 17:22:51 +0200 | [diff] [blame] | 241 | report_blocks = {CreateReportBlock(kSenderSsrc2, kMediaSsrc2, 0, 61)}; |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 242 | second_bandwidth_observer->OnReceivedRtcpReceiverReport(report_blocks, 50, |
| 243 | time_ms); |
Stefan Holmer | 52200d0 | 2016-09-20 14:14:23 +0200 | [diff] [blame] | 244 | EXPECT_EQ(255189, bitrate_observer_.last_bitrate_); |
| 245 | time_ms += 1000; |
| 246 | |
Danil Chapovalov | 7f8369a | 2017-06-08 17:22:51 +0200 | [diff] [blame] | 247 | report_blocks = {CreateReportBlock(kSenderSsrc2, kMediaSsrc2, 0, 81)}; |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 248 | second_bandwidth_observer->OnReceivedRtcpReceiverReport(report_blocks, 50, |
| 249 | time_ms); |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 250 | EXPECT_EQ(276604, bitrate_observer_.last_bitrate_); |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 251 | time_ms += 1000; |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 252 | |
Danil Chapovalov | 7f8369a | 2017-06-08 17:22:51 +0200 | [diff] [blame] | 253 | report_blocks = {CreateReportBlock(kSenderSsrc2, kMediaSsrc2, 0, 121)}; |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 254 | second_bandwidth_observer->OnReceivedRtcpReceiverReport(report_blocks, 50, |
| 255 | time_ms); |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 256 | EXPECT_EQ(299732, bitrate_observer_.last_bitrate_); |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 257 | time_ms += 1000; |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 258 | |
andresp@webrtc.org | 44caf01 | 2014-03-26 21:00:21 +0000 | [diff] [blame] | 259 | // Reach max cap. |
Danil Chapovalov | 7f8369a | 2017-06-08 17:22:51 +0200 | [diff] [blame] | 260 | report_blocks = {CreateReportBlock(kSenderSsrc2, kMediaSsrc2, 0, 141)}; |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 261 | second_bandwidth_observer->OnReceivedRtcpReceiverReport(report_blocks, 50, |
| 262 | time_ms); |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 263 | EXPECT_EQ(300000, bitrate_observer_.last_bitrate_); |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 264 | |
| 265 | // Test that a low REMB trigger immediately. |
| 266 | // We don't care which bandwidth observer that delivers the REMB. |
| 267 | second_bandwidth_observer->OnReceivedEstimatedBitrate(250000); |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 268 | EXPECT_EQ(250000, bitrate_observer_.last_bitrate_); |
stefan@webrtc.org | 792f1a1 | 2015-03-04 12:24:26 +0000 | [diff] [blame] | 269 | EXPECT_EQ(0, bitrate_observer_.last_fraction_loss_); |
| 270 | EXPECT_EQ(50, bitrate_observer_.last_rtt_); |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 271 | |
andresp@webrtc.org | 44caf01 | 2014-03-26 21:00:21 +0000 | [diff] [blame] | 272 | // Min cap. |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 273 | bandwidth_observer_->OnReceivedEstimatedBitrate(1000); |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 274 | EXPECT_EQ(100000, bitrate_observer_.last_bitrate_); |
pwestin@webrtc.org | 1cd1162 | 2012-04-19 12:13:52 +0000 | [diff] [blame] | 275 | } |
| 276 | |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 277 | TEST_F(BitrateControllerTest, OneBitrateObserverMultipleReportBlocks) { |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 278 | uint32_t sequence_number[2] = {0, 0xFF00}; |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 279 | const int kStartBitrate = 200000; |
| 280 | const int kMinBitrate = 100000; |
| 281 | const int kMaxBitrate = 300000; |
stefan@webrtc.org | 792f1a1 | 2015-03-04 12:24:26 +0000 | [diff] [blame] | 282 | controller_->SetStartBitrate(kStartBitrate); |
| 283 | controller_->SetMinMaxBitrate(kMinBitrate, kMaxBitrate); |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 284 | |
stefan@webrtc.org | 82462aa | 2014-10-23 11:57:05 +0000 | [diff] [blame] | 285 | // REMBs during the first 2 seconds apply immediately. |
| 286 | int64_t time_ms = 1001; |
| 287 | webrtc::ReportBlockList report_blocks; |
| 288 | report_blocks.push_back(CreateReportBlock(1, 2, 0, sequence_number[0])); |
| 289 | bandwidth_observer_->OnReceivedEstimatedBitrate(kStartBitrate); |
| 290 | bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); |
| 291 | report_blocks.clear(); |
| 292 | time_ms += 2000; |
| 293 | |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 294 | // Receive a high REMB, test bitrate increase. |
| 295 | bandwidth_observer_->OnReceivedEstimatedBitrate(400000); |
| 296 | |
Stefan Holmer | e590416 | 2015-03-26 11:11:06 +0100 | [diff] [blame] | 297 | int last_bitrate = 0; |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 298 | // Ramp up to max bitrate. |
Stefan Holmer | 52200d0 | 2016-09-20 14:14:23 +0200 | [diff] [blame] | 299 | for (int i = 0; i < 7; ++i) { |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 300 | report_blocks.push_back(CreateReportBlock(1, 2, 0, sequence_number[0])); |
| 301 | report_blocks.push_back(CreateReportBlock(1, 3, 0, sequence_number[1])); |
| 302 | bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, |
| 303 | time_ms); |
stefan@webrtc.org | 792f1a1 | 2015-03-04 12:24:26 +0000 | [diff] [blame] | 304 | EXPECT_GT(bitrate_observer_.last_bitrate_, last_bitrate); |
| 305 | EXPECT_EQ(0, bitrate_observer_.last_fraction_loss_); |
| 306 | EXPECT_EQ(50, bitrate_observer_.last_rtt_); |
| 307 | last_bitrate = bitrate_observer_.last_bitrate_; |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 308 | time_ms += 1000; |
| 309 | sequence_number[0] += 20; |
| 310 | sequence_number[1] += 1; |
| 311 | report_blocks.clear(); |
| 312 | } |
| 313 | |
stefan@webrtc.org | 792f1a1 | 2015-03-04 12:24:26 +0000 | [diff] [blame] | 314 | EXPECT_EQ(kMaxBitrate, bitrate_observer_.last_bitrate_); |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 315 | |
| 316 | // Packet loss on the first stream. Verify that bitrate decreases. |
| 317 | report_blocks.push_back(CreateReportBlock(1, 2, 50, sequence_number[0])); |
| 318 | report_blocks.push_back(CreateReportBlock(1, 3, 0, sequence_number[1])); |
| 319 | bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); |
stefan@webrtc.org | 792f1a1 | 2015-03-04 12:24:26 +0000 | [diff] [blame] | 320 | EXPECT_LT(bitrate_observer_.last_bitrate_, last_bitrate); |
| 321 | EXPECT_EQ(WeightedLoss(20, 50, 1, 0), bitrate_observer_.last_fraction_loss_); |
| 322 | EXPECT_EQ(50, bitrate_observer_.last_rtt_); |
| 323 | last_bitrate = bitrate_observer_.last_bitrate_; |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 324 | sequence_number[0] += 20; |
| 325 | sequence_number[1] += 20; |
| 326 | time_ms += 1000; |
| 327 | report_blocks.clear(); |
| 328 | |
| 329 | // Packet loss on the second stream. Verify that bitrate decreases. |
| 330 | report_blocks.push_back(CreateReportBlock(1, 2, 0, sequence_number[0])); |
| 331 | report_blocks.push_back(CreateReportBlock(1, 3, 75, sequence_number[1])); |
| 332 | bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); |
stefan@webrtc.org | 792f1a1 | 2015-03-04 12:24:26 +0000 | [diff] [blame] | 333 | EXPECT_LT(bitrate_observer_.last_bitrate_, last_bitrate); |
| 334 | EXPECT_EQ(WeightedLoss(20, 0, 20, 75), bitrate_observer_.last_fraction_loss_); |
| 335 | EXPECT_EQ(50, bitrate_observer_.last_rtt_); |
| 336 | last_bitrate = bitrate_observer_.last_bitrate_; |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 337 | sequence_number[0] += 20; |
| 338 | sequence_number[1] += 1; |
| 339 | time_ms += 1000; |
| 340 | report_blocks.clear(); |
| 341 | |
| 342 | // All packets lost on stream with few packets, no back-off. |
Sebastian Jansson | 439f0bc | 2018-02-20 10:46:39 +0100 | [diff] [blame] | 343 | report_blocks.push_back(CreateReportBlock(1, 2, 0, sequence_number[0])); |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 344 | report_blocks.push_back(CreateReportBlock(1, 3, 255, sequence_number[1])); |
| 345 | bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); |
stefan@webrtc.org | 792f1a1 | 2015-03-04 12:24:26 +0000 | [diff] [blame] | 346 | EXPECT_EQ(bitrate_observer_.last_bitrate_, last_bitrate); |
Sebastian Jansson | 439f0bc | 2018-02-20 10:46:39 +0100 | [diff] [blame] | 347 | EXPECT_EQ(WeightedLoss(20, 0, 1, 255), bitrate_observer_.last_fraction_loss_); |
stefan@webrtc.org | 792f1a1 | 2015-03-04 12:24:26 +0000 | [diff] [blame] | 348 | EXPECT_EQ(50, bitrate_observer_.last_rtt_); |
| 349 | last_bitrate = bitrate_observer_.last_bitrate_; |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 350 | sequence_number[0] += 20; |
| 351 | sequence_number[1] += 1; |
| 352 | report_blocks.clear(); |
| 353 | } |
| 354 | |
Stefan Holmer | 52200d0 | 2016-09-20 14:14:23 +0200 | [diff] [blame] | 355 | TEST_F(BitrateControllerTest, TimeoutsWithoutFeedback) { |
| 356 | { |
| 357 | webrtc::test::ScopedFieldTrials override_field_trials( |
Stefan Holmer | db158f9 | 2016-10-13 02:11:51 +0200 | [diff] [blame] | 358 | "WebRTC-FeedbackTimeout/Enabled/"); |
Stefan Holmer | 52200d0 | 2016-09-20 14:14:23 +0200 | [diff] [blame] | 359 | SetUp(); |
| 360 | int expected_bitrate_bps = 300000; |
| 361 | controller_->SetBitrates(300000, kDefaultMinBitrateBps, |
| 362 | kDefaultMaxBitrateBps); |
| 363 | |
| 364 | webrtc::ReportBlockList report_blocks; |
| 365 | report_blocks.push_back(CreateReportBlock(1, 2, 0, 1)); |
| 366 | bandwidth_observer_->OnReceivedRtcpReceiverReport( |
| 367 | report_blocks, 50, clock_.TimeInMilliseconds()); |
| 368 | EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
| 369 | clock_.AdvanceTimeMilliseconds(500); |
| 370 | |
| 371 | report_blocks.push_back(CreateReportBlock(1, 2, 0, 21)); |
| 372 | bandwidth_observer_->OnReceivedRtcpReceiverReport( |
| 373 | report_blocks, 50, clock_.TimeInMilliseconds()); |
| 374 | report_blocks.clear(); |
| 375 | expected_bitrate_bps = expected_bitrate_bps * 1.08 + 1000; |
| 376 | EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
| 377 | clock_.AdvanceTimeMilliseconds(1500); |
| 378 | |
| 379 | report_blocks.push_back(CreateReportBlock(1, 2, 0, 41)); |
| 380 | bandwidth_observer_->OnReceivedRtcpReceiverReport( |
| 381 | report_blocks, 50, clock_.TimeInMilliseconds()); |
| 382 | expected_bitrate_bps = expected_bitrate_bps * 1.08 + 1000; |
| 383 | EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
stefan | 5cb1982 | 2017-06-16 07:47:00 -0700 | [diff] [blame] | 384 | clock_.AdvanceTimeMilliseconds(4000); |
Stefan Holmer | 52200d0 | 2016-09-20 14:14:23 +0200 | [diff] [blame] | 385 | |
stefan | 5cb1982 | 2017-06-16 07:47:00 -0700 | [diff] [blame] | 386 | // 4 seconds since feedback, expect increase. |
Stefan Holmer | 52200d0 | 2016-09-20 14:14:23 +0200 | [diff] [blame] | 387 | controller_->Process(); |
| 388 | expected_bitrate_bps = expected_bitrate_bps * 1.08 + 1000; |
| 389 | EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
stefan | 5cb1982 | 2017-06-16 07:47:00 -0700 | [diff] [blame] | 390 | clock_.AdvanceTimeMilliseconds(2000); |
Stefan Holmer | 52200d0 | 2016-09-20 14:14:23 +0200 | [diff] [blame] | 391 | |
stefan | 5cb1982 | 2017-06-16 07:47:00 -0700 | [diff] [blame] | 392 | // 6 seconds since feedback, expect no increase. |
Stefan Holmer | 52200d0 | 2016-09-20 14:14:23 +0200 | [diff] [blame] | 393 | controller_->Process(); |
| 394 | EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
stefan | 5cb1982 | 2017-06-16 07:47:00 -0700 | [diff] [blame] | 395 | clock_.AdvanceTimeMilliseconds(9001); |
Stefan Holmer | 52200d0 | 2016-09-20 14:14:23 +0200 | [diff] [blame] | 396 | |
stefan | 5cb1982 | 2017-06-16 07:47:00 -0700 | [diff] [blame] | 397 | // More than 15 seconds since feedback, expect decrease. |
Stefan Holmer | 52200d0 | 2016-09-20 14:14:23 +0200 | [diff] [blame] | 398 | controller_->Process(); |
| 399 | expected_bitrate_bps *= 0.8; |
| 400 | EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
| 401 | clock_.AdvanceTimeMilliseconds(500); |
| 402 | |
| 403 | // Only one timeout every second. |
| 404 | controller_->Process(); |
| 405 | EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
| 406 | clock_.AdvanceTimeMilliseconds(501); |
| 407 | |
| 408 | // New timeout allowed. |
| 409 | controller_->Process(); |
| 410 | expected_bitrate_bps *= 0.8; |
| 411 | EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | TEST_F(BitrateControllerTest, StopIncreaseWithoutPacketReports) { |
| 416 | int expected_bitrate_bps = 300000; |
| 417 | controller_->SetBitrates(300000, kDefaultMinBitrateBps, |
| 418 | kDefaultMaxBitrateBps); |
| 419 | |
| 420 | webrtc::ReportBlockList report_blocks; |
| 421 | report_blocks.push_back(CreateReportBlock(1, 2, 0, 1)); |
| 422 | bandwidth_observer_->OnReceivedRtcpReceiverReport( |
| 423 | report_blocks, 50, clock_.TimeInMilliseconds()); |
| 424 | EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
| 425 | clock_.AdvanceTimeMilliseconds(500); |
| 426 | |
| 427 | report_blocks.push_back(CreateReportBlock(1, 2, 0, 21)); |
| 428 | bandwidth_observer_->OnReceivedRtcpReceiverReport( |
| 429 | report_blocks, 50, clock_.TimeInMilliseconds()); |
| 430 | report_blocks.clear(); |
| 431 | expected_bitrate_bps = expected_bitrate_bps * 1.08 + 1000; |
| 432 | EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
| 433 | clock_.AdvanceTimeMilliseconds(1500); |
| 434 | |
| 435 | // 1.2 seconds without packets reported as received, no increase. |
| 436 | report_blocks.push_back(CreateReportBlock(1, 2, 0, 21)); |
| 437 | bandwidth_observer_->OnReceivedRtcpReceiverReport( |
| 438 | report_blocks, 50, clock_.TimeInMilliseconds()); |
| 439 | EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
| 440 | clock_.AdvanceTimeMilliseconds(1000); |
| 441 | |
| 442 | // 5 packets reported as received since last, too few, no increase. |
| 443 | report_blocks.push_back(CreateReportBlock(1, 2, 0, 26)); |
| 444 | bandwidth_observer_->OnReceivedRtcpReceiverReport( |
| 445 | report_blocks, 50, clock_.TimeInMilliseconds()); |
| 446 | report_blocks.clear(); |
| 447 | EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
| 448 | clock_.AdvanceTimeMilliseconds(100); |
| 449 | |
| 450 | // 15 packets reported as received since last, enough to increase. |
| 451 | report_blocks.push_back(CreateReportBlock(1, 2, 0, 41)); |
| 452 | bandwidth_observer_->OnReceivedRtcpReceiverReport( |
| 453 | report_blocks, 50, clock_.TimeInMilliseconds()); |
| 454 | expected_bitrate_bps = expected_bitrate_bps * 1.08 + 1000; |
| 455 | EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
| 456 | clock_.AdvanceTimeMilliseconds(1000); |
| 457 | } |