Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 18 matching lines...) Expand all Loading... | |
| 29 std::vector<uint32_t> ssrcs; | 29 std::vector<uint32_t> ssrcs; |
| 30 for (size_t i = 0; i != num_streams; ++i) | 30 for (size_t i = 0; i != num_streams; ++i) |
| 31 ssrcs.push_back(static_cast<uint32_t>(ssrc_offset + i)); | 31 ssrcs.push_back(static_cast<uint32_t>(ssrc_offset + i)); |
| 32 return ssrcs; | 32 return ssrcs; |
| 33 } | 33 } |
| 34 } // namespace | 34 } // namespace |
| 35 | 35 |
| 36 RampUpTester::RampUpTester(size_t num_video_streams, | 36 RampUpTester::RampUpTester(size_t num_video_streams, |
| 37 size_t num_audio_streams, | 37 size_t num_audio_streams, |
| 38 unsigned int start_bitrate_bps, | 38 unsigned int start_bitrate_bps, |
| 39 int64_t min_run_time_ms, | |
| 39 const std::string& extension_type, | 40 const std::string& extension_type, |
| 40 bool rtx, | 41 bool rtx, |
| 41 bool red) | 42 bool red, |
| 43 bool report_perf_stats) | |
| 42 : EndToEndTest(test::CallTest::kLongTimeoutMs), | 44 : EndToEndTest(test::CallTest::kLongTimeoutMs), |
| 43 event_(false, false), | 45 event_(false, false), |
| 44 clock_(Clock::GetRealTimeClock()), | 46 clock_(Clock::GetRealTimeClock()), |
| 45 num_video_streams_(num_video_streams), | 47 num_video_streams_(num_video_streams), |
| 46 num_audio_streams_(num_audio_streams), | 48 num_audio_streams_(num_audio_streams), |
| 47 rtx_(rtx), | 49 rtx_(rtx), |
| 48 red_(red), | 50 red_(red), |
| 49 sender_call_(nullptr), | 51 sender_call_(nullptr), |
| 50 send_stream_(nullptr), | 52 send_stream_(nullptr), |
| 51 start_bitrate_bps_(start_bitrate_bps), | 53 start_bitrate_bps_(start_bitrate_bps), |
| 52 start_bitrate_verified_(false), | 54 min_run_time_ms_(min_run_time_ms), |
| 55 report_perf_stats_(report_perf_stats), | |
| 53 expected_bitrate_bps_(0), | 56 expected_bitrate_bps_(0), |
| 54 test_start_ms_(-1), | 57 test_start_ms_(-1), |
| 55 ramp_up_finished_ms_(-1), | 58 ramp_up_finished_ms_(-1), |
| 56 extension_type_(extension_type), | 59 extension_type_(extension_type), |
| 57 video_ssrcs_(GenerateSsrcs(num_video_streams_, 100)), | 60 video_ssrcs_(GenerateSsrcs(num_video_streams_, 100)), |
| 58 video_rtx_ssrcs_(GenerateSsrcs(num_video_streams_, 200)), | 61 video_rtx_ssrcs_(GenerateSsrcs(num_video_streams_, 200)), |
| 59 audio_ssrcs_(GenerateSsrcs(num_audio_streams_, 300)), | 62 audio_ssrcs_(GenerateSsrcs(num_audio_streams_, 300)), |
| 60 poller_thread_(&BitrateStatsPollingThread, | 63 poller_thread_(&BitrateStatsPollingThread, |
| 61 this, | 64 this, |
| 62 "BitrateStatsPollingThread") { | 65 "BitrateStatsPollingThread") { |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 } | 249 } |
| 247 | 250 |
| 248 bool RampUpTester::BitrateStatsPollingThread(void* obj) { | 251 bool RampUpTester::BitrateStatsPollingThread(void* obj) { |
| 249 return static_cast<RampUpTester*>(obj)->PollStats(); | 252 return static_cast<RampUpTester*>(obj)->PollStats(); |
| 250 } | 253 } |
| 251 | 254 |
| 252 bool RampUpTester::PollStats() { | 255 bool RampUpTester::PollStats() { |
| 253 if (sender_call_) { | 256 if (sender_call_) { |
| 254 Call::Stats stats = sender_call_->GetStats(); | 257 Call::Stats stats = sender_call_->GetStats(); |
| 255 | 258 |
| 256 RTC_DCHECK_GT(expected_bitrate_bps_, 0); | 259 EXPECT_GE(stats.send_bandwidth_bps, start_bitrate_bps_); |
| 257 if (!start_bitrate_verified_ && start_bitrate_bps_ != 0) { | 260 EXPECT_GE(expected_bitrate_bps_, 0); |
| 258 // For tests with an explicitly set start bitrate, verify the first | 261 if (stats.send_bandwidth_bps >= expected_bitrate_bps_ && |
| 259 // bitrate estimate is close to the start bitrate and lower than the | 262 (min_run_time_ms_ == -1 || |
|
terelius
2017/01/24 16:05:52
Is min_run_time__= -1 used to signal that there is
stefan-webrtc
2017/01/24 16:29:43
Right, I can change it to zero.
| |
| 260 // test target bitrate. This is to verify a call respects the configured | 263 clock_->TimeInMilliseconds() - test_start_ms_ >= min_run_time_ms_)) { |
| 261 // start bitrate, but due to the BWE implementation we can't guarantee the | |
| 262 // first estimate really is as high as the start bitrate. | |
| 263 EXPECT_GT(stats.send_bandwidth_bps, 0.9 * start_bitrate_bps_); | |
| 264 start_bitrate_verified_ = true; | |
| 265 } | |
| 266 if (stats.send_bandwidth_bps >= expected_bitrate_bps_) { | |
| 267 ramp_up_finished_ms_ = clock_->TimeInMilliseconds(); | 264 ramp_up_finished_ms_ = clock_->TimeInMilliseconds(); |
| 268 observation_complete_.Set(); | 265 observation_complete_.Set(); |
| 269 } | 266 } |
| 270 } | 267 } |
| 271 | 268 |
| 272 return !event_.Wait(kPollIntervalMs); | 269 return !event_.Wait(kPollIntervalMs); |
| 273 } | 270 } |
| 274 | 271 |
| 275 void RampUpTester::ReportResult(const std::string& measurement, | 272 void RampUpTester::ReportResult(const std::string& measurement, |
| 276 size_t value, | 273 size_t value, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 318 | 315 |
| 319 size_t rtx_total_packets_sent = 0; | 316 size_t rtx_total_packets_sent = 0; |
| 320 size_t rtx_total_sent = 0; | 317 size_t rtx_total_sent = 0; |
| 321 size_t rtx_padding_sent = 0; | 318 size_t rtx_padding_sent = 0; |
| 322 size_t rtx_media_sent = 0; | 319 size_t rtx_media_sent = 0; |
| 323 for (uint32_t rtx_ssrc : video_rtx_ssrcs_) { | 320 for (uint32_t rtx_ssrc : video_rtx_ssrcs_) { |
| 324 AccumulateStats(send_stats.substreams[rtx_ssrc], &rtx_total_packets_sent, | 321 AccumulateStats(send_stats.substreams[rtx_ssrc], &rtx_total_packets_sent, |
| 325 &rtx_total_sent, &rtx_padding_sent, &rtx_media_sent); | 322 &rtx_total_sent, &rtx_padding_sent, &rtx_media_sent); |
| 326 } | 323 } |
| 327 | 324 |
| 328 ReportResult("ramp-up-total-packets-sent", total_packets_sent, "packets"); | 325 if (report_perf_stats_) { |
| 329 ReportResult("ramp-up-total-sent", total_sent, "bytes"); | 326 ReportResult("ramp-up-total-packets-sent", total_packets_sent, "packets"); |
| 330 ReportResult("ramp-up-media-sent", media_sent, "bytes"); | 327 ReportResult("ramp-up-total-sent", total_sent, "bytes"); |
| 331 ReportResult("ramp-up-padding-sent", padding_sent, "bytes"); | 328 ReportResult("ramp-up-media-sent", media_sent, "bytes"); |
| 332 ReportResult("ramp-up-rtx-total-packets-sent", rtx_total_packets_sent, | 329 ReportResult("ramp-up-padding-sent", padding_sent, "bytes"); |
| 333 "packets"); | 330 ReportResult("ramp-up-rtx-total-packets-sent", rtx_total_packets_sent, |
| 334 ReportResult("ramp-up-rtx-total-sent", rtx_total_sent, "bytes"); | 331 "packets"); |
| 335 ReportResult("ramp-up-rtx-media-sent", rtx_media_sent, "bytes"); | 332 ReportResult("ramp-up-rtx-total-sent", rtx_total_sent, "bytes"); |
| 336 ReportResult("ramp-up-rtx-padding-sent", rtx_padding_sent, "bytes"); | 333 ReportResult("ramp-up-rtx-media-sent", rtx_media_sent, "bytes"); |
| 337 if (ramp_up_finished_ms_ >= 0) { | 334 ReportResult("ramp-up-rtx-padding-sent", rtx_padding_sent, "bytes"); |
| 338 ReportResult("ramp-up-time", ramp_up_finished_ms_ - test_start_ms_, | 335 if (ramp_up_finished_ms_ >= 0) { |
| 339 "milliseconds"); | 336 ReportResult("ramp-up-time", ramp_up_finished_ms_ - test_start_ms_, |
| 337 "milliseconds"); | |
| 338 } | |
| 339 ReportResult("ramp-up-average-network-latency", | |
| 340 send_transport_->GetAverageDelayMs(), "milliseconds"); | |
| 340 } | 341 } |
| 341 ReportResult("ramp-up-average-network-latency", | |
| 342 send_transport_->GetAverageDelayMs(), "milliseconds"); | |
| 343 } | 342 } |
| 344 | 343 |
| 345 void RampUpTester::PerformTest() { | 344 void RampUpTester::PerformTest() { |
| 346 test_start_ms_ = clock_->TimeInMilliseconds(); | 345 test_start_ms_ = clock_->TimeInMilliseconds(); |
| 347 poller_thread_.Start(); | 346 poller_thread_.Start(); |
| 348 EXPECT_TRUE(Wait()) << "Timed out while waiting for ramp-up to complete."; | 347 EXPECT_TRUE(Wait()) << "Timed out while waiting for ramp-up to complete."; |
| 349 TriggerTestDone(); | 348 TriggerTestDone(); |
| 350 poller_thread_.Stop(); | 349 poller_thread_.Stop(); |
| 351 } | 350 } |
| 352 | 351 |
| 353 RampUpDownUpTester::RampUpDownUpTester(size_t num_video_streams, | 352 RampUpDownUpTester::RampUpDownUpTester(size_t num_video_streams, |
| 354 size_t num_audio_streams, | 353 size_t num_audio_streams, |
| 355 unsigned int start_bitrate_bps, | 354 unsigned int start_bitrate_bps, |
| 356 const std::string& extension_type, | 355 const std::string& extension_type, |
| 357 bool rtx, | 356 bool rtx, |
| 358 bool red) | 357 bool red) |
| 359 : RampUpTester(num_video_streams, | 358 : RampUpTester(num_video_streams, |
| 360 num_audio_streams, | 359 num_audio_streams, |
| 361 start_bitrate_bps, | 360 start_bitrate_bps, |
| 361 -1, | |
| 362 extension_type, | 362 extension_type, |
| 363 rtx, | 363 rtx, |
| 364 red), | 364 red, |
| 365 true), | |
| 365 test_state_(kFirstRampup), | 366 test_state_(kFirstRampup), |
| 366 state_start_ms_(clock_->TimeInMilliseconds()), | 367 state_start_ms_(clock_->TimeInMilliseconds()), |
| 367 interval_start_ms_(clock_->TimeInMilliseconds()), | 368 interval_start_ms_(clock_->TimeInMilliseconds()), |
| 368 sent_bytes_(0) { | 369 sent_bytes_(0) { |
| 369 forward_transport_config_.link_capacity_kbps = GetHighLinkCapacity(); | 370 forward_transport_config_.link_capacity_kbps = GetHighLinkCapacity(); |
| 370 } | 371 } |
| 371 | 372 |
| 372 RampUpDownUpTester::~RampUpDownUpTester() {} | 373 RampUpDownUpTester::~RampUpDownUpTester() {} |
| 373 | 374 |
| 374 bool RampUpDownUpTester::PollStats() { | 375 bool RampUpDownUpTester::PollStats() { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 518 } | 519 } |
| 519 | 520 |
| 520 TEST_F(RampUpTest, UpDownUpAudioTransportSequenceNumberRtx) { | 521 TEST_F(RampUpTest, UpDownUpAudioTransportSequenceNumberRtx) { |
| 521 RampUpDownUpTester test(0, 1, kStartBitrateBps, | 522 RampUpDownUpTester test(0, 1, kStartBitrateBps, |
| 522 RtpExtension::kTransportSequenceNumberUri, true, | 523 RtpExtension::kTransportSequenceNumberUri, true, |
| 523 false); | 524 false); |
| 524 RunBaseTest(&test); | 525 RunBaseTest(&test); |
| 525 } | 526 } |
| 526 | 527 |
| 527 TEST_F(RampUpTest, TOffsetSimulcastRedRtx) { | 528 TEST_F(RampUpTest, TOffsetSimulcastRedRtx) { |
| 528 RampUpTester test(3, 0, 0, RtpExtension::kTimestampOffsetUri, true, true); | 529 RampUpTester test(3, 0, 0, -1, RtpExtension::kTimestampOffsetUri, true, true, |
| 530 true); | |
| 529 RunBaseTest(&test); | 531 RunBaseTest(&test); |
| 530 } | 532 } |
| 531 | 533 |
| 532 TEST_F(RampUpTest, AbsSendTime) { | 534 TEST_F(RampUpTest, AbsSendTime) { |
| 533 RampUpTester test(1, 0, 0, RtpExtension::kAbsSendTimeUri, false, false); | 535 RampUpTester test(1, 0, 0, -1, RtpExtension::kAbsSendTimeUri, false, false, |
| 536 true); | |
| 534 RunBaseTest(&test); | 537 RunBaseTest(&test); |
| 535 } | 538 } |
| 536 | 539 |
| 537 TEST_F(RampUpTest, AbsSendTimeSimulcastRedRtx) { | 540 TEST_F(RampUpTest, AbsSendTimeSimulcastRedRtx) { |
| 538 RampUpTester test(3, 0, 0, RtpExtension::kAbsSendTimeUri, true, true); | 541 RampUpTester test(3, 0, 0, -1, RtpExtension::kAbsSendTimeUri, true, true, |
| 542 true); | |
| 539 RunBaseTest(&test); | 543 RunBaseTest(&test); |
| 540 } | 544 } |
| 541 | 545 |
| 542 TEST_F(RampUpTest, TransportSequenceNumber) { | 546 TEST_F(RampUpTest, TransportSequenceNumber) { |
| 543 RampUpTester test(1, 0, 0, RtpExtension::kTransportSequenceNumberUri, false, | 547 RampUpTester test(1, 0, 0, -1, RtpExtension::kTransportSequenceNumberUri, |
| 544 false); | 548 false, false, true); |
| 545 RunBaseTest(&test); | 549 RunBaseTest(&test); |
| 546 } | 550 } |
| 547 | 551 |
| 548 TEST_F(RampUpTest, TransportSequenceNumberSimulcast) { | 552 TEST_F(RampUpTest, TransportSequenceNumberSimulcast) { |
| 549 RampUpTester test(3, 0, 0, RtpExtension::kTransportSequenceNumberUri, false, | 553 RampUpTester test(3, 0, 0, -1, RtpExtension::kTransportSequenceNumberUri, |
| 550 false); | 554 false, false, true); |
| 551 RunBaseTest(&test); | 555 RunBaseTest(&test); |
| 552 } | 556 } |
| 553 | 557 |
| 554 TEST_F(RampUpTest, TransportSequenceNumberSimulcastRedRtx) { | 558 TEST_F(RampUpTest, TransportSequenceNumberSimulcastRedRtx) { |
| 555 RampUpTester test(3, 0, 0, RtpExtension::kTransportSequenceNumberUri, true, | 559 RampUpTester test(3, 0, 0, -1, RtpExtension::kTransportSequenceNumberUri, |
| 556 true); | 560 true, true, true); |
| 561 RunBaseTest(&test); | |
| 562 } | |
| 563 | |
| 564 TEST_F(RampUpTest, AudioTransportSequenceNumber) { | |
| 565 RampUpTester test(0, 1, 300000, 10000, | |
| 566 RtpExtension::kTransportSequenceNumberUri, false, false, | |
| 567 false); | |
| 557 RunBaseTest(&test); | 568 RunBaseTest(&test); |
| 558 } | 569 } |
| 559 } // namespace webrtc | 570 } // namespace webrtc |
| OLD | NEW |