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

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

Issue 2708723003: Introduce new constructor to PlatformThread. (Closed)
Patch Set: Disable RTC_DCHECK in channel_proxy + add TODO 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
« no previous file with comments | « webrtc/call/rampup_tests.h ('k') | webrtc/common_video/include/incoming_video_stream.h » ('j') | 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) 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 26 matching lines...) Expand all
37 RampUpTester::RampUpTester(size_t num_video_streams, 37 RampUpTester::RampUpTester(size_t num_video_streams,
38 size_t num_audio_streams, 38 size_t num_audio_streams,
39 size_t num_flexfec_streams, 39 size_t num_flexfec_streams,
40 unsigned int start_bitrate_bps, 40 unsigned int start_bitrate_bps,
41 int64_t min_run_time_ms, 41 int64_t min_run_time_ms,
42 const std::string& extension_type, 42 const std::string& extension_type,
43 bool rtx, 43 bool rtx,
44 bool red, 44 bool red,
45 bool report_perf_stats) 45 bool report_perf_stats)
46 : EndToEndTest(test::CallTest::kLongTimeoutMs), 46 : EndToEndTest(test::CallTest::kLongTimeoutMs),
47 event_(false, false), 47 stop_event_(false, false),
48 clock_(Clock::GetRealTimeClock()), 48 clock_(Clock::GetRealTimeClock()),
49 num_video_streams_(num_video_streams), 49 num_video_streams_(num_video_streams),
50 num_audio_streams_(num_audio_streams), 50 num_audio_streams_(num_audio_streams),
51 num_flexfec_streams_(num_flexfec_streams), 51 num_flexfec_streams_(num_flexfec_streams),
52 rtx_(rtx), 52 rtx_(rtx),
53 red_(red), 53 red_(red),
54 sender_call_(nullptr), 54 sender_call_(nullptr),
55 send_stream_(nullptr), 55 send_stream_(nullptr),
56 start_bitrate_bps_(start_bitrate_bps), 56 start_bitrate_bps_(start_bitrate_bps),
57 min_run_time_ms_(min_run_time_ms), 57 min_run_time_ms_(min_run_time_ms),
58 report_perf_stats_(report_perf_stats), 58 report_perf_stats_(report_perf_stats),
59 expected_bitrate_bps_(0), 59 expected_bitrate_bps_(0),
60 test_start_ms_(-1), 60 test_start_ms_(-1),
61 ramp_up_finished_ms_(-1), 61 ramp_up_finished_ms_(-1),
62 extension_type_(extension_type), 62 extension_type_(extension_type),
63 video_ssrcs_(GenerateSsrcs(num_video_streams_, 100)), 63 video_ssrcs_(GenerateSsrcs(num_video_streams_, 100)),
64 video_rtx_ssrcs_(GenerateSsrcs(num_video_streams_, 200)), 64 video_rtx_ssrcs_(GenerateSsrcs(num_video_streams_, 200)),
65 audio_ssrcs_(GenerateSsrcs(num_audio_streams_, 300)), 65 audio_ssrcs_(GenerateSsrcs(num_audio_streams_, 300)),
66 poller_thread_(&BitrateStatsPollingThread, 66 poller_thread_(&BitrateStatsPollingThread,
67 this, 67 this,
68 "BitrateStatsPollingThread") { 68 "BitrateStatsPollingThread") {
69 if (red_) 69 if (red_)
70 EXPECT_EQ(0u, num_flexfec_streams_); 70 EXPECT_EQ(0u, num_flexfec_streams_);
71 EXPECT_LE(num_audio_streams_, 1u); 71 EXPECT_LE(num_audio_streams_, 1u);
72 } 72 }
73 73
74 RampUpTester::~RampUpTester() { 74 RampUpTester::~RampUpTester() {
75 event_.Set();
76 } 75 }
77 76
78 Call::Config RampUpTester::GetSenderCallConfig() { 77 Call::Config RampUpTester::GetSenderCallConfig() {
79 Call::Config call_config(&event_log_); 78 Call::Config call_config(&event_log_);
80 if (start_bitrate_bps_ != 0) { 79 if (start_bitrate_bps_ != 0) {
81 call_config.bitrate_config.start_bitrate_bps = start_bitrate_bps_; 80 call_config.bitrate_config.start_bitrate_bps = start_bitrate_bps_;
82 } 81 }
83 call_config.bitrate_config.min_bitrate_bps = 10000; 82 call_config.bitrate_config.min_bitrate_bps = 10000;
84 return call_config; 83 return call_config;
85 } 84 }
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 (*receive_configs)[0].transport_cc = true; 274 (*receive_configs)[0].transport_cc = true;
276 (*receive_configs)[0].rtp_header_extensions.push_back(RtpExtension( 275 (*receive_configs)[0].rtp_header_extensions.push_back(RtpExtension(
277 extension_type_.c_str(), kTransportSequenceNumberExtensionId)); 276 extension_type_.c_str(), kTransportSequenceNumberExtensionId));
278 } 277 }
279 } 278 }
280 279
281 void RampUpTester::OnCallsCreated(Call* sender_call, Call* receiver_call) { 280 void RampUpTester::OnCallsCreated(Call* sender_call, Call* receiver_call) {
282 sender_call_ = sender_call; 281 sender_call_ = sender_call;
283 } 282 }
284 283
285 bool RampUpTester::BitrateStatsPollingThread(void* obj) { 284 void RampUpTester::BitrateStatsPollingThread(void* obj) {
286 return static_cast<RampUpTester*>(obj)->PollStats(); 285 static_cast<RampUpTester*>(obj)->PollStats();
287 } 286 }
288 287
289 bool RampUpTester::PollStats() { 288 void RampUpTester::PollStats() {
290 if (sender_call_) { 289 do {
291 Call::Stats stats = sender_call_->GetStats(); 290 if (sender_call_) {
291 Call::Stats stats = sender_call_->GetStats();
292 292
293 EXPECT_GE(stats.send_bandwidth_bps, start_bitrate_bps_); 293 EXPECT_GE(stats.send_bandwidth_bps, start_bitrate_bps_);
294 EXPECT_GE(expected_bitrate_bps_, 0); 294 EXPECT_GE(expected_bitrate_bps_, 0);
295 if (stats.send_bandwidth_bps >= expected_bitrate_bps_ && 295 if (stats.send_bandwidth_bps >= expected_bitrate_bps_ &&
296 (min_run_time_ms_ == -1 || 296 (min_run_time_ms_ == -1 ||
297 clock_->TimeInMilliseconds() - test_start_ms_ >= min_run_time_ms_)) { 297 clock_->TimeInMilliseconds() - test_start_ms_ >= min_run_time_ms_)) {
298 ramp_up_finished_ms_ = clock_->TimeInMilliseconds(); 298 ramp_up_finished_ms_ = clock_->TimeInMilliseconds();
299 observation_complete_.Set(); 299 observation_complete_.Set();
300 }
300 } 301 }
301 } 302 } while (!stop_event_.Wait(kPollIntervalMs));
302
303 return !event_.Wait(kPollIntervalMs);
304 } 303 }
305 304
306 void RampUpTester::ReportResult(const std::string& measurement, 305 void RampUpTester::ReportResult(const std::string& measurement,
307 size_t value, 306 size_t value,
308 const std::string& units) const { 307 const std::string& units) const {
309 webrtc::test::PrintResult( 308 webrtc::test::PrintResult(
310 measurement, "", 309 measurement, "",
311 ::testing::UnitTest::GetInstance()->current_test_info()->name(), value, 310 ::testing::UnitTest::GetInstance()->current_test_info()->name(), value,
312 units, false); 311 units, false);
313 } 312 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 ReportResult("ramp-up-average-network-latency", 372 ReportResult("ramp-up-average-network-latency",
374 send_transport_->GetAverageDelayMs(), "milliseconds"); 373 send_transport_->GetAverageDelayMs(), "milliseconds");
375 } 374 }
376 } 375 }
377 376
378 void RampUpTester::PerformTest() { 377 void RampUpTester::PerformTest() {
379 test_start_ms_ = clock_->TimeInMilliseconds(); 378 test_start_ms_ = clock_->TimeInMilliseconds();
380 poller_thread_.Start(); 379 poller_thread_.Start();
381 EXPECT_TRUE(Wait()) << "Timed out while waiting for ramp-up to complete."; 380 EXPECT_TRUE(Wait()) << "Timed out while waiting for ramp-up to complete.";
382 TriggerTestDone(); 381 TriggerTestDone();
382 stop_event_.Set();
383 poller_thread_.Stop(); 383 poller_thread_.Stop();
384 } 384 }
385 385
386 RampUpDownUpTester::RampUpDownUpTester(size_t num_video_streams, 386 RampUpDownUpTester::RampUpDownUpTester(size_t num_video_streams,
387 size_t num_audio_streams, 387 size_t num_audio_streams,
388 size_t num_flexfec_streams, 388 size_t num_flexfec_streams,
389 unsigned int start_bitrate_bps, 389 unsigned int start_bitrate_bps,
390 const std::string& extension_type, 390 const std::string& extension_type,
391 bool rtx, 391 bool rtx,
392 bool red, 392 bool red,
(...skipping 15 matching lines...) Expand all
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() {
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 (!stop_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
« no previous file with comments | « webrtc/call/rampup_tests.h ('k') | webrtc/common_video/include/incoming_video_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698