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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 config->rtp.ssrc = prng->Rand<uint32_t>(); | 221 config->rtp.ssrc = prng->Rand<uint32_t>(); |
222 // Add header extensions. | 222 // Add header extensions. |
223 for (unsigned i = 0; i < kNumExtensions; i++) { | 223 for (unsigned i = 0; i < kNumExtensions; i++) { |
224 if (extensions_bitvector & (1u << i)) { | 224 if (extensions_bitvector & (1u << i)) { |
225 config->rtp.extensions.push_back( | 225 config->rtp.extensions.push_back( |
226 RtpExtension(kExtensionNames[i], prng->Rand<int>())); | 226 RtpExtension(kExtensionNames[i], prng->Rand<int>())); |
227 } | 227 } |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 void GenerateAudioNetworkAdaptation( | |
232 uint32_t extensions_bitvector, | |
233 AudioNetworkAdaptor::EncoderRuntimeConfig* config, | |
234 Random* prng) { | |
235 config->bitrate_bps = rtc::Optional<int>(prng->Rand(0, 3000000)); | |
236 config->enable_fec = rtc::Optional<bool>(prng->Rand<bool>()); | |
237 config->enable_dtx = rtc::Optional<bool>(prng->Rand<bool>()); | |
238 config->frame_length_ms = rtc::Optional<int>(prng->Rand(10, 120)); | |
239 config->num_channels = rtc::Optional<size_t>(prng->Rand(1, 2)); | |
240 config->uplink_packet_loss_fraction = | |
241 rtc::Optional<float>(prng->Rand<float>()); | |
242 } | |
243 | |
244 // Test for the RtcEventLog class. Dumps some RTP packets and other events | 231 // Test for the RtcEventLog class. Dumps some RTP packets and other events |
245 // to disk, then reads them back to see if they match. | 232 // to disk, then reads them back to see if they match. |
246 void LogSessionAndReadBack(size_t rtp_count, | 233 void LogSessionAndReadBack(size_t rtp_count, |
247 size_t rtcp_count, | 234 size_t rtcp_count, |
248 size_t playout_count, | 235 size_t playout_count, |
249 size_t bwe_loss_count, | 236 size_t bwe_loss_count, |
250 uint32_t extensions_bitvector, | 237 uint32_t extensions_bitvector, |
251 uint32_t csrcs_count, | 238 uint32_t csrcs_count, |
252 unsigned int random_seed) { | 239 unsigned int random_seed) { |
253 ASSERT_LE(rtcp_count, rtp_count); | 240 ASSERT_LE(rtcp_count, rtp_count); |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 event_log->LogVideoSendStreamConfig(config); | 597 event_log->LogVideoSendStreamConfig(config); |
611 } | 598 } |
612 void VerifyConfig(const ParsedRtcEventLog& parsed_log, | 599 void VerifyConfig(const ParsedRtcEventLog& parsed_log, |
613 size_t index) override { | 600 size_t index) override { |
614 RtcEventLogTestHelper::VerifyVideoSendStreamConfig(parsed_log, index, | 601 RtcEventLogTestHelper::VerifyVideoSendStreamConfig(parsed_log, index, |
615 config); | 602 config); |
616 } | 603 } |
617 VideoSendStream::Config config; | 604 VideoSendStream::Config config; |
618 }; | 605 }; |
619 | 606 |
620 class AudioNetworkAdaptationReadWriteTest : public ConfigReadWriteTest { | |
621 public: | |
622 void GenerateConfig(uint32_t extensions_bitvector) override { | |
623 GenerateAudioNetworkAdaptation(extensions_bitvector, &config, &prng); | |
624 } | |
625 void LogConfig(RtcEventLog* event_log) override { | |
626 event_log->LogAudioNetworkAdaptation(config); | |
627 } | |
628 void VerifyConfig(const ParsedRtcEventLog& parsed_log, | |
629 size_t index) override { | |
630 RtcEventLogTestHelper::VerifyAudioNetworkAdaptation(parsed_log, index, | |
631 config); | |
632 } | |
633 AudioNetworkAdaptor::EncoderRuntimeConfig config; | |
634 }; | |
635 | |
636 TEST(RtcEventLogTest, LogAudioReceiveConfig) { | 607 TEST(RtcEventLogTest, LogAudioReceiveConfig) { |
637 AudioReceiveConfigReadWriteTest test; | 608 AudioReceiveConfigReadWriteTest test; |
638 test.DoTest(); | 609 test.DoTest(); |
639 } | 610 } |
640 | 611 |
641 TEST(RtcEventLogTest, LogAudioSendConfig) { | 612 TEST(RtcEventLogTest, LogAudioSendConfig) { |
642 AudioSendConfigReadWriteTest test; | 613 AudioSendConfigReadWriteTest test; |
643 test.DoTest(); | 614 test.DoTest(); |
644 } | 615 } |
645 | 616 |
646 TEST(RtcEventLogTest, LogVideoReceiveConfig) { | 617 TEST(RtcEventLogTest, LogVideoReceiveConfig) { |
647 VideoReceiveConfigReadWriteTest test; | 618 VideoReceiveConfigReadWriteTest test; |
648 test.DoTest(); | 619 test.DoTest(); |
649 } | 620 } |
650 | 621 |
651 TEST(RtcEventLogTest, LogVideoSendConfig) { | 622 TEST(RtcEventLogTest, LogVideoSendConfig) { |
652 VideoSendConfigReadWriteTest test; | 623 VideoSendConfigReadWriteTest test; |
653 test.DoTest(); | 624 test.DoTest(); |
654 } | 625 } |
655 | |
656 TEST(RtcEventLogTest, LogAudioNetworkAdaptation) { | |
657 AudioNetworkAdaptationReadWriteTest test; | |
658 test.DoTest(); | |
659 } | |
660 | |
661 } // namespace webrtc | 626 } // namespace webrtc |
OLD | NEW |