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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // Add header extensions. | 199 // Add header extensions. |
200 for (unsigned i = 0; i < kNumExtensions; i++) { | 200 for (unsigned i = 0; i < kNumExtensions; i++) { |
201 if (extensions_bitvector & (1u << i)) { | 201 if (extensions_bitvector & (1u << i)) { |
202 config->rtp_extensions.push_back( | 202 config->rtp_extensions.push_back( |
203 RtpExtension(kExtensionNames[i], prng->Rand<int>())); | 203 RtpExtension(kExtensionNames[i], prng->Rand<int>())); |
204 } | 204 } |
205 } | 205 } |
206 } | 206 } |
207 | 207 |
208 void GenerateAudioSendConfig(uint32_t extensions_bitvector, | 208 void GenerateAudioSendConfig(uint32_t extensions_bitvector, |
209 AudioSendStream::Config* config, | 209 rtclog::StreamConfig* config, |
210 Random* prng) { | 210 Random* prng) { |
211 // Add SSRC to the stream. | 211 // Add SSRC to the stream. |
212 config->rtp.ssrc = prng->Rand<uint32_t>(); | 212 config->local_ssrc = prng->Rand<uint32_t>(); |
213 // Add header extensions. | 213 // Add header extensions. |
214 for (unsigned i = 0; i < kNumExtensions; i++) { | 214 for (unsigned i = 0; i < kNumExtensions; i++) { |
215 if (extensions_bitvector & (1u << i)) { | 215 if (extensions_bitvector & (1u << i)) { |
216 config->rtp.extensions.push_back( | 216 config->rtp_extensions.push_back( |
217 RtpExtension(kExtensionNames[i], prng->Rand<int>())); | 217 RtpExtension(kExtensionNames[i], prng->Rand<int>())); |
218 } | 218 } |
219 } | 219 } |
220 } | 220 } |
221 | 221 |
222 void GenerateAudioNetworkAdaptation(uint32_t extensions_bitvector, | 222 void GenerateAudioNetworkAdaptation(uint32_t extensions_bitvector, |
223 AudioEncoderRuntimeConfig* config, | 223 AudioEncoderRuntimeConfig* config, |
224 Random* prng) { | 224 Random* prng) { |
225 config->bitrate_bps = rtc::Optional<int>(prng->Rand(0, 3000000)); | 225 config->bitrate_bps = rtc::Optional<int>(prng->Rand(0, 3000000)); |
226 config->enable_fec = rtc::Optional<bool>(prng->Rand<bool>()); | 226 config->enable_fec = rtc::Optional<bool>(prng->Rand<bool>()); |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 void VerifyConfig(const ParsedRtcEventLog& parsed_log, | 781 void VerifyConfig(const ParsedRtcEventLog& parsed_log, |
782 size_t index) override { | 782 size_t index) override { |
783 RtcEventLogTestHelper::VerifyAudioReceiveStreamConfig(parsed_log, index, | 783 RtcEventLogTestHelper::VerifyAudioReceiveStreamConfig(parsed_log, index, |
784 config); | 784 config); |
785 } | 785 } |
786 rtclog::StreamConfig config; | 786 rtclog::StreamConfig config; |
787 }; | 787 }; |
788 | 788 |
789 class AudioSendConfigReadWriteTest : public ConfigReadWriteTest { | 789 class AudioSendConfigReadWriteTest : public ConfigReadWriteTest { |
790 public: | 790 public: |
791 AudioSendConfigReadWriteTest() : config(nullptr) {} | 791 AudioSendConfigReadWriteTest() {} |
792 void GenerateConfig(uint32_t extensions_bitvector) override { | 792 void GenerateConfig(uint32_t extensions_bitvector) override { |
793 GenerateAudioSendConfig(extensions_bitvector, &config, &prng); | 793 GenerateAudioSendConfig(extensions_bitvector, &config, &prng); |
794 } | 794 } |
795 void LogConfig(RtcEventLog* event_log) override { | 795 void LogConfig(RtcEventLog* event_log) override { |
796 event_log->LogAudioSendStreamConfig(config); | 796 event_log->LogAudioSendStreamConfig(config); |
797 } | 797 } |
798 void VerifyConfig(const ParsedRtcEventLog& parsed_log, | 798 void VerifyConfig(const ParsedRtcEventLog& parsed_log, |
799 size_t index) override { | 799 size_t index) override { |
800 RtcEventLogTestHelper::VerifyAudioSendStreamConfig(parsed_log, index, | 800 RtcEventLogTestHelper::VerifyAudioSendStreamConfig(parsed_log, index, |
801 config); | 801 config); |
802 } | 802 } |
803 AudioSendStream::Config config; | 803 rtclog::StreamConfig config; |
804 }; | 804 }; |
805 | 805 |
806 class VideoReceiveConfigReadWriteTest : public ConfigReadWriteTest { | 806 class VideoReceiveConfigReadWriteTest : public ConfigReadWriteTest { |
807 public: | 807 public: |
808 VideoReceiveConfigReadWriteTest() {} | 808 VideoReceiveConfigReadWriteTest() {} |
809 void GenerateConfig(uint32_t extensions_bitvector) override { | 809 void GenerateConfig(uint32_t extensions_bitvector) override { |
810 GenerateVideoReceiveConfig(extensions_bitvector, &config, &prng); | 810 GenerateVideoReceiveConfig(extensions_bitvector, &config, &prng); |
811 } | 811 } |
812 void LogConfig(RtcEventLog* event_log) override { | 812 void LogConfig(RtcEventLog* event_log) override { |
813 event_log->LogVideoReceiveStreamConfig(config); | 813 event_log->LogVideoReceiveStreamConfig(config); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 VideoSendConfigReadWriteTest test; | 872 VideoSendConfigReadWriteTest test; |
873 test.DoTest(); | 873 test.DoTest(); |
874 } | 874 } |
875 | 875 |
876 TEST(RtcEventLogTest, LogAudioNetworkAdaptation) { | 876 TEST(RtcEventLogTest, LogAudioNetworkAdaptation) { |
877 AudioNetworkAdaptationReadWriteTest test; | 877 AudioNetworkAdaptationReadWriteTest test; |
878 test.DoTest(); | 878 test.DoTest(); |
879 } | 879 } |
880 | 880 |
881 } // namespace webrtc | 881 } // namespace webrtc |
OLD | NEW |