| 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 |
| 231 // Test for the RtcEventLog class. Dumps some RTP packets and other events | 244 // Test for the RtcEventLog class. Dumps some RTP packets and other events |
| 232 // to disk, then reads them back to see if they match. | 245 // to disk, then reads them back to see if they match. |
| 233 void LogSessionAndReadBack(size_t rtp_count, | 246 void LogSessionAndReadBack(size_t rtp_count, |
| 234 size_t rtcp_count, | 247 size_t rtcp_count, |
| 235 size_t playout_count, | 248 size_t playout_count, |
| 236 size_t bwe_loss_count, | 249 size_t bwe_loss_count, |
| 237 uint32_t extensions_bitvector, | 250 uint32_t extensions_bitvector, |
| 238 uint32_t csrcs_count, | 251 uint32_t csrcs_count, |
| 239 unsigned int random_seed) { | 252 unsigned int random_seed) { |
| 240 ASSERT_LE(rtcp_count, rtp_count); | 253 ASSERT_LE(rtcp_count, rtp_count); |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 event_log->LogVideoSendStreamConfig(config); | 610 event_log->LogVideoSendStreamConfig(config); |
| 598 } | 611 } |
| 599 void VerifyConfig(const ParsedRtcEventLog& parsed_log, | 612 void VerifyConfig(const ParsedRtcEventLog& parsed_log, |
| 600 size_t index) override { | 613 size_t index) override { |
| 601 RtcEventLogTestHelper::VerifyVideoSendStreamConfig(parsed_log, index, | 614 RtcEventLogTestHelper::VerifyVideoSendStreamConfig(parsed_log, index, |
| 602 config); | 615 config); |
| 603 } | 616 } |
| 604 VideoSendStream::Config config; | 617 VideoSendStream::Config config; |
| 605 }; | 618 }; |
| 606 | 619 |
| 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 |
| 607 TEST(RtcEventLogTest, LogAudioReceiveConfig) { | 636 TEST(RtcEventLogTest, LogAudioReceiveConfig) { |
| 608 AudioReceiveConfigReadWriteTest test; | 637 AudioReceiveConfigReadWriteTest test; |
| 609 test.DoTest(); | 638 test.DoTest(); |
| 610 } | 639 } |
| 611 | 640 |
| 612 TEST(RtcEventLogTest, LogAudioSendConfig) { | 641 TEST(RtcEventLogTest, LogAudioSendConfig) { |
| 613 AudioSendConfigReadWriteTest test; | 642 AudioSendConfigReadWriteTest test; |
| 614 test.DoTest(); | 643 test.DoTest(); |
| 615 } | 644 } |
| 616 | 645 |
| 617 TEST(RtcEventLogTest, LogVideoReceiveConfig) { | 646 TEST(RtcEventLogTest, LogVideoReceiveConfig) { |
| 618 VideoReceiveConfigReadWriteTest test; | 647 VideoReceiveConfigReadWriteTest test; |
| 619 test.DoTest(); | 648 test.DoTest(); |
| 620 } | 649 } |
| 621 | 650 |
| 622 TEST(RtcEventLogTest, LogVideoSendConfig) { | 651 TEST(RtcEventLogTest, LogVideoSendConfig) { |
| 623 VideoSendConfigReadWriteTest test; | 652 VideoSendConfigReadWriteTest test; |
| 624 test.DoTest(); | 653 test.DoTest(); |
| 625 } | 654 } |
| 655 |
| 656 TEST(RtcEventLogTest, LogAudioNetworkAdaptation) { |
| 657 AudioNetworkAdaptationReadWriteTest test; |
| 658 test.DoTest(); |
| 659 } |
| 660 |
| 626 } // namespace webrtc | 661 } // namespace webrtc |
| OLD | NEW |