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 |
| 11 #include "webrtc/call/rampup_tests.h" | 11 #include "webrtc/call/rampup_tests.h" |
| 12 | 12 |
| 13 #include "webrtc/base/checks.h" | 13 #include "webrtc/base/checks.h" |
| 14 #include "webrtc/base/logging.h" | 14 #include "webrtc/base/logging.h" |
| 15 #include "webrtc/base/platform_thread.h" | 15 #include "webrtc/base/platform_thread.h" |
| 16 #include "webrtc/test/encoder_settings.h" | 16 #include "webrtc/test/encoder_settings.h" |
| 17 #include "webrtc/test/gtest.h" | 17 #include "webrtc/test/gtest.h" |
| 18 #include "webrtc/test/testsupport/perf_test.h" | 18 #include "webrtc/test/testsupport/perf_test.h" |
| 19 | 19 |
| 20 namespace webrtc { | 20 namespace webrtc { |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 static const int64_t kPollIntervalMs = 20; | 23 static const int64_t kPollIntervalMs = 20; |
| 24 static const int kExpectedHighVideoBitrateBps = 80000; | 24 static const int kExpectedHighVideoBitrateBps = 80000; |
| 25 static const int kExpectedHighAudioBitrateBps = 30000; | 25 static const int kExpectedHighAudioBitrateBps = 30000; |
| 26 static const int kLowBandwidthLimitBps = 20000; | 26 static const int kLowBandwidthLimitBps = 20000; |
| 27 static const int kExpectedLowBitrateBps = 20000; | 27 static const int kExpectedLowBitrateBps = 20000; |
| 28 static const int kUnlimitedCapacityBps = 10000000; | |
| 28 | 29 |
| 29 std::vector<uint32_t> GenerateSsrcs(size_t num_streams, uint32_t ssrc_offset) { | 30 std::vector<uint32_t> GenerateSsrcs(size_t num_streams, uint32_t ssrc_offset) { |
| 30 std::vector<uint32_t> ssrcs; | 31 std::vector<uint32_t> ssrcs; |
| 31 for (size_t i = 0; i != num_streams; ++i) | 32 for (size_t i = 0; i != num_streams; ++i) |
| 32 ssrcs.push_back(static_cast<uint32_t>(ssrc_offset + i)); | 33 ssrcs.push_back(static_cast<uint32_t>(ssrc_offset + i)); |
| 33 return ssrcs; | 34 return ssrcs; |
| 34 } | 35 } |
| 35 } // namespace | 36 } // namespace |
| 36 | 37 |
| 37 RampUpTester::RampUpTester(size_t num_video_streams, | 38 RampUpTester::RampUpTester(size_t num_video_streams, |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 410 bool report_perf_stats) | 411 bool report_perf_stats) |
| 411 : RampUpTester(num_video_streams, | 412 : RampUpTester(num_video_streams, |
| 412 num_audio_streams, | 413 num_audio_streams, |
| 413 num_flexfec_streams, | 414 num_flexfec_streams, |
| 414 start_bitrate_bps, | 415 start_bitrate_bps, |
| 415 0, | 416 0, |
| 416 extension_type, | 417 extension_type, |
| 417 rtx, | 418 rtx, |
| 418 red, | 419 red, |
| 419 report_perf_stats), | 420 report_perf_stats), |
| 420 link_rates_({GetHighLinkCapacity(), kLowBandwidthLimitBps / 1000, | 421 link_rates_({GetExpectedHighBitrate() / 1000, |
| 421 GetHighLinkCapacity(), 0}), | 422 kLowBandwidthLimitBps / 1000, kUnlimitedCapacityBps / 1000, |
|
terelius
2017/03/31 11:07:21
Do we really want to use kUnlimitedCapacityBps in
stefan-webrtc
2017/03/31 13:28:44
Done.
| |
| 423 0}), | |
| 422 test_state_(kFirstRampup), | 424 test_state_(kFirstRampup), |
| 423 next_state_(kTransitionToNextState), | 425 next_state_(kTransitionToNextState), |
| 424 state_start_ms_(clock_->TimeInMilliseconds()), | 426 state_start_ms_(clock_->TimeInMilliseconds()), |
| 425 interval_start_ms_(clock_->TimeInMilliseconds()), | 427 interval_start_ms_(clock_->TimeInMilliseconds()), |
| 426 sent_bytes_(0), | 428 sent_bytes_(0), |
| 427 loss_rates_(loss_rates) { | 429 loss_rates_(loss_rates) { |
| 428 forward_transport_config_.link_capacity_kbps = link_rates_[test_state_]; | 430 forward_transport_config_.link_capacity_kbps = link_rates_[test_state_]; |
| 429 forward_transport_config_.queue_delay_ms = 100; | 431 forward_transport_config_.queue_delay_ms = 100; |
| 430 forward_transport_config_.loss_percent = loss_rates_[test_state_]; | 432 forward_transport_config_.loss_percent = loss_rates_[test_state_]; |
| 431 } | 433 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 481 | 483 |
| 482 int RampUpDownUpTester::GetExpectedHighBitrate() const { | 484 int RampUpDownUpTester::GetExpectedHighBitrate() const { |
| 483 int expected_bitrate_bps = 0; | 485 int expected_bitrate_bps = 0; |
| 484 if (num_audio_streams_ > 0) | 486 if (num_audio_streams_ > 0) |
| 485 expected_bitrate_bps += kExpectedHighAudioBitrateBps; | 487 expected_bitrate_bps += kExpectedHighAudioBitrateBps; |
| 486 if (num_video_streams_ > 0) | 488 if (num_video_streams_ > 0) |
| 487 expected_bitrate_bps += kExpectedHighVideoBitrateBps; | 489 expected_bitrate_bps += kExpectedHighVideoBitrateBps; |
| 488 return expected_bitrate_bps; | 490 return expected_bitrate_bps; |
| 489 } | 491 } |
| 490 | 492 |
| 491 int RampUpDownUpTester::GetHighLinkCapacity() const { | |
| 492 return 4 * GetExpectedHighBitrate() / (3 * 1000); | |
| 493 } | |
| 494 | |
| 495 size_t RampUpDownUpTester::GetFecBytes() const { | 493 size_t RampUpDownUpTester::GetFecBytes() const { |
| 496 size_t flex_fec_bytes = 0; | 494 size_t flex_fec_bytes = 0; |
| 497 if (num_flexfec_streams_ > 0) { | 495 if (num_flexfec_streams_ > 0) { |
| 498 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats(); | 496 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats(); |
| 499 for (const auto& kv : stats.substreams) | 497 for (const auto& kv : stats.substreams) |
| 500 flex_fec_bytes += kv.second.rtp_stats.fec.TotalBytes(); | 498 flex_fec_bytes += kv.second.rtp_stats.fec.TotalBytes(); |
| 501 } | 499 } |
| 502 return flex_fec_bytes; | 500 return flex_fec_bytes; |
| 503 } | 501 } |
| 504 | 502 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 664 RunBaseTest(&test); | 662 RunBaseTest(&test); |
| 665 } | 663 } |
| 666 | 664 |
| 667 TEST_F(RampUpTest, AudioTransportSequenceNumber) { | 665 TEST_F(RampUpTest, AudioTransportSequenceNumber) { |
| 668 RampUpTester test(0, 1, 0, 300000, 10000, | 666 RampUpTester test(0, 1, 0, 300000, 10000, |
| 669 RtpExtension::kTransportSequenceNumberUri, false, false, | 667 RtpExtension::kTransportSequenceNumberUri, false, false, |
| 670 false); | 668 false); |
| 671 RunBaseTest(&test); | 669 RunBaseTest(&test); |
| 672 } | 670 } |
| 673 } // namespace webrtc | 671 } // namespace webrtc |
| OLD | NEW |