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

Side by Side Diff: webrtc/call/rampup_tests.cc

Issue 2708723003: Introduce new constructor to PlatformThread. (Closed)
Patch Set: Update IncomingVideoStream again Created 3 years, 10 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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 (*receive_configs)[0].transport_cc = true; 275 (*receive_configs)[0].transport_cc = true;
276 (*receive_configs)[0].rtp_header_extensions.push_back(RtpExtension( 276 (*receive_configs)[0].rtp_header_extensions.push_back(RtpExtension(
277 extension_type_.c_str(), kTransportSequenceNumberExtensionId)); 277 extension_type_.c_str(), kTransportSequenceNumberExtensionId));
278 } 278 }
279 } 279 }
280 280
281 void RampUpTester::OnCallsCreated(Call* sender_call, Call* receiver_call) { 281 void RampUpTester::OnCallsCreated(Call* sender_call, Call* receiver_call) {
282 sender_call_ = sender_call; 282 sender_call_ = sender_call;
283 } 283 }
284 284
285 bool RampUpTester::BitrateStatsPollingThread(void* obj) { 285 void RampUpTester::BitrateStatsPollingThread(void* obj) {
286 return static_cast<RampUpTester*>(obj)->PollStats(); 286 static_cast<RampUpTester*>(obj)->PollStats();
287 } 287 }
288 288
289 bool RampUpTester::PollStats() { 289 void RampUpTester::PollStats() {
290 if (sender_call_) { 290 do {
291 Call::Stats stats = sender_call_->GetStats(); 291 if (sender_call_) {
292 Call::Stats stats = sender_call_->GetStats();
292 293
293 EXPECT_GE(stats.send_bandwidth_bps, start_bitrate_bps_); 294 EXPECT_GE(stats.send_bandwidth_bps, start_bitrate_bps_);
294 EXPECT_GE(expected_bitrate_bps_, 0); 295 EXPECT_GE(expected_bitrate_bps_, 0);
295 if (stats.send_bandwidth_bps >= expected_bitrate_bps_ && 296 if (stats.send_bandwidth_bps >= expected_bitrate_bps_ &&
296 (min_run_time_ms_ == -1 || 297 (min_run_time_ms_ == -1 ||
297 clock_->TimeInMilliseconds() - test_start_ms_ >= min_run_time_ms_)) { 298 clock_->TimeInMilliseconds() - test_start_ms_ >= min_run_time_ms_)) {
298 ramp_up_finished_ms_ = clock_->TimeInMilliseconds(); 299 ramp_up_finished_ms_ = clock_->TimeInMilliseconds();
299 observation_complete_.Set(); 300 observation_complete_.Set();
301 }
300 } 302 }
301 } 303 } while (!event_.Wait(kPollIntervalMs));
the sun 2017/02/22 13:42:57 It looks like RampUpTester::PerformTest() intends
tommi 2017/02/22 15:04:01 Indeed! Thanks for catching. It turns out that th
the sun 2017/02/22 16:31:30 I looked at the other places in your CL, and they
302
303 return !event_.Wait(kPollIntervalMs);
304 } 304 }
305 305
306 void RampUpTester::ReportResult(const std::string& measurement, 306 void RampUpTester::ReportResult(const std::string& measurement,
307 size_t value, 307 size_t value,
308 const std::string& units) const { 308 const std::string& units) const {
309 webrtc::test::PrintResult( 309 webrtc::test::PrintResult(
310 measurement, "", 310 measurement, "",
311 ::testing::UnitTest::GetInstance()->current_test_info()->name(), value, 311 ::testing::UnitTest::GetInstance()->current_test_info()->name(), value,
312 units, false); 312 units, false);
313 } 313 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 interval_start_ms_(clock_->TimeInMilliseconds()), 408 interval_start_ms_(clock_->TimeInMilliseconds()),
409 sent_bytes_(0), 409 sent_bytes_(0),
410 loss_rates_(loss_rates) { 410 loss_rates_(loss_rates) {
411 forward_transport_config_.link_capacity_kbps = link_rates_[test_state_]; 411 forward_transport_config_.link_capacity_kbps = link_rates_[test_state_];
412 forward_transport_config_.queue_delay_ms = 100; 412 forward_transport_config_.queue_delay_ms = 100;
413 forward_transport_config_.loss_percent = loss_rates_[test_state_]; 413 forward_transport_config_.loss_percent = loss_rates_[test_state_];
414 } 414 }
415 415
416 RampUpDownUpTester::~RampUpDownUpTester() {} 416 RampUpDownUpTester::~RampUpDownUpTester() {}
417 417
418 bool RampUpDownUpTester::PollStats() { 418 void RampUpDownUpTester::PollStats() {
the sun 2017/02/22 13:42:58 oh, crikey, PollStats is overloaded...
tommi 2017/02/22 15:04:01 Acknowledged.
419 if (send_stream_) { 419 do {
420 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats(); 420 if (send_stream_) {
421 int transmit_bitrate_bps = 0; 421 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats();
422 for (auto it : stats.substreams) { 422 int transmit_bitrate_bps = 0;
423 transmit_bitrate_bps += it.second.total_bitrate_bps; 423 for (auto it : stats.substreams) {
424 transmit_bitrate_bps += it.second.total_bitrate_bps;
425 }
426 EvolveTestState(transmit_bitrate_bps, stats.suspended);
427 } else if (num_audio_streams_ > 0 && sender_call_ != nullptr) {
428 // An audio send stream doesn't have bitrate stats, so the call send BW is
429 // currently used instead.
430 int transmit_bitrate_bps = sender_call_->GetStats().send_bandwidth_bps;
431 EvolveTestState(transmit_bitrate_bps, false);
424 } 432 }
425 EvolveTestState(transmit_bitrate_bps, stats.suspended); 433 } while (!event_.Wait(kPollIntervalMs));
426 } else if (num_audio_streams_ > 0 && sender_call_ != nullptr) {
427 // An audio send stream doesn't have bitrate stats, so the call send BW is
428 // currently used instead.
429 int transmit_bitrate_bps = sender_call_->GetStats().send_bandwidth_bps;
430 EvolveTestState(transmit_bitrate_bps, false);
431 }
432
433 return !event_.Wait(kPollIntervalMs);
434 } 434 }
435 435
436 Call::Config RampUpDownUpTester::GetReceiverCallConfig() { 436 Call::Config RampUpDownUpTester::GetReceiverCallConfig() {
437 Call::Config config(&event_log_); 437 Call::Config config(&event_log_);
438 config.bitrate_config.min_bitrate_bps = 10000; 438 config.bitrate_config.min_bitrate_bps = 10000;
439 return config; 439 return config;
440 } 440 }
441 441
442 std::string RampUpDownUpTester::GetModifierString() const { 442 std::string RampUpDownUpTester::GetModifierString() const {
443 std::string str("_"); 443 std::string str("_");
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 RunBaseTest(&test); 639 RunBaseTest(&test);
640 } 640 }
641 641
642 TEST_F(RampUpTest, AudioTransportSequenceNumber) { 642 TEST_F(RampUpTest, AudioTransportSequenceNumber) {
643 RampUpTester test(0, 1, 0, 300000, 10000, 643 RampUpTester test(0, 1, 0, 300000, 10000,
644 RtpExtension::kTransportSequenceNumberUri, false, false, 644 RtpExtension::kTransportSequenceNumberUri, false, false,
645 false); 645 false);
646 RunBaseTest(&test); 646 RunBaseTest(&test);
647 } 647 }
648 } // namespace webrtc 648 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698