| 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/platform_thread.h" | 14 #include "webrtc/base/platform_thread.h" |
| 15 #include "webrtc/test/encoder_settings.h" |
| 15 #include "webrtc/test/gtest.h" | 16 #include "webrtc/test/gtest.h" |
| 16 #include "webrtc/test/testsupport/perf_test.h" | 17 #include "webrtc/test/testsupport/perf_test.h" |
| 17 | 18 |
| 18 namespace webrtc { | 19 namespace webrtc { |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 static const int64_t kPollIntervalMs = 20; | 22 static const int64_t kPollIntervalMs = 20; |
| 22 | 23 |
| 23 std::vector<uint32_t> GenerateSsrcs(size_t num_streams, uint32_t ssrc_offset) { | 24 std::vector<uint32_t> GenerateSsrcs(size_t num_streams, uint32_t ssrc_offset) { |
| 24 std::vector<uint32_t> ssrcs; | 25 std::vector<uint32_t> ssrcs; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 90 } |
| 90 | 91 |
| 91 size_t RampUpTester::GetNumVideoStreams() const { | 92 size_t RampUpTester::GetNumVideoStreams() const { |
| 92 return num_video_streams_; | 93 return num_video_streams_; |
| 93 } | 94 } |
| 94 | 95 |
| 95 size_t RampUpTester::GetNumAudioStreams() const { | 96 size_t RampUpTester::GetNumAudioStreams() const { |
| 96 return num_audio_streams_; | 97 return num_audio_streams_; |
| 97 } | 98 } |
| 98 | 99 |
| 100 class RampUpTester::VideoStreamFactory |
| 101 : public VideoEncoderConfig::VideoStreamFactoryInterface { |
| 102 public: |
| 103 VideoStreamFactory() {} |
| 104 |
| 105 private: |
| 106 std::vector<VideoStream> CreateEncoderStreams( |
| 107 int width, |
| 108 int height, |
| 109 const VideoEncoderConfig& encoder_config) override { |
| 110 std::vector<VideoStream> streams = |
| 111 test::CreateVideoStreams(width, height, encoder_config); |
| 112 if (encoder_config.number_of_streams == 1) { |
| 113 streams[0].target_bitrate_bps = streams[0].max_bitrate_bps = 2000000; |
| 114 } |
| 115 return streams; |
| 116 } |
| 117 }; |
| 118 |
| 99 void RampUpTester::ModifyVideoConfigs( | 119 void RampUpTester::ModifyVideoConfigs( |
| 100 VideoSendStream::Config* send_config, | 120 VideoSendStream::Config* send_config, |
| 101 std::vector<VideoReceiveStream::Config>* receive_configs, | 121 std::vector<VideoReceiveStream::Config>* receive_configs, |
| 102 VideoEncoderConfig* encoder_config) { | 122 VideoEncoderConfig* encoder_config) { |
| 103 send_config->suspend_below_min_bitrate = true; | 123 send_config->suspend_below_min_bitrate = true; |
| 104 | 124 encoder_config->number_of_streams = num_video_streams_; |
| 125 encoder_config->max_bitrate_bps = 2000000; |
| 126 encoder_config->video_stream_factory = |
| 127 new rtc::RefCountedObject<RampUpTester::VideoStreamFactory>(); |
| 105 if (num_video_streams_ == 1) { | 128 if (num_video_streams_ == 1) { |
| 106 encoder_config->streams[0].target_bitrate_bps = | |
| 107 encoder_config->streams[0].max_bitrate_bps = 2000000; | |
| 108 // For single stream rampup until 1mbps | 129 // For single stream rampup until 1mbps |
| 109 expected_bitrate_bps_ = kSingleStreamTargetBps; | 130 expected_bitrate_bps_ = kSingleStreamTargetBps; |
| 110 } else { | 131 } else { |
| 111 // For multi stream rampup until all streams are being sent. That means | 132 // For multi stream rampup until all streams are being sent. That means |
| 112 // enough birate to send all the target streams plus the min bitrate of | 133 // enough bitrate to send all the target streams plus the min bitrate of |
| 113 // the last one. | 134 // the last one. |
| 114 expected_bitrate_bps_ = encoder_config->streams.back().min_bitrate_bps; | 135 std::vector<VideoStream> streams = test::CreateVideoStreams( |
| 115 for (size_t i = 0; i < encoder_config->streams.size() - 1; ++i) { | 136 test::CallTest::kDefaultWidth, test::CallTest::kDefaultHeight, |
| 116 expected_bitrate_bps_ += encoder_config->streams[i].target_bitrate_bps; | 137 *encoder_config); |
| 138 expected_bitrate_bps_ = streams.back().min_bitrate_bps; |
| 139 for (size_t i = 0; i < streams.size() - 1; ++i) { |
| 140 expected_bitrate_bps_ += streams[i].target_bitrate_bps; |
| 117 } | 141 } |
| 118 } | 142 } |
| 119 | 143 |
| 120 send_config->rtp.extensions.clear(); | 144 send_config->rtp.extensions.clear(); |
| 121 | 145 |
| 122 bool remb; | 146 bool remb; |
| 123 bool transport_cc; | 147 bool transport_cc; |
| 124 if (extension_type_ == RtpExtension::kAbsSendTimeUri) { | 148 if (extension_type_ == RtpExtension::kAbsSendTimeUri) { |
| 125 remb = true; | 149 remb = true; |
| 126 transport_cc = false; | 150 transport_cc = false; |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 true); | 620 true); |
| 597 RunBaseTest(&test); | 621 RunBaseTest(&test); |
| 598 } | 622 } |
| 599 | 623 |
| 600 TEST_F(RampUpTest, TransportSequenceNumberSingleStreamWithHighStartBitrate) { | 624 TEST_F(RampUpTest, TransportSequenceNumberSingleStreamWithHighStartBitrate) { |
| 601 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps, | 625 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps, |
| 602 RtpExtension::kTransportSequenceNumberUri, false, false); | 626 RtpExtension::kTransportSequenceNumberUri, false, false); |
| 603 RunBaseTest(&test); | 627 RunBaseTest(&test); |
| 604 } | 628 } |
| 605 } // namespace webrtc | 629 } // namespace webrtc |
| OLD | NEW |