OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 report_blocks.push_back(CreateReportBlock(1, 2, 0, 101)); | 155 report_blocks.push_back(CreateReportBlock(1, 2, 0, 101)); |
156 bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); | 156 bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); |
157 EXPECT_EQ(300000, bitrate_observer_.last_bitrate_); | 157 EXPECT_EQ(300000, bitrate_observer_.last_bitrate_); |
158 time_ms += 1000; | 158 time_ms += 1000; |
159 | 159 |
160 report_blocks.clear(); | 160 report_blocks.clear(); |
161 report_blocks.push_back(CreateReportBlock(1, 2, 0, 141)); | 161 report_blocks.push_back(CreateReportBlock(1, 2, 0, 141)); |
162 bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); | 162 bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); |
163 EXPECT_EQ(300000, bitrate_observer_.last_bitrate_); | 163 EXPECT_EQ(300000, bitrate_observer_.last_bitrate_); |
164 | 164 |
165 // Test that a low REMB trigger immediately. | 165 // Test that a low delay-based estimate limits the combined estimate. |
| 166 controller_->UpdateDelayBasedEstimate(280000); |
| 167 EXPECT_EQ(280000, bitrate_observer_.last_bitrate_); |
| 168 |
| 169 // Test that a low REMB limits the combined estimate. |
166 bandwidth_observer_->OnReceivedEstimatedBitrate(250000); | 170 bandwidth_observer_->OnReceivedEstimatedBitrate(250000); |
167 EXPECT_EQ(250000, bitrate_observer_.last_bitrate_); | 171 EXPECT_EQ(250000, bitrate_observer_.last_bitrate_); |
168 EXPECT_EQ(0, bitrate_observer_.last_fraction_loss_); | 172 EXPECT_EQ(0, bitrate_observer_.last_fraction_loss_); |
169 EXPECT_EQ(50, bitrate_observer_.last_rtt_); | 173 EXPECT_EQ(50, bitrate_observer_.last_rtt_); |
170 | 174 |
171 bandwidth_observer_->OnReceivedEstimatedBitrate(1000); | 175 bandwidth_observer_->OnReceivedEstimatedBitrate(1000); |
172 EXPECT_EQ(100000, bitrate_observer_.last_bitrate_); // Min cap. | 176 EXPECT_EQ(100000, bitrate_observer_.last_bitrate_); |
173 } | 177 } |
174 | 178 |
175 TEST_F(BitrateControllerTest, OneBitrateObserverTwoRtcpObservers) { | 179 TEST_F(BitrateControllerTest, OneBitrateObserverTwoRtcpObservers) { |
176 // REMBs during the first 2 seconds apply immediately. | 180 // REMBs during the first 2 seconds apply immediately. |
177 int64_t time_ms = 1; | 181 int64_t time_ms = 1; |
178 webrtc::ReportBlockList report_blocks; | 182 webrtc::ReportBlockList report_blocks; |
179 report_blocks.push_back(CreateReportBlock(1, 2, 0, 1)); | 183 report_blocks.push_back(CreateReportBlock(1, 2, 0, 1)); |
180 bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); | 184 bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); |
181 report_blocks.clear(); | 185 report_blocks.clear(); |
182 time_ms += 500; | 186 time_ms += 500; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 EXPECT_EQ(120000, bitrate_observer_.last_bitrate_); | 392 EXPECT_EQ(120000, bitrate_observer_.last_bitrate_); |
389 controller_->SetReservedBitrate(50000); | 393 controller_->SetReservedBitrate(50000); |
390 bandwidth_observer_->OnReceivedEstimatedBitrate(120000); | 394 bandwidth_observer_->OnReceivedEstimatedBitrate(120000); |
391 // Limited by min bitrate. | 395 // Limited by min bitrate. |
392 EXPECT_EQ(100000, bitrate_observer_.last_bitrate_); | 396 EXPECT_EQ(100000, bitrate_observer_.last_bitrate_); |
393 | 397 |
394 controller_->SetReservedBitrate(10000); | 398 controller_->SetReservedBitrate(10000); |
395 bandwidth_observer_->OnReceivedEstimatedBitrate(1); | 399 bandwidth_observer_->OnReceivedEstimatedBitrate(1); |
396 EXPECT_EQ(100000, bitrate_observer_.last_bitrate_); | 400 EXPECT_EQ(100000, bitrate_observer_.last_bitrate_); |
397 } | 401 } |
OLD | NEW |