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

Side by Side Diff: webrtc/modules/bitrate_controller/bitrate_controller_unittest.cc

Issue 2378103005: Reland: Fix race / crash in OnNetworkRouteChanged(). (Closed)
Patch Set: . Created 4 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
OLDNEW
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 time_ms += 1000; 164 time_ms += 1000;
165 165
166 report_blocks.clear(); 166 report_blocks.clear();
167 report_blocks.push_back(CreateReportBlock(1, 2, 0, 141)); 167 report_blocks.push_back(CreateReportBlock(1, 2, 0, 141));
168 bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms); 168 bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms);
169 EXPECT_EQ(300000, bitrate_observer_.last_bitrate_); 169 EXPECT_EQ(300000, bitrate_observer_.last_bitrate_);
170 170
171 // Test that a low delay-based estimate limits the combined estimate. 171 // Test that a low delay-based estimate limits the combined estimate.
172 controller_->OnReceiveBitrateChanged({0}, 280000); 172 webrtc::DelayBasedBwe::Result result(false, 280000);
173 controller_->OnDelayBasedBweResult(result);
173 EXPECT_EQ(280000, bitrate_observer_.last_bitrate_); 174 EXPECT_EQ(280000, bitrate_observer_.last_bitrate_);
174 175
175 // Test that a low REMB limits the combined estimate. 176 // Test that a low REMB limits the combined estimate.
176 bandwidth_observer_->OnReceivedEstimatedBitrate(250000); 177 bandwidth_observer_->OnReceivedEstimatedBitrate(250000);
177 EXPECT_EQ(250000, bitrate_observer_.last_bitrate_); 178 EXPECT_EQ(250000, bitrate_observer_.last_bitrate_);
178 EXPECT_EQ(0, bitrate_observer_.last_fraction_loss_); 179 EXPECT_EQ(0, bitrate_observer_.last_fraction_loss_);
179 EXPECT_EQ(50, bitrate_observer_.last_rtt_); 180 EXPECT_EQ(50, bitrate_observer_.last_rtt_);
180 181
181 bandwidth_observer_->OnReceivedEstimatedBitrate(1000); 182 bandwidth_observer_->OnReceivedEstimatedBitrate(1000);
182 EXPECT_EQ(100000, bitrate_observer_.last_bitrate_); 183 EXPECT_EQ(100000, bitrate_observer_.last_bitrate_);
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 clock_.AdvanceTimeMilliseconds(100); 506 clock_.AdvanceTimeMilliseconds(100);
506 507
507 // 15 packets reported as received since last, enough to increase. 508 // 15 packets reported as received since last, enough to increase.
508 report_blocks.push_back(CreateReportBlock(1, 2, 0, 41)); 509 report_blocks.push_back(CreateReportBlock(1, 2, 0, 41));
509 bandwidth_observer_->OnReceivedRtcpReceiverReport( 510 bandwidth_observer_->OnReceivedRtcpReceiverReport(
510 report_blocks, 50, clock_.TimeInMilliseconds()); 511 report_blocks, 50, clock_.TimeInMilliseconds());
511 expected_bitrate_bps = expected_bitrate_bps * 1.08 + 1000; 512 expected_bitrate_bps = expected_bitrate_bps * 1.08 + 1000;
512 EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); 513 EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_);
513 clock_.AdvanceTimeMilliseconds(1000); 514 clock_.AdvanceTimeMilliseconds(1000);
514 } 515 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698