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 "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "webrtc/base/checks.h" | 14 #include "webrtc/base/checks.h" |
15 #include "webrtc/base/platform_thread.h" | 15 #include "webrtc/base/platform_thread.h" |
16 #include "webrtc/test/testsupport/perf_test.h" | 16 #include "webrtc/test/testsupport/perf_test.h" |
17 #include "webrtc/test/encoder_settings.h" | |
mflodman
2016/09/27 11:28:00
Alphabetic order.
perkj_webrtc
2016/09/27 13:45:17
Done.
| |
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; |
25 for (size_t i = 0; i != num_streams; ++i) | 26 for (size_t i = 0; i != num_streams; ++i) |
26 ssrcs.push_back(static_cast<uint32_t>(ssrc_offset + i)); | 27 ssrcs.push_back(static_cast<uint32_t>(ssrc_offset + i)); |
(...skipping 62 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 RTC_DCHECK_EQ(width, test::CallTest::kDefaultWidth); | |
111 RTC_DCHECK_EQ(height, test::CallTest::kDefaultHeight); | |
112 std::vector<VideoStream> streams = | |
113 test::CreateVideoStreams(width, height, encoder_config); | |
114 if (encoder_config.number_of_streams == 1) { | |
115 streams[0].target_bitrate_bps = streams[0].max_bitrate_bps = 2000000; | |
116 } | |
117 return streams; | |
118 } | |
119 }; | |
120 | |
99 void RampUpTester::ModifyVideoConfigs( | 121 void RampUpTester::ModifyVideoConfigs( |
100 VideoSendStream::Config* send_config, | 122 VideoSendStream::Config* send_config, |
101 std::vector<VideoReceiveStream::Config>* receive_configs, | 123 std::vector<VideoReceiveStream::Config>* receive_configs, |
102 VideoEncoderConfig* encoder_config) { | 124 VideoEncoderConfig* encoder_config) { |
103 send_config->suspend_below_min_bitrate = true; | 125 send_config->suspend_below_min_bitrate = true; |
104 | 126 encoder_config->number_of_streams = num_video_streams_; |
127 encoder_config->max_bitrate_bps = 2000000; | |
128 encoder_config->encoder_stream_factory = | |
129 new rtc::RefCountedObject<RampUpTester::VideoStreamFactory>(); | |
105 if (num_video_streams_ == 1) { | 130 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 | 131 // For single stream rampup until 1mbps |
109 expected_bitrate_bps_ = kSingleStreamTargetBps; | 132 expected_bitrate_bps_ = kSingleStreamTargetBps; |
110 } else { | 133 } else { |
111 // For multi stream rampup until all streams are being sent. That means | 134 // 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 | 135 // enough bitrate to send all the target streams plus the min bitrate of |
113 // the last one. | 136 // the last one. |
114 expected_bitrate_bps_ = encoder_config->streams.back().min_bitrate_bps; | 137 std::vector<VideoStream> streams = test::CreateVideoStreams( |
115 for (size_t i = 0; i < encoder_config->streams.size() - 1; ++i) { | 138 test::CallTest::kDefaultWidth, test::CallTest::kDefaultHeight, |
116 expected_bitrate_bps_ += encoder_config->streams[i].target_bitrate_bps; | 139 *encoder_config); |
140 expected_bitrate_bps_ = streams.back().min_bitrate_bps; | |
141 for (size_t i = 0; i < streams.size() - 1; ++i) { | |
142 expected_bitrate_bps_ += streams[i].target_bitrate_bps; | |
117 } | 143 } |
118 } | 144 } |
119 | 145 |
120 send_config->rtp.extensions.clear(); | 146 send_config->rtp.extensions.clear(); |
121 | 147 |
122 bool remb; | 148 bool remb; |
123 bool transport_cc; | 149 bool transport_cc; |
124 if (extension_type_ == RtpExtension::kAbsSendTimeUri) { | 150 if (extension_type_ == RtpExtension::kAbsSendTimeUri) { |
125 remb = true; | 151 remb = true; |
126 transport_cc = false; | 152 transport_cc = false; |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
596 true); | 622 true); |
597 RunBaseTest(&test); | 623 RunBaseTest(&test); |
598 } | 624 } |
599 | 625 |
600 TEST_F(RampUpTest, TransportSequenceNumberSingleStreamWithHighStartBitrate) { | 626 TEST_F(RampUpTest, TransportSequenceNumberSingleStreamWithHighStartBitrate) { |
601 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps, | 627 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps, |
602 RtpExtension::kTransportSequenceNumberUri, false, false); | 628 RtpExtension::kTransportSequenceNumberUri, false, false); |
603 RunBaseTest(&test); | 629 RunBaseTest(&test); |
604 } | 630 } |
605 } // namespace webrtc | 631 } // namespace webrtc |
OLD | NEW |