OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 rtcp::SenderReport sender_report; | 146 rtcp::SenderReport sender_report; |
147 sender_report.SetSenderSsrc(prng->Rand<uint32_t>()); | 147 sender_report.SetSenderSsrc(prng->Rand<uint32_t>()); |
148 sender_report.SetNtp(NtpTime(prng->Rand<uint32_t>(), prng->Rand<uint32_t>())); | 148 sender_report.SetNtp(NtpTime(prng->Rand<uint32_t>(), prng->Rand<uint32_t>())); |
149 sender_report.SetPacketCount(prng->Rand<uint32_t>()); | 149 sender_report.SetPacketCount(prng->Rand<uint32_t>()); |
150 sender_report.AddReportBlock(report_block); | 150 sender_report.AddReportBlock(report_block); |
151 | 151 |
152 return sender_report.Build(); | 152 return sender_report.Build(); |
153 } | 153 } |
154 | 154 |
155 void GenerateVideoReceiveConfig(uint32_t extensions_bitvector, | 155 void GenerateVideoReceiveConfig(uint32_t extensions_bitvector, |
156 VideoReceiveStream::Config* config, | 156 rtclog::StreamConfig* config, |
157 Random* prng) { | 157 Random* prng) { |
158 // Create a map from a payload type to an encoder name. | |
159 VideoReceiveStream::Decoder decoder; | |
160 decoder.payload_type = prng->Rand(0, 127); | |
161 decoder.payload_name = (prng->Rand<bool>() ? "VP8" : "H264"); | |
162 config->decoders.push_back(decoder); | |
163 // Add SSRCs for the stream. | 158 // Add SSRCs for the stream. |
164 config->rtp.remote_ssrc = prng->Rand<uint32_t>(); | 159 config->remote_ssrc = prng->Rand<uint32_t>(); |
165 config->rtp.local_ssrc = prng->Rand<uint32_t>(); | 160 config->local_ssrc = prng->Rand<uint32_t>(); |
166 // Add extensions and settings for RTCP. | 161 // Add extensions and settings for RTCP. |
167 config->rtp.rtcp_mode = | 162 config->rtcp_mode = |
168 prng->Rand<bool>() ? RtcpMode::kCompound : RtcpMode::kReducedSize; | 163 prng->Rand<bool>() ? RtcpMode::kCompound : RtcpMode::kReducedSize; |
169 config->rtp.remb = prng->Rand<bool>(); | 164 config->remb = prng->Rand<bool>(); |
170 config->rtp.rtx_ssrc = prng->Rand<uint32_t>(); | 165 config->rtx_ssrc = prng->Rand<uint32_t>(); |
171 // Add a map from a payload type to a new payload type for RTX. | 166 config->codecs.emplace_back(prng->Rand<bool>() ? "VP8" : "H264", |
172 config->rtp.rtx_payload_types.insert( | 167 prng->Rand(1, 127), prng->Rand(1, 127)); |
173 std::make_pair(prng->Rand(0, 127), prng->Rand(0, 127))); | |
174 // Add header extensions. | 168 // Add header extensions. |
175 for (unsigned i = 0; i < kNumExtensions; i++) { | 169 for (unsigned i = 0; i < kNumExtensions; i++) { |
176 if (extensions_bitvector & (1u << i)) { | 170 if (extensions_bitvector & (1u << i)) { |
177 config->rtp.extensions.push_back( | 171 config->rtp_extensions.emplace_back(kExtensionNames[i], |
178 RtpExtension(kExtensionNames[i], prng->Rand<int>())); | 172 prng->Rand<int>()); |
179 } | 173 } |
180 } | 174 } |
181 } | 175 } |
182 | 176 |
183 void GenerateVideoSendConfig(uint32_t extensions_bitvector, | 177 void GenerateVideoSendConfig(uint32_t extensions_bitvector, |
184 VideoSendStream::Config* config, | 178 VideoSendStream::Config* config, |
185 Random* prng) { | 179 Random* prng) { |
186 // Create a map from a payload type to an encoder name. | 180 // Create a map from a payload type to an encoder name. |
187 config->encoder_settings.payload_type = prng->Rand(0, 127); | 181 config->encoder_settings.payload_type = prng->Rand(0, 127); |
188 config->encoder_settings.payload_name = (prng->Rand<bool>() ? "VP8" : "H264"); | 182 config->encoder_settings.payload_name = (prng->Rand<bool>() ? "VP8" : "H264"); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 uint32_t csrcs_count, | 245 uint32_t csrcs_count, |
252 unsigned int random_seed) { | 246 unsigned int random_seed) { |
253 ASSERT_LE(rtcp_count, rtp_count); | 247 ASSERT_LE(rtcp_count, rtp_count); |
254 ASSERT_LE(playout_count, rtp_count); | 248 ASSERT_LE(playout_count, rtp_count); |
255 ASSERT_LE(bwe_loss_count, rtp_count); | 249 ASSERT_LE(bwe_loss_count, rtp_count); |
256 std::vector<RtpPacketToSend> rtp_packets; | 250 std::vector<RtpPacketToSend> rtp_packets; |
257 std::vector<rtc::Buffer> rtcp_packets; | 251 std::vector<rtc::Buffer> rtcp_packets; |
258 std::vector<uint32_t> playout_ssrcs; | 252 std::vector<uint32_t> playout_ssrcs; |
259 std::vector<std::pair<int32_t, uint8_t> > bwe_loss_updates; | 253 std::vector<std::pair<int32_t, uint8_t> > bwe_loss_updates; |
260 | 254 |
261 VideoReceiveStream::Config receiver_config(nullptr); | 255 rtclog::StreamConfig receiver_config; |
262 VideoSendStream::Config sender_config(nullptr); | 256 VideoSendStream::Config sender_config(nullptr); |
263 | 257 |
264 Random prng(random_seed); | 258 Random prng(random_seed); |
265 | 259 |
266 // Initialize rtp header extensions to be used in generated rtp packets. | 260 // Initialize rtp header extensions to be used in generated rtp packets. |
267 RtpHeaderExtensionMap extensions; | 261 RtpHeaderExtensionMap extensions; |
268 for (unsigned i = 0; i < kNumExtensions; i++) { | 262 for (unsigned i = 0; i < kNumExtensions; i++) { |
269 if (extensions_bitvector & (1u << i)) { | 263 if (extensions_bitvector & (1u << i)) { |
270 extensions.Register(kExtensionTypes[i], i + 1); | 264 extensions.Register(kExtensionTypes[i], i + 1); |
271 } | 265 } |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 void VerifyConfig(const ParsedRtcEventLog& parsed_log, | 802 void VerifyConfig(const ParsedRtcEventLog& parsed_log, |
809 size_t index) override { | 803 size_t index) override { |
810 RtcEventLogTestHelper::VerifyAudioSendStreamConfig(parsed_log, index, | 804 RtcEventLogTestHelper::VerifyAudioSendStreamConfig(parsed_log, index, |
811 config); | 805 config); |
812 } | 806 } |
813 AudioSendStream::Config config; | 807 AudioSendStream::Config config; |
814 }; | 808 }; |
815 | 809 |
816 class VideoReceiveConfigReadWriteTest : public ConfigReadWriteTest { | 810 class VideoReceiveConfigReadWriteTest : public ConfigReadWriteTest { |
817 public: | 811 public: |
818 VideoReceiveConfigReadWriteTest() : config(nullptr) {} | 812 VideoReceiveConfigReadWriteTest() {} |
819 void GenerateConfig(uint32_t extensions_bitvector) override { | 813 void GenerateConfig(uint32_t extensions_bitvector) override { |
820 GenerateVideoReceiveConfig(extensions_bitvector, &config, &prng); | 814 GenerateVideoReceiveConfig(extensions_bitvector, &config, &prng); |
821 } | 815 } |
822 void LogConfig(RtcEventLog* event_log) override { | 816 void LogConfig(RtcEventLog* event_log) override { |
823 event_log->LogVideoReceiveStreamConfig(config); | 817 event_log->LogVideoReceiveStreamConfig(config); |
824 } | 818 } |
825 void VerifyConfig(const ParsedRtcEventLog& parsed_log, | 819 void VerifyConfig(const ParsedRtcEventLog& parsed_log, |
826 size_t index) override { | 820 size_t index) override { |
827 RtcEventLogTestHelper::VerifyVideoReceiveStreamConfig(parsed_log, index, | 821 RtcEventLogTestHelper::VerifyVideoReceiveStreamConfig(parsed_log, index, |
828 config); | 822 config); |
829 } | 823 } |
830 VideoReceiveStream::Config config; | 824 rtclog::StreamConfig config; |
831 }; | 825 }; |
832 | 826 |
833 class VideoSendConfigReadWriteTest : public ConfigReadWriteTest { | 827 class VideoSendConfigReadWriteTest : public ConfigReadWriteTest { |
834 public: | 828 public: |
835 VideoSendConfigReadWriteTest() : config(nullptr) {} | 829 VideoSendConfigReadWriteTest() : config(nullptr) {} |
836 void GenerateConfig(uint32_t extensions_bitvector) override { | 830 void GenerateConfig(uint32_t extensions_bitvector) override { |
837 GenerateVideoSendConfig(extensions_bitvector, &config, &prng); | 831 GenerateVideoSendConfig(extensions_bitvector, &config, &prng); |
838 } | 832 } |
839 void LogConfig(RtcEventLog* event_log) override { | 833 void LogConfig(RtcEventLog* event_log) override { |
840 event_log->LogVideoSendStreamConfig(config); | 834 event_log->LogVideoSendStreamConfig(config); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 VideoSendConfigReadWriteTest test; | 876 VideoSendConfigReadWriteTest test; |
883 test.DoTest(); | 877 test.DoTest(); |
884 } | 878 } |
885 | 879 |
886 TEST(RtcEventLogTest, LogAudioNetworkAdaptation) { | 880 TEST(RtcEventLogTest, LogAudioNetworkAdaptation) { |
887 AudioNetworkAdaptationReadWriteTest test; | 881 AudioNetworkAdaptationReadWriteTest test; |
888 test.DoTest(); | 882 test.DoTest(); |
889 } | 883 } |
890 | 884 |
891 } // namespace webrtc | 885 } // namespace webrtc |
OLD | NEW |