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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 bool report_perf_stats) | 390 bool report_perf_stats) |
390 : RampUpTester(num_video_streams, | 391 : RampUpTester(num_video_streams, |
391 num_audio_streams, | 392 num_audio_streams, |
392 num_flexfec_streams, | 393 num_flexfec_streams, |
393 start_bitrate_bps, | 394 start_bitrate_bps, |
394 0, | 395 0, |
395 extension_type, | 396 extension_type, |
396 rtx, | 397 rtx, |
397 red, | 398 red, |
398 report_perf_stats), | 399 report_perf_stats), |
399 link_rates_({GetHighLinkCapacity(), kLowBandwidthLimitBps / 1000, | 400 link_rates_({GetExpectedHighBitrate() / 1000, |
400 GetHighLinkCapacity(), 0}), | 401 kLowBandwidthLimitBps / 1000, kUnlimitedCapacityBps / 1000, |
| 402 0}), |
401 test_state_(kFirstRampup), | 403 test_state_(kFirstRampup), |
402 next_state_(kTransitionToNextState), | 404 next_state_(kTransitionToNextState), |
403 state_start_ms_(clock_->TimeInMilliseconds()), | 405 state_start_ms_(clock_->TimeInMilliseconds()), |
404 interval_start_ms_(clock_->TimeInMilliseconds()), | 406 interval_start_ms_(clock_->TimeInMilliseconds()), |
405 sent_bytes_(0), | 407 sent_bytes_(0), |
406 loss_rates_(loss_rates) { | 408 loss_rates_(loss_rates) { |
407 forward_transport_config_.link_capacity_kbps = link_rates_[test_state_]; | 409 forward_transport_config_.link_capacity_kbps = link_rates_[test_state_]; |
408 forward_transport_config_.queue_delay_ms = 100; | 410 forward_transport_config_.queue_delay_ms = 100; |
409 forward_transport_config_.loss_percent = loss_rates_[test_state_]; | 411 forward_transport_config_.loss_percent = loss_rates_[test_state_]; |
410 } | 412 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 | 462 |
461 int RampUpDownUpTester::GetExpectedHighBitrate() const { | 463 int RampUpDownUpTester::GetExpectedHighBitrate() const { |
462 int expected_bitrate_bps = 0; | 464 int expected_bitrate_bps = 0; |
463 if (num_audio_streams_ > 0) | 465 if (num_audio_streams_ > 0) |
464 expected_bitrate_bps += kExpectedHighAudioBitrateBps; | 466 expected_bitrate_bps += kExpectedHighAudioBitrateBps; |
465 if (num_video_streams_ > 0) | 467 if (num_video_streams_ > 0) |
466 expected_bitrate_bps += kExpectedHighVideoBitrateBps; | 468 expected_bitrate_bps += kExpectedHighVideoBitrateBps; |
467 return expected_bitrate_bps; | 469 return expected_bitrate_bps; |
468 } | 470 } |
469 | 471 |
470 int RampUpDownUpTester::GetHighLinkCapacity() const { | |
471 return 4 * GetExpectedHighBitrate() / (3 * 1000); | |
472 } | |
473 | |
474 size_t RampUpDownUpTester::GetFecBytes() const { | 472 size_t RampUpDownUpTester::GetFecBytes() const { |
475 size_t flex_fec_bytes = 0; | 473 size_t flex_fec_bytes = 0; |
476 if (num_flexfec_streams_ > 0) { | 474 if (num_flexfec_streams_ > 0) { |
477 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats(); | 475 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats(); |
478 for (const auto& kv : stats.substreams) | 476 for (const auto& kv : stats.substreams) |
479 flex_fec_bytes += kv.second.rtp_stats.fec.TotalBytes(); | 477 flex_fec_bytes += kv.second.rtp_stats.fec.TotalBytes(); |
480 } | 478 } |
481 return flex_fec_bytes; | 479 return flex_fec_bytes; |
482 } | 480 } |
483 | 481 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 RunBaseTest(&test); | 641 RunBaseTest(&test); |
644 } | 642 } |
645 | 643 |
646 TEST_F(RampUpTest, AudioTransportSequenceNumber) { | 644 TEST_F(RampUpTest, AudioTransportSequenceNumber) { |
647 RampUpTester test(0, 1, 0, 300000, 10000, | 645 RampUpTester test(0, 1, 0, 300000, 10000, |
648 RtpExtension::kTransportSequenceNumberUri, false, false, | 646 RtpExtension::kTransportSequenceNumberUri, false, false, |
649 false); | 647 false); |
650 RunBaseTest(&test); | 648 RunBaseTest(&test); |
651 } | 649 } |
652 } // namespace webrtc | 650 } // namespace webrtc |
OLD | NEW |