Chromium Code Reviews| 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 |
| 11 #ifdef ENABLE_RTC_EVENT_LOG | 11 #ifdef ENABLE_RTC_EVENT_LOG |
| 12 | 12 |
| 13 #include <stdio.h> | |
| 14 #include <string> | 13 #include <string> |
| 15 #include <vector> | 14 #include <vector> |
| 16 | 15 |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "webrtc/base/buffer.h" | 17 #include "webrtc/base/buffer.h" |
| 19 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
| 20 #include "webrtc/base/scoped_ptr.h" | 19 #include "webrtc/base/scoped_ptr.h" |
| 21 #include "webrtc/base/thread.h" | 20 #include "webrtc/base/thread.h" |
| 22 #include "webrtc/call.h" | 21 #include "webrtc/call.h" |
| 23 #include "webrtc/call/rtc_event_log.h" | 22 #include "webrtc/call/rtc_event_log.h" |
| 24 #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h" | 23 #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h" |
| 25 #include "webrtc/system_wrappers/interface/clock.h" | 24 #include "webrtc/system_wrappers/interface/clock.h" |
| 25 #include "webrtc/test/random.h" | |
| 26 #include "webrtc/test/test_suite.h" | 26 #include "webrtc/test/test_suite.h" |
| 27 #include "webrtc/test/testsupport/fileutils.h" | 27 #include "webrtc/test/testsupport/fileutils.h" |
| 28 #include "webrtc/test/testsupport/gtest_disable.h" | 28 #include "webrtc/test/testsupport/gtest_disable.h" |
| 29 | 29 |
| 30 // Files generated at build-time by the protobuf compiler. | 30 // Files generated at build-time by the protobuf compiler. |
| 31 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD | 31 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD |
| 32 #include "external/webrtc/webrtc/call/rtc_event_log.pb.h" | 32 #include "external/webrtc/webrtc/call/rtc_event_log.pb.h" |
| 33 #else | 33 #else |
| 34 #include "webrtc/call/rtc_event_log.pb.h" | 34 #include "webrtc/call/rtc_event_log.pb.h" |
| 35 #endif | 35 #endif |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 } | 282 } |
| 283 | 283 |
| 284 /* | 284 /* |
| 285 * Bit number i of extension_bitvector is set to indicate the | 285 * Bit number i of extension_bitvector is set to indicate the |
| 286 * presence of extension number i from kExtensionTypes / kExtensionNames. | 286 * presence of extension number i from kExtensionTypes / kExtensionNames. |
| 287 * The least significant bit extension_bitvector has number 0. | 287 * The least significant bit extension_bitvector has number 0. |
| 288 */ | 288 */ |
| 289 size_t GenerateRtpPacket(uint32_t extensions_bitvector, | 289 size_t GenerateRtpPacket(uint32_t extensions_bitvector, |
| 290 uint32_t csrcs_count, | 290 uint32_t csrcs_count, |
| 291 uint8_t* packet, | 291 uint8_t* packet, |
| 292 size_t packet_size) { | 292 size_t packet_size, |
| 293 test::Random& prng) { | |
| 293 RTC_CHECK_GE(packet_size, 16 + 4 * csrcs_count + 4 * kNumExtensions); | 294 RTC_CHECK_GE(packet_size, 16 + 4 * csrcs_count + 4 * kNumExtensions); |
| 294 Clock* clock = Clock::GetRealTimeClock(); | 295 Clock* clock = Clock::GetRealTimeClock(); |
| 295 | 296 |
| 296 RTPSender rtp_sender(false, // bool audio | 297 RTPSender rtp_sender(false, // bool audio |
| 297 clock, // Clock* clock | 298 clock, // Clock* clock |
| 298 nullptr, // Transport* | 299 nullptr, // Transport* |
| 299 nullptr, // RtpAudioFeedback* | 300 nullptr, // RtpAudioFeedback* |
| 300 nullptr, // PacedSender* | 301 nullptr, // PacedSender* |
| 301 nullptr, // PacketRouter* | 302 nullptr, // PacketRouter* |
| 302 nullptr, // SendTimeObserver* | 303 nullptr, // SendTimeObserver* |
| 303 nullptr, // BitrateStatisticsObserver* | 304 nullptr, // BitrateStatisticsObserver* |
| 304 nullptr, // FrameCountObserver* | 305 nullptr, // FrameCountObserver* |
| 305 nullptr); // SendSideDelayObserver* | 306 nullptr); // SendSideDelayObserver* |
| 306 | 307 |
| 307 std::vector<uint32_t> csrcs; | 308 std::vector<uint32_t> csrcs; |
| 308 for (unsigned i = 0; i < csrcs_count; i++) { | 309 for (unsigned i = 0; i < csrcs_count; i++) { |
| 309 csrcs.push_back(rand()); | 310 csrcs.push_back(prng.Rand(0, 1000000000)); |
|
the sun
2015/10/19 11:47:26
Duplicated a lot. Would it make sense to add a hel
terelius
2015/10/21 12:18:28
I was actually wishing for a function which return
| |
| 310 } | 311 } |
| 311 rtp_sender.SetCsrcs(csrcs); | 312 rtp_sender.SetCsrcs(csrcs); |
| 312 rtp_sender.SetSSRC(rand()); | 313 rtp_sender.SetSSRC(prng.Rand(0, 1000000000)); |
| 313 rtp_sender.SetStartTimestamp(rand(), true); | 314 rtp_sender.SetStartTimestamp(prng.Rand(0, 1000000000), true); |
| 314 rtp_sender.SetSequenceNumber(rand()); | 315 rtp_sender.SetSequenceNumber(prng.Rand(0, 16535)); |
| 315 | 316 |
| 316 for (unsigned i = 0; i < kNumExtensions; i++) { | 317 for (unsigned i = 0; i < kNumExtensions; i++) { |
| 317 if (extensions_bitvector & (1u << i)) { | 318 if (extensions_bitvector & (1u << i)) { |
| 318 rtp_sender.RegisterRtpHeaderExtension(kExtensionTypes[i], i + 1); | 319 rtp_sender.RegisterRtpHeaderExtension(kExtensionTypes[i], i + 1); |
| 319 } | 320 } |
| 320 } | 321 } |
| 321 | 322 |
| 322 int8_t payload_type = rand() % 128; | 323 int8_t payload_type = prng.Rand(0, 127); |
| 323 bool marker_bit = (rand() % 2 == 1); | 324 bool marker_bit = (prng.Rand(0, 1) == 1); |
| 324 uint32_t capture_timestamp = rand(); | 325 uint32_t capture_timestamp = prng.Rand(0, 1000000000); |
| 325 int64_t capture_time_ms = rand(); | 326 int64_t capture_time_ms = prng.Rand(0, 1000000000); |
| 326 bool timestamp_provided = (rand() % 2 == 1); | 327 bool timestamp_provided = (prng.Rand(0, 1) == 1); |
| 327 bool inc_sequence_number = (rand() % 2 == 1); | 328 bool inc_sequence_number = (prng.Rand(0, 1) == 1); |
| 328 | 329 |
| 329 size_t header_size = rtp_sender.BuildRTPheader( | 330 size_t header_size = rtp_sender.BuildRTPheader( |
| 330 packet, payload_type, marker_bit, capture_timestamp, capture_time_ms, | 331 packet, payload_type, marker_bit, capture_timestamp, capture_time_ms, |
| 331 timestamp_provided, inc_sequence_number); | 332 timestamp_provided, inc_sequence_number); |
| 332 | 333 |
| 333 for (size_t i = header_size; i < packet_size; i++) { | 334 for (size_t i = header_size; i < packet_size; i++) { |
| 334 packet[i] = rand(); | 335 packet[i] = prng.Rand(0, 1000000000); |
| 335 } | 336 } |
| 336 | 337 |
| 337 return header_size; | 338 return header_size; |
| 338 } | 339 } |
| 339 | 340 |
| 340 void GenerateRtcpPacket(uint8_t* packet, size_t packet_size) { | 341 void GenerateRtcpPacket(uint8_t* packet, |
| 342 size_t packet_size, | |
| 343 test::Random& prng) { | |
| 341 for (size_t i = 0; i < packet_size; i++) { | 344 for (size_t i = 0; i < packet_size; i++) { |
| 342 packet[i] = rand(); | 345 packet[i] = prng.Rand(0, 1000000000); |
| 343 } | 346 } |
| 344 } | 347 } |
| 345 | 348 |
| 346 void GenerateVideoReceiveConfig(uint32_t extensions_bitvector, | 349 void GenerateVideoReceiveConfig(uint32_t extensions_bitvector, |
| 347 VideoReceiveStream::Config* config) { | 350 VideoReceiveStream::Config* config, |
| 351 test::Random& prng) { | |
| 348 // Create a map from a payload type to an encoder name. | 352 // Create a map from a payload type to an encoder name. |
| 349 VideoReceiveStream::Decoder decoder; | 353 VideoReceiveStream::Decoder decoder; |
| 350 decoder.payload_type = rand(); | 354 decoder.payload_type = prng.Rand(0, 1000000000); |
| 351 decoder.payload_name = (rand() % 2 ? "VP8" : "H264"); | 355 decoder.payload_name = (prng.Rand(0, 1) ? "VP8" : "H264"); |
| 352 config->decoders.push_back(decoder); | 356 config->decoders.push_back(decoder); |
| 353 // Add SSRCs for the stream. | 357 // Add SSRCs for the stream. |
| 354 config->rtp.remote_ssrc = rand(); | 358 config->rtp.remote_ssrc = prng.Rand(0, 1000000000); |
| 355 config->rtp.local_ssrc = rand(); | 359 config->rtp.local_ssrc = prng.Rand(0, 1000000000); |
| 356 // Add extensions and settings for RTCP. | 360 // Add extensions and settings for RTCP. |
| 357 config->rtp.rtcp_mode = | 361 config->rtp.rtcp_mode = |
| 358 rand() % 2 ? RtcpMode::kCompound : RtcpMode::kReducedSize; | 362 prng.Rand(0, 1) ? RtcpMode::kCompound : RtcpMode::kReducedSize; |
| 359 config->rtp.rtcp_xr.receiver_reference_time_report = (rand() % 2 == 1); | 363 config->rtp.rtcp_xr.receiver_reference_time_report = (prng.Rand(0, 1) == 1); |
| 360 config->rtp.remb = (rand() % 2 == 1); | 364 config->rtp.remb = (prng.Rand(0, 1) == 1); |
| 361 // Add a map from a payload type to a new ssrc and a new payload type for RTX. | 365 // Add a map from a payload type to a new ssrc and a new payload type for RTX. |
| 362 VideoReceiveStream::Config::Rtp::Rtx rtx_pair; | 366 VideoReceiveStream::Config::Rtp::Rtx rtx_pair; |
| 363 rtx_pair.ssrc = rand(); | 367 rtx_pair.ssrc = prng.Rand(0, 1000000000); |
| 364 rtx_pair.payload_type = rand(); | 368 rtx_pair.payload_type = prng.Rand(0, 1000000000); |
| 365 config->rtp.rtx.insert(std::make_pair(rand(), rtx_pair)); | 369 config->rtp.rtx.insert(std::make_pair(prng.Rand(0, 1000000000), rtx_pair)); |
| 366 // Add header extensions. | 370 // Add header extensions. |
| 367 for (unsigned i = 0; i < kNumExtensions; i++) { | 371 for (unsigned i = 0; i < kNumExtensions; i++) { |
| 368 if (extensions_bitvector & (1u << i)) { | 372 if (extensions_bitvector & (1u << i)) { |
| 369 config->rtp.extensions.push_back( | 373 config->rtp.extensions.push_back( |
| 370 RtpExtension(kExtensionNames[i], rand())); | 374 RtpExtension(kExtensionNames[i], prng.Rand(0, 1000000000))); |
| 371 } | 375 } |
| 372 } | 376 } |
| 373 } | 377 } |
| 374 | 378 |
| 375 void GenerateVideoSendConfig(uint32_t extensions_bitvector, | 379 void GenerateVideoSendConfig(uint32_t extensions_bitvector, |
| 376 VideoSendStream::Config* config) { | 380 VideoSendStream::Config* config, |
| 381 test::Random& prng) { | |
| 377 // Create a map from a payload type to an encoder name. | 382 // Create a map from a payload type to an encoder name. |
| 378 config->encoder_settings.payload_type = rand(); | 383 config->encoder_settings.payload_type = prng.Rand(0, 1000000000); |
| 379 config->encoder_settings.payload_name = (rand() % 2 ? "VP8" : "H264"); | 384 config->encoder_settings.payload_name = (prng.Rand(0, 1) ? "VP8" : "H264"); |
| 380 // Add SSRCs for the stream. | 385 // Add SSRCs for the stream. |
| 381 config->rtp.ssrcs.push_back(rand()); | 386 config->rtp.ssrcs.push_back(prng.Rand(0, 1000000000)); |
| 382 // Add a map from a payload type to new ssrcs and a new payload type for RTX. | 387 // Add a map from a payload type to new ssrcs and a new payload type for RTX. |
| 383 config->rtp.rtx.ssrcs.push_back(rand()); | 388 config->rtp.rtx.ssrcs.push_back(prng.Rand(0, 1000000000)); |
| 384 config->rtp.rtx.payload_type = rand(); | 389 config->rtp.rtx.payload_type = prng.Rand(0, 1000000000); |
| 385 // Add a CNAME. | 390 // Add a CNAME. |
| 386 config->rtp.c_name = "some.user@some.host"; | 391 config->rtp.c_name = "some.user@some.host"; |
| 387 // Add header extensions. | 392 // Add header extensions. |
| 388 for (unsigned i = 0; i < kNumExtensions; i++) { | 393 for (unsigned i = 0; i < kNumExtensions; i++) { |
| 389 if (extensions_bitvector & (1u << i)) { | 394 if (extensions_bitvector & (1u << i)) { |
| 390 config->rtp.extensions.push_back( | 395 config->rtp.extensions.push_back( |
| 391 RtpExtension(kExtensionNames[i], rand())); | 396 RtpExtension(kExtensionNames[i], prng.Rand(0, 1000000000))); |
| 392 } | 397 } |
| 393 } | 398 } |
| 394 } | 399 } |
| 395 | 400 |
| 396 // Test for the RtcEventLog class. Dumps some RTP packets and other events | 401 // Test for the RtcEventLog class. Dumps some RTP packets and other events |
| 397 // to disk, then reads them back to see if they match. | 402 // to disk, then reads them back to see if they match. |
| 398 void LogSessionAndReadBack(size_t rtp_count, | 403 void LogSessionAndReadBack(size_t rtp_count, |
| 399 size_t rtcp_count, | 404 size_t rtcp_count, |
| 400 size_t playout_count, | 405 size_t playout_count, |
| 401 uint32_t extensions_bitvector, | 406 uint32_t extensions_bitvector, |
| 402 uint32_t csrcs_count, | 407 uint32_t csrcs_count, |
| 403 unsigned int random_seed) { | 408 unsigned int random_seed) { |
| 404 ASSERT_LE(rtcp_count, rtp_count); | 409 ASSERT_LE(rtcp_count, rtp_count); |
| 405 ASSERT_LE(playout_count, rtp_count); | 410 ASSERT_LE(playout_count, rtp_count); |
| 406 std::vector<rtc::Buffer> rtp_packets; | 411 std::vector<rtc::Buffer> rtp_packets; |
| 407 std::vector<rtc::Buffer> rtcp_packets; | 412 std::vector<rtc::Buffer> rtcp_packets; |
| 408 std::vector<size_t> rtp_header_sizes; | 413 std::vector<size_t> rtp_header_sizes; |
| 409 std::vector<uint32_t> playout_ssrcs; | 414 std::vector<uint32_t> playout_ssrcs; |
| 410 | 415 |
| 411 VideoReceiveStream::Config receiver_config(nullptr); | 416 VideoReceiveStream::Config receiver_config(nullptr); |
| 412 VideoSendStream::Config sender_config(nullptr); | 417 VideoSendStream::Config sender_config(nullptr); |
| 413 | 418 |
| 414 srand(random_seed); | 419 test::Random prng(random_seed); |
| 415 | 420 |
| 416 // Create rtp_count RTP packets containing random data. | 421 // Create rtp_count RTP packets containing random data. |
| 417 for (size_t i = 0; i < rtp_count; i++) { | 422 for (size_t i = 0; i < rtp_count; i++) { |
| 418 size_t packet_size = 1000 + rand() % 64; | 423 size_t packet_size = prng.Rand(1000, 1100); |
| 419 rtp_packets.push_back(rtc::Buffer(packet_size)); | 424 rtp_packets.push_back(rtc::Buffer(packet_size)); |
| 420 size_t header_size = GenerateRtpPacket(extensions_bitvector, csrcs_count, | 425 size_t header_size = |
| 421 rtp_packets[i].data(), packet_size); | 426 GenerateRtpPacket(extensions_bitvector, csrcs_count, |
| 427 rtp_packets[i].data(), packet_size, prng); | |
| 422 rtp_header_sizes.push_back(header_size); | 428 rtp_header_sizes.push_back(header_size); |
| 423 } | 429 } |
| 424 // Create rtcp_count RTCP packets containing random data. | 430 // Create rtcp_count RTCP packets containing random data. |
| 425 for (size_t i = 0; i < rtcp_count; i++) { | 431 for (size_t i = 0; i < rtcp_count; i++) { |
| 426 size_t packet_size = 1000 + rand() % 64; | 432 size_t packet_size = prng.Rand(1000, 1100); |
| 427 rtcp_packets.push_back(rtc::Buffer(packet_size)); | 433 rtcp_packets.push_back(rtc::Buffer(packet_size)); |
| 428 GenerateRtcpPacket(rtcp_packets[i].data(), packet_size); | 434 GenerateRtcpPacket(rtcp_packets[i].data(), packet_size, prng); |
| 429 } | 435 } |
| 430 // Create playout_count random SSRCs to use when logging AudioPlayout events. | 436 // Create playout_count random SSRCs to use when logging AudioPlayout events. |
| 431 for (size_t i = 0; i < playout_count; i++) { | 437 for (size_t i = 0; i < playout_count; i++) { |
| 432 playout_ssrcs.push_back(static_cast<uint32_t>(rand())); | 438 playout_ssrcs.push_back(static_cast<uint32_t>(prng.Rand(0, 1000000000))); |
| 433 } | 439 } |
| 434 // Create configurations for the video streams. | 440 // Create configurations for the video streams. |
| 435 GenerateVideoReceiveConfig(extensions_bitvector, &receiver_config); | 441 GenerateVideoReceiveConfig(extensions_bitvector, &receiver_config, prng); |
| 436 GenerateVideoSendConfig(extensions_bitvector, &sender_config); | 442 GenerateVideoSendConfig(extensions_bitvector, &sender_config, prng); |
| 437 const int config_count = 2; | 443 const int config_count = 2; |
| 438 | 444 |
| 439 // Find the name of the current test, in order to use it as a temporary | 445 // Find the name of the current test, in order to use it as a temporary |
| 440 // filename. | 446 // filename. |
| 441 auto test_info = ::testing::UnitTest::GetInstance()->current_test_info(); | 447 auto test_info = ::testing::UnitTest::GetInstance()->current_test_info(); |
| 442 const std::string temp_filename = | 448 const std::string temp_filename = |
| 443 test::OutputPath() + test_info->test_case_name() + test_info->name(); | 449 test::OutputPath() + test_info->test_case_name() + test_info->name(); |
| 444 | 450 |
| 445 // When log_dumper goes out of scope, it causes the log file to be flushed | 451 // When log_dumper goes out of scope, it causes the log file to be flushed |
| 446 // to disk. | 452 // to disk. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 534 LogSessionAndReadBack(8, 2, 0, extensions, 0, 3141592653u); | 540 LogSessionAndReadBack(8, 2, 0, extensions, 0, 3141592653u); |
| 535 | 541 |
| 536 extensions = (1u << kNumExtensions) - 1; // Enable all header extensions | 542 extensions = (1u << kNumExtensions) - 1; // Enable all header extensions |
| 537 LogSessionAndReadBack(9, 2, 3, extensions, 2, 2718281828u); | 543 LogSessionAndReadBack(9, 2, 3, extensions, 2, 2718281828u); |
| 538 | 544 |
| 539 // Try all combinations of header extensions and up to 2 CSRCS. | 545 // Try all combinations of header extensions and up to 2 CSRCS. |
| 540 for (extensions = 0; extensions < (1u << kNumExtensions); extensions++) { | 546 for (extensions = 0; extensions < (1u << kNumExtensions); extensions++) { |
| 541 for (uint32_t csrcs_count = 0; csrcs_count < 3; csrcs_count++) { | 547 for (uint32_t csrcs_count = 0; csrcs_count < 3; csrcs_count++) { |
| 542 LogSessionAndReadBack(5 + extensions, // Number of RTP packets. | 548 LogSessionAndReadBack(5 + extensions, // Number of RTP packets. |
| 543 2 + csrcs_count, // Number of RTCP packets. | 549 2 + csrcs_count, // Number of RTCP packets. |
| 544 3 + csrcs_count, // Number of playout events | 550 3 + csrcs_count, // Number of playout events. |
| 545 extensions, // Bit vector choosing extensions | 551 extensions, // Bit vector choosing extensions. |
| 546 csrcs_count, // Number of contributing sources | 552 csrcs_count, // Number of contributing sources. |
| 547 rand()); | 553 extensions + csrcs_count); // Random seed. |
| 548 } | 554 } |
| 549 } | 555 } |
| 550 } | 556 } |
| 551 | 557 |
| 552 // Tests that the event queue works correctly, i.e. drops old RTP, RTCP and | 558 // Tests that the event queue works correctly, i.e. drops old RTP, RTCP and |
| 553 // debug events, but keeps config events even if they are older than the limit. | 559 // debug events, but keeps config events even if they are older than the limit. |
| 554 void DropOldEvents(uint32_t extensions_bitvector, | 560 void DropOldEvents(uint32_t extensions_bitvector, |
| 555 uint32_t csrcs_count, | 561 uint32_t csrcs_count, |
| 556 unsigned int random_seed) { | 562 unsigned int random_seed) { |
| 557 rtc::Buffer old_rtp_packet; | 563 rtc::Buffer old_rtp_packet; |
| 558 rtc::Buffer recent_rtp_packet; | 564 rtc::Buffer recent_rtp_packet; |
| 559 rtc::Buffer old_rtcp_packet; | 565 rtc::Buffer old_rtcp_packet; |
| 560 rtc::Buffer recent_rtcp_packet; | 566 rtc::Buffer recent_rtcp_packet; |
| 561 | 567 |
| 562 VideoReceiveStream::Config receiver_config(nullptr); | 568 VideoReceiveStream::Config receiver_config(nullptr); |
| 563 VideoSendStream::Config sender_config(nullptr); | 569 VideoSendStream::Config sender_config(nullptr); |
| 564 | 570 |
| 565 srand(random_seed); | 571 test::Random prng(random_seed); |
| 566 | 572 |
| 567 // Create two RTP packets containing random data. | 573 // Create two RTP packets containing random data. |
| 568 size_t packet_size = 1000 + rand() % 64; | 574 size_t packet_size = prng.Rand(1000, 1100); |
| 569 old_rtp_packet.SetSize(packet_size); | 575 old_rtp_packet.SetSize(packet_size); |
| 570 GenerateRtpPacket(extensions_bitvector, csrcs_count, old_rtp_packet.data(), | 576 GenerateRtpPacket(extensions_bitvector, csrcs_count, old_rtp_packet.data(), |
| 571 packet_size); | 577 packet_size, prng); |
| 572 packet_size = 1000 + rand() % 64; | 578 packet_size = prng.Rand(1000, 1100); |
| 573 recent_rtp_packet.SetSize(packet_size); | 579 recent_rtp_packet.SetSize(packet_size); |
| 574 size_t recent_header_size = GenerateRtpPacket( | 580 size_t recent_header_size = |
| 575 extensions_bitvector, csrcs_count, recent_rtp_packet.data(), packet_size); | 581 GenerateRtpPacket(extensions_bitvector, csrcs_count, |
| 582 recent_rtp_packet.data(), packet_size, prng); | |
| 576 | 583 |
| 577 // Create two RTCP packets containing random data. | 584 // Create two RTCP packets containing random data. |
| 578 packet_size = 1000 + rand() % 64; | 585 packet_size = prng.Rand(1000, 1100); |
| 579 old_rtcp_packet.SetSize(packet_size); | 586 old_rtcp_packet.SetSize(packet_size); |
| 580 GenerateRtcpPacket(old_rtcp_packet.data(), packet_size); | 587 GenerateRtcpPacket(old_rtcp_packet.data(), packet_size, prng); |
| 581 packet_size = 1000 + rand() % 64; | 588 packet_size = prng.Rand(1000, 1100); |
| 582 recent_rtcp_packet.SetSize(packet_size); | 589 recent_rtcp_packet.SetSize(packet_size); |
| 583 GenerateRtcpPacket(recent_rtcp_packet.data(), packet_size); | 590 GenerateRtcpPacket(recent_rtcp_packet.data(), packet_size, prng); |
| 584 | 591 |
| 585 // Create configurations for the video streams. | 592 // Create configurations for the video streams. |
| 586 GenerateVideoReceiveConfig(extensions_bitvector, &receiver_config); | 593 GenerateVideoReceiveConfig(extensions_bitvector, &receiver_config, prng); |
| 587 GenerateVideoSendConfig(extensions_bitvector, &sender_config); | 594 GenerateVideoSendConfig(extensions_bitvector, &sender_config, prng); |
| 588 | 595 |
| 589 // Find the name of the current test, in order to use it as a temporary | 596 // Find the name of the current test, in order to use it as a temporary |
| 590 // filename. | 597 // filename. |
| 591 auto test_info = ::testing::UnitTest::GetInstance()->current_test_info(); | 598 auto test_info = ::testing::UnitTest::GetInstance()->current_test_info(); |
| 592 const std::string temp_filename = | 599 const std::string temp_filename = |
| 593 test::OutputPath() + test_info->test_case_name() + test_info->name(); | 600 test::OutputPath() + test_info->test_case_name() + test_info->name(); |
| 594 | 601 |
| 595 // The log file will be flushed to disk when the log_dumper goes out of scope. | 602 // The log file will be flushed to disk when the log_dumper goes out of scope. |
| 596 { | 603 { |
| 597 rtc::scoped_ptr<RtcEventLog> log_dumper(RtcEventLog::Create()); | 604 rtc::scoped_ptr<RtcEventLog> log_dumper(RtcEventLog::Create()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 638 // Enable all header extensions | 645 // Enable all header extensions |
| 639 uint32_t extensions = (1u << kNumExtensions) - 1; | 646 uint32_t extensions = (1u << kNumExtensions) - 1; |
| 640 uint32_t csrcs_count = 2; | 647 uint32_t csrcs_count = 2; |
| 641 DropOldEvents(extensions, csrcs_count, 141421356); | 648 DropOldEvents(extensions, csrcs_count, 141421356); |
| 642 DropOldEvents(extensions, csrcs_count, 173205080); | 649 DropOldEvents(extensions, csrcs_count, 173205080); |
| 643 } | 650 } |
| 644 | 651 |
| 645 } // namespace webrtc | 652 } // namespace webrtc |
| 646 | 653 |
| 647 #endif // ENABLE_RTC_EVENT_LOG | 654 #endif // ENABLE_RTC_EVENT_LOG |
| OLD | NEW |