Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: webrtc/logging/rtc_event_log/rtc_event_log_unittest.cc

Issue 2857933002: Replace VideoSendStream::Config with new rtclog::StreamConfig in RtcEventLog. (Closed)
Patch Set: Rebased Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // Add header extensions. 168 // Add header extensions.
169 for (unsigned i = 0; i < kNumExtensions; i++) { 169 for (unsigned i = 0; i < kNumExtensions; i++) {
170 if (extensions_bitvector & (1u << i)) { 170 if (extensions_bitvector & (1u << i)) {
171 config->rtp_extensions.emplace_back(kExtensionNames[i], 171 config->rtp_extensions.emplace_back(kExtensionNames[i],
172 prng->Rand<int>()); 172 prng->Rand<int>());
173 } 173 }
174 } 174 }
175 } 175 }
176 176
177 void GenerateVideoSendConfig(uint32_t extensions_bitvector, 177 void GenerateVideoSendConfig(uint32_t extensions_bitvector,
178 VideoSendStream::Config* config, 178 rtclog::StreamConfig* config,
179 Random* prng) { 179 Random* prng) {
180 // Create a map from a payload type to an encoder name. 180 config->codecs.emplace_back(prng->Rand<bool>() ? "VP8" : "H264",
181 config->encoder_settings.payload_type = prng->Rand(0, 127); 181 prng->Rand(1, 127), prng->Rand(1, 127));
182 config->encoder_settings.payload_name = (prng->Rand<bool>() ? "VP8" : "H264"); 182 config->local_ssrc = prng->Rand<uint32_t>();
183 // Add SSRCs for the stream. 183 config->rtx_ssrc = prng->Rand<uint32_t>();
184 config->rtp.ssrcs.push_back(prng->Rand<uint32_t>());
185 // Add a map from a payload type to new ssrcs and a new payload type for RTX.
186 config->rtp.rtx.ssrcs.push_back(prng->Rand<uint32_t>());
187 config->rtp.rtx.payload_type = prng->Rand(0, 127);
188 // Add header extensions. 184 // Add header extensions.
189 for (unsigned i = 0; i < kNumExtensions; i++) { 185 for (unsigned i = 0; i < kNumExtensions; i++) {
190 if (extensions_bitvector & (1u << i)) { 186 if (extensions_bitvector & (1u << i)) {
191 config->rtp.extensions.push_back( 187 config->rtp_extensions.push_back(
192 RtpExtension(kExtensionNames[i], prng->Rand<int>())); 188 RtpExtension(kExtensionNames[i], prng->Rand<int>()));
193 } 189 }
194 } 190 }
195 } 191 }
196 192
197 void GenerateAudioReceiveConfig(uint32_t extensions_bitvector, 193 void GenerateAudioReceiveConfig(uint32_t extensions_bitvector,
198 AudioReceiveStream::Config* config, 194 AudioReceiveStream::Config* config,
199 Random* prng) { 195 Random* prng) {
200 // Add SSRCs for the stream. 196 // Add SSRCs for the stream.
201 config->rtp.remote_ssrc = prng->Rand<uint32_t>(); 197 config->rtp.remote_ssrc = prng->Rand<uint32_t>();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 unsigned int random_seed) { 242 unsigned int random_seed) {
247 ASSERT_LE(rtcp_count, rtp_count); 243 ASSERT_LE(rtcp_count, rtp_count);
248 ASSERT_LE(playout_count, rtp_count); 244 ASSERT_LE(playout_count, rtp_count);
249 ASSERT_LE(bwe_loss_count, rtp_count); 245 ASSERT_LE(bwe_loss_count, rtp_count);
250 std::vector<RtpPacketToSend> rtp_packets; 246 std::vector<RtpPacketToSend> rtp_packets;
251 std::vector<rtc::Buffer> rtcp_packets; 247 std::vector<rtc::Buffer> rtcp_packets;
252 std::vector<uint32_t> playout_ssrcs; 248 std::vector<uint32_t> playout_ssrcs;
253 std::vector<std::pair<int32_t, uint8_t> > bwe_loss_updates; 249 std::vector<std::pair<int32_t, uint8_t> > bwe_loss_updates;
254 250
255 rtclog::StreamConfig receiver_config; 251 rtclog::StreamConfig receiver_config;
256 VideoSendStream::Config sender_config(nullptr); 252 rtclog::StreamConfig sender_config;
257 253
258 Random prng(random_seed); 254 Random prng(random_seed);
259 255
260 // Initialize rtp header extensions to be used in generated rtp packets. 256 // Initialize rtp header extensions to be used in generated rtp packets.
261 RtpHeaderExtensionMap extensions; 257 RtpHeaderExtensionMap extensions;
262 for (unsigned i = 0; i < kNumExtensions; i++) { 258 for (unsigned i = 0; i < kNumExtensions; i++) {
263 if (extensions_bitvector & (1u << i)) { 259 if (extensions_bitvector & (1u << i)) {
264 extensions.Register(kExtensionTypes[i], i + 1); 260 extensions.Register(kExtensionTypes[i], i + 1);
265 } 261 }
266 } 262 }
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 void VerifyConfig(const ParsedRtcEventLog& parsed_log, 815 void VerifyConfig(const ParsedRtcEventLog& parsed_log,
820 size_t index) override { 816 size_t index) override {
821 RtcEventLogTestHelper::VerifyVideoReceiveStreamConfig(parsed_log, index, 817 RtcEventLogTestHelper::VerifyVideoReceiveStreamConfig(parsed_log, index,
822 config); 818 config);
823 } 819 }
824 rtclog::StreamConfig config; 820 rtclog::StreamConfig config;
825 }; 821 };
826 822
827 class VideoSendConfigReadWriteTest : public ConfigReadWriteTest { 823 class VideoSendConfigReadWriteTest : public ConfigReadWriteTest {
828 public: 824 public:
829 VideoSendConfigReadWriteTest() : config(nullptr) {} 825 VideoSendConfigReadWriteTest() {}
830 void GenerateConfig(uint32_t extensions_bitvector) override { 826 void GenerateConfig(uint32_t extensions_bitvector) override {
831 GenerateVideoSendConfig(extensions_bitvector, &config, &prng); 827 GenerateVideoSendConfig(extensions_bitvector, &config, &prng);
832 } 828 }
833 void LogConfig(RtcEventLog* event_log) override { 829 void LogConfig(RtcEventLog* event_log) override {
834 event_log->LogVideoSendStreamConfig(config); 830 event_log->LogVideoSendStreamConfig(config);
835 } 831 }
836 void VerifyConfig(const ParsedRtcEventLog& parsed_log, 832 void VerifyConfig(const ParsedRtcEventLog& parsed_log,
837 size_t index) override { 833 size_t index) override {
838 RtcEventLogTestHelper::VerifyVideoSendStreamConfig(parsed_log, index, 834 RtcEventLogTestHelper::VerifyVideoSendStreamConfig(parsed_log, index,
839 config); 835 config);
840 } 836 }
841 VideoSendStream::Config config; 837 rtclog::StreamConfig config;
842 }; 838 };
843 839
844 class AudioNetworkAdaptationReadWriteTest : public ConfigReadWriteTest { 840 class AudioNetworkAdaptationReadWriteTest : public ConfigReadWriteTest {
845 public: 841 public:
846 void GenerateConfig(uint32_t extensions_bitvector) override { 842 void GenerateConfig(uint32_t extensions_bitvector) override {
847 GenerateAudioNetworkAdaptation(extensions_bitvector, &config, &prng); 843 GenerateAudioNetworkAdaptation(extensions_bitvector, &config, &prng);
848 } 844 }
849 void LogConfig(RtcEventLog* event_log) override { 845 void LogConfig(RtcEventLog* event_log) override {
850 event_log->LogAudioNetworkAdaptation(config); 846 event_log->LogAudioNetworkAdaptation(config);
851 } 847 }
(...skipping 24 matching lines...) Expand all
876 VideoSendConfigReadWriteTest test; 872 VideoSendConfigReadWriteTest test;
877 test.DoTest(); 873 test.DoTest();
878 } 874 }
879 875
880 TEST(RtcEventLogTest, LogAudioNetworkAdaptation) { 876 TEST(RtcEventLogTest, LogAudioNetworkAdaptation) {
881 AudioNetworkAdaptationReadWriteTest test; 877 AudioNetworkAdaptationReadWriteTest test;
882 test.DoTest(); 878 test.DoTest();
883 } 879 }
884 880
885 } // namespace webrtc 881 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/logging/rtc_event_log/rtc_event_log_parser.cc ('k') | webrtc/logging/rtc_event_log/rtc_event_log_unittest_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698