| 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/include/clock.h" | 24 #include "webrtc/system_wrappers/include/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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 } | 297 } |
| 298 | 298 |
| 299 /* | 299 /* |
| 300 * Bit number i of extension_bitvector is set to indicate the | 300 * Bit number i of extension_bitvector is set to indicate the |
| 301 * presence of extension number i from kExtensionTypes / kExtensionNames. | 301 * presence of extension number i from kExtensionTypes / kExtensionNames. |
| 302 * The least significant bit extension_bitvector has number 0. | 302 * The least significant bit extension_bitvector has number 0. |
| 303 */ | 303 */ |
| 304 size_t GenerateRtpPacket(uint32_t extensions_bitvector, | 304 size_t GenerateRtpPacket(uint32_t extensions_bitvector, |
| 305 uint32_t csrcs_count, | 305 uint32_t csrcs_count, |
| 306 uint8_t* packet, | 306 uint8_t* packet, |
| 307 size_t packet_size) { | 307 size_t packet_size, |
| 308 test::Random* prng) { |
| 308 RTC_CHECK_GE(packet_size, 16 + 4 * csrcs_count + 4 * kNumExtensions); | 309 RTC_CHECK_GE(packet_size, 16 + 4 * csrcs_count + 4 * kNumExtensions); |
| 309 Clock* clock = Clock::GetRealTimeClock(); | 310 Clock* clock = Clock::GetRealTimeClock(); |
| 310 | 311 |
| 311 RTPSender rtp_sender(false, // bool audio | 312 RTPSender rtp_sender(false, // bool audio |
| 312 clock, // Clock* clock | 313 clock, // Clock* clock |
| 313 nullptr, // Transport* | 314 nullptr, // Transport* |
| 314 nullptr, // RtpAudioFeedback* | 315 nullptr, // RtpAudioFeedback* |
| 315 nullptr, // PacedSender* | 316 nullptr, // PacedSender* |
| 316 nullptr, // PacketRouter* | 317 nullptr, // PacketRouter* |
| 317 nullptr, // SendTimeObserver* | 318 nullptr, // SendTimeObserver* |
| 318 nullptr, // BitrateStatisticsObserver* | 319 nullptr, // BitrateStatisticsObserver* |
| 319 nullptr, // FrameCountObserver* | 320 nullptr, // FrameCountObserver* |
| 320 nullptr); // SendSideDelayObserver* | 321 nullptr); // SendSideDelayObserver* |
| 321 | 322 |
| 322 std::vector<uint32_t> csrcs; | 323 std::vector<uint32_t> csrcs; |
| 323 for (unsigned i = 0; i < csrcs_count; i++) { | 324 for (unsigned i = 0; i < csrcs_count; i++) { |
| 324 csrcs.push_back(rand()); | 325 csrcs.push_back(prng->Rand<uint32_t>()); |
| 325 } | 326 } |
| 326 rtp_sender.SetCsrcs(csrcs); | 327 rtp_sender.SetCsrcs(csrcs); |
| 327 rtp_sender.SetSSRC(rand()); | 328 rtp_sender.SetSSRC(prng->Rand<uint32_t>()); |
| 328 rtp_sender.SetStartTimestamp(rand(), true); | 329 rtp_sender.SetStartTimestamp(prng->Rand<uint32_t>(), true); |
| 329 rtp_sender.SetSequenceNumber(rand()); | 330 rtp_sender.SetSequenceNumber(prng->Rand<uint16_t>()); |
| 330 | 331 |
| 331 for (unsigned i = 0; i < kNumExtensions; i++) { | 332 for (unsigned i = 0; i < kNumExtensions; i++) { |
| 332 if (extensions_bitvector & (1u << i)) { | 333 if (extensions_bitvector & (1u << i)) { |
| 333 rtp_sender.RegisterRtpHeaderExtension(kExtensionTypes[i], i + 1); | 334 rtp_sender.RegisterRtpHeaderExtension(kExtensionTypes[i], i + 1); |
| 334 } | 335 } |
| 335 } | 336 } |
| 336 | 337 |
| 337 int8_t payload_type = rand() % 128; | 338 int8_t payload_type = prng->Rand(0, 127); |
| 338 bool marker_bit = (rand() % 2 == 1); | 339 bool marker_bit = prng->Rand<bool>(); |
| 339 uint32_t capture_timestamp = rand(); | 340 uint32_t capture_timestamp = prng->Rand<uint32_t>(); |
| 340 int64_t capture_time_ms = rand(); | 341 int64_t capture_time_ms = prng->Rand<uint32_t>(); |
| 341 bool timestamp_provided = (rand() % 2 == 1); | 342 bool timestamp_provided = prng->Rand<bool>(); |
| 342 bool inc_sequence_number = (rand() % 2 == 1); | 343 bool inc_sequence_number = prng->Rand<bool>(); |
| 343 | 344 |
| 344 size_t header_size = rtp_sender.BuildRTPheader( | 345 size_t header_size = rtp_sender.BuildRTPheader( |
| 345 packet, payload_type, marker_bit, capture_timestamp, capture_time_ms, | 346 packet, payload_type, marker_bit, capture_timestamp, capture_time_ms, |
| 346 timestamp_provided, inc_sequence_number); | 347 timestamp_provided, inc_sequence_number); |
| 347 | 348 |
| 348 for (size_t i = header_size; i < packet_size; i++) { | 349 for (size_t i = header_size; i < packet_size; i++) { |
| 349 packet[i] = rand(); | 350 packet[i] = prng->Rand<uint8_t>(); |
| 350 } | 351 } |
| 351 | 352 |
| 352 return header_size; | 353 return header_size; |
| 353 } | 354 } |
| 354 | 355 |
| 355 void GenerateRtcpPacket(uint8_t* packet, size_t packet_size) { | 356 void GenerateRtcpPacket(uint8_t* packet, |
| 357 size_t packet_size, |
| 358 test::Random* prng) { |
| 356 for (size_t i = 0; i < packet_size; i++) { | 359 for (size_t i = 0; i < packet_size; i++) { |
| 357 packet[i] = rand(); | 360 packet[i] = prng->Rand<uint8_t>(); |
| 358 } | 361 } |
| 359 } | 362 } |
| 360 | 363 |
| 361 void GenerateVideoReceiveConfig(uint32_t extensions_bitvector, | 364 void GenerateVideoReceiveConfig(uint32_t extensions_bitvector, |
| 362 VideoReceiveStream::Config* config) { | 365 VideoReceiveStream::Config* config, |
| 366 test::Random* prng) { |
| 363 // Create a map from a payload type to an encoder name. | 367 // Create a map from a payload type to an encoder name. |
| 364 VideoReceiveStream::Decoder decoder; | 368 VideoReceiveStream::Decoder decoder; |
| 365 decoder.payload_type = rand(); | 369 decoder.payload_type = prng->Rand(0, 127); |
| 366 decoder.payload_name = (rand() % 2 ? "VP8" : "H264"); | 370 decoder.payload_name = (prng->Rand<bool>() ? "VP8" : "H264"); |
| 367 config->decoders.push_back(decoder); | 371 config->decoders.push_back(decoder); |
| 368 // Add SSRCs for the stream. | 372 // Add SSRCs for the stream. |
| 369 config->rtp.remote_ssrc = rand(); | 373 config->rtp.remote_ssrc = prng->Rand<uint32_t>(); |
| 370 config->rtp.local_ssrc = rand(); | 374 config->rtp.local_ssrc = prng->Rand<uint32_t>(); |
| 371 // Add extensions and settings for RTCP. | 375 // Add extensions and settings for RTCP. |
| 372 config->rtp.rtcp_mode = | 376 config->rtp.rtcp_mode = |
| 373 rand() % 2 ? RtcpMode::kCompound : RtcpMode::kReducedSize; | 377 prng->Rand<bool>() ? RtcpMode::kCompound : RtcpMode::kReducedSize; |
| 374 config->rtp.rtcp_xr.receiver_reference_time_report = (rand() % 2 == 1); | 378 config->rtp.rtcp_xr.receiver_reference_time_report = prng->Rand<bool>(); |
| 375 config->rtp.remb = (rand() % 2 == 1); | 379 config->rtp.remb = prng->Rand<bool>(); |
| 376 // Add a map from a payload type to a new ssrc and a new payload type for RTX. | 380 // Add a map from a payload type to a new ssrc and a new payload type for RTX. |
| 377 VideoReceiveStream::Config::Rtp::Rtx rtx_pair; | 381 VideoReceiveStream::Config::Rtp::Rtx rtx_pair; |
| 378 rtx_pair.ssrc = rand(); | 382 rtx_pair.ssrc = prng->Rand<uint32_t>(); |
| 379 rtx_pair.payload_type = rand(); | 383 rtx_pair.payload_type = prng->Rand(0, 127); |
| 380 config->rtp.rtx.insert(std::make_pair(rand(), rtx_pair)); | 384 config->rtp.rtx.insert(std::make_pair(prng->Rand(0, 127), rtx_pair)); |
| 381 // Add header extensions. | 385 // Add header extensions. |
| 382 for (unsigned i = 0; i < kNumExtensions; i++) { | 386 for (unsigned i = 0; i < kNumExtensions; i++) { |
| 383 if (extensions_bitvector & (1u << i)) { | 387 if (extensions_bitvector & (1u << i)) { |
| 384 config->rtp.extensions.push_back( | 388 config->rtp.extensions.push_back( |
| 385 RtpExtension(kExtensionNames[i], rand())); | 389 RtpExtension(kExtensionNames[i], prng->Rand<int>())); |
| 386 } | 390 } |
| 387 } | 391 } |
| 388 } | 392 } |
| 389 | 393 |
| 390 void GenerateVideoSendConfig(uint32_t extensions_bitvector, | 394 void GenerateVideoSendConfig(uint32_t extensions_bitvector, |
| 391 VideoSendStream::Config* config) { | 395 VideoSendStream::Config* config, |
| 396 test::Random* prng) { |
| 392 // Create a map from a payload type to an encoder name. | 397 // Create a map from a payload type to an encoder name. |
| 393 config->encoder_settings.payload_type = rand(); | 398 config->encoder_settings.payload_type = prng->Rand(0, 127); |
| 394 config->encoder_settings.payload_name = (rand() % 2 ? "VP8" : "H264"); | 399 config->encoder_settings.payload_name = (prng->Rand<bool>() ? "VP8" : "H264"); |
| 395 // Add SSRCs for the stream. | 400 // Add SSRCs for the stream. |
| 396 config->rtp.ssrcs.push_back(rand()); | 401 config->rtp.ssrcs.push_back(prng->Rand<uint32_t>()); |
| 397 // Add a map from a payload type to new ssrcs and a new payload type for RTX. | 402 // Add a map from a payload type to new ssrcs and a new payload type for RTX. |
| 398 config->rtp.rtx.ssrcs.push_back(rand()); | 403 config->rtp.rtx.ssrcs.push_back(prng->Rand<uint32_t>()); |
| 399 config->rtp.rtx.payload_type = rand(); | 404 config->rtp.rtx.payload_type = prng->Rand(0, 127); |
| 400 // Add a CNAME. | 405 // Add a CNAME. |
| 401 config->rtp.c_name = "some.user@some.host"; | 406 config->rtp.c_name = "some.user@some.host"; |
| 402 // Add header extensions. | 407 // Add header extensions. |
| 403 for (unsigned i = 0; i < kNumExtensions; i++) { | 408 for (unsigned i = 0; i < kNumExtensions; i++) { |
| 404 if (extensions_bitvector & (1u << i)) { | 409 if (extensions_bitvector & (1u << i)) { |
| 405 config->rtp.extensions.push_back( | 410 config->rtp.extensions.push_back( |
| 406 RtpExtension(kExtensionNames[i], rand())); | 411 RtpExtension(kExtensionNames[i], prng->Rand<int>())); |
| 407 } | 412 } |
| 408 } | 413 } |
| 409 } | 414 } |
| 410 | 415 |
| 411 // Test for the RtcEventLog class. Dumps some RTP packets and other events | 416 // Test for the RtcEventLog class. Dumps some RTP packets and other events |
| 412 // to disk, then reads them back to see if they match. | 417 // to disk, then reads them back to see if they match. |
| 413 void LogSessionAndReadBack(size_t rtp_count, | 418 void LogSessionAndReadBack(size_t rtp_count, |
| 414 size_t rtcp_count, | 419 size_t rtcp_count, |
| 415 size_t playout_count, | 420 size_t playout_count, |
| 416 size_t bwe_loss_count, | 421 size_t bwe_loss_count, |
| 417 uint32_t extensions_bitvector, | 422 uint32_t extensions_bitvector, |
| 418 uint32_t csrcs_count, | 423 uint32_t csrcs_count, |
| 419 unsigned int random_seed) { | 424 unsigned int random_seed) { |
| 420 ASSERT_LE(rtcp_count, rtp_count); | 425 ASSERT_LE(rtcp_count, rtp_count); |
| 421 ASSERT_LE(playout_count, rtp_count); | 426 ASSERT_LE(playout_count, rtp_count); |
| 422 ASSERT_LE(bwe_loss_count, rtp_count); | 427 ASSERT_LE(bwe_loss_count, rtp_count); |
| 423 std::vector<rtc::Buffer> rtp_packets; | 428 std::vector<rtc::Buffer> rtp_packets; |
| 424 std::vector<rtc::Buffer> rtcp_packets; | 429 std::vector<rtc::Buffer> rtcp_packets; |
| 425 std::vector<size_t> rtp_header_sizes; | 430 std::vector<size_t> rtp_header_sizes; |
| 426 std::vector<uint32_t> playout_ssrcs; | 431 std::vector<uint32_t> playout_ssrcs; |
| 427 std::vector<std::pair<int32_t, uint8_t> > bwe_loss_updates; | 432 std::vector<std::pair<int32_t, uint8_t> > bwe_loss_updates; |
| 428 | 433 |
| 429 VideoReceiveStream::Config receiver_config(nullptr); | 434 VideoReceiveStream::Config receiver_config(nullptr); |
| 430 VideoSendStream::Config sender_config(nullptr); | 435 VideoSendStream::Config sender_config(nullptr); |
| 431 | 436 |
| 432 srand(random_seed); | 437 test::Random prng(random_seed); |
| 433 | 438 |
| 434 // Create rtp_count RTP packets containing random data. | 439 // Create rtp_count RTP packets containing random data. |
| 435 for (size_t i = 0; i < rtp_count; i++) { | 440 for (size_t i = 0; i < rtp_count; i++) { |
| 436 size_t packet_size = 1000 + rand() % 64; | 441 size_t packet_size = prng.Rand(1000, 1100); |
| 437 rtp_packets.push_back(rtc::Buffer(packet_size)); | 442 rtp_packets.push_back(rtc::Buffer(packet_size)); |
| 438 size_t header_size = GenerateRtpPacket(extensions_bitvector, csrcs_count, | 443 size_t header_size = |
| 439 rtp_packets[i].data(), packet_size); | 444 GenerateRtpPacket(extensions_bitvector, csrcs_count, |
| 445 rtp_packets[i].data(), packet_size, &prng); |
| 440 rtp_header_sizes.push_back(header_size); | 446 rtp_header_sizes.push_back(header_size); |
| 441 } | 447 } |
| 442 // Create rtcp_count RTCP packets containing random data. | 448 // Create rtcp_count RTCP packets containing random data. |
| 443 for (size_t i = 0; i < rtcp_count; i++) { | 449 for (size_t i = 0; i < rtcp_count; i++) { |
| 444 size_t packet_size = 1000 + rand() % 64; | 450 size_t packet_size = prng.Rand(1000, 1100); |
| 445 rtcp_packets.push_back(rtc::Buffer(packet_size)); | 451 rtcp_packets.push_back(rtc::Buffer(packet_size)); |
| 446 GenerateRtcpPacket(rtcp_packets[i].data(), packet_size); | 452 GenerateRtcpPacket(rtcp_packets[i].data(), packet_size, &prng); |
| 447 } | 453 } |
| 448 // Create playout_count random SSRCs to use when logging AudioPlayout events. | 454 // Create playout_count random SSRCs to use when logging AudioPlayout events. |
| 449 for (size_t i = 0; i < playout_count; i++) { | 455 for (size_t i = 0; i < playout_count; i++) { |
| 450 playout_ssrcs.push_back(static_cast<uint32_t>(rand())); | 456 playout_ssrcs.push_back(prng.Rand<uint32_t>()); |
| 451 } | 457 } |
| 452 // Create bwe_loss_count random bitrate updates for BwePacketLoss. | 458 // Create bwe_loss_count random bitrate updates for BwePacketLoss. |
| 453 for (size_t i = 0; i < bwe_loss_count; i++) { | 459 for (size_t i = 0; i < bwe_loss_count; i++) { |
| 454 bwe_loss_updates.push_back(std::pair<int32_t, uint8_t>(rand(), rand())); | 460 bwe_loss_updates.push_back(std::pair<int32_t, uint8_t>(rand(), rand())); |
| 455 } | 461 } |
| 456 // Create configurations for the video streams. | 462 // Create configurations for the video streams. |
| 457 GenerateVideoReceiveConfig(extensions_bitvector, &receiver_config); | 463 GenerateVideoReceiveConfig(extensions_bitvector, &receiver_config, &prng); |
| 458 GenerateVideoSendConfig(extensions_bitvector, &sender_config); | 464 GenerateVideoSendConfig(extensions_bitvector, &sender_config, &prng); |
| 459 const int config_count = 2; | 465 const int config_count = 2; |
| 460 | 466 |
| 461 // Find the name of the current test, in order to use it as a temporary | 467 // Find the name of the current test, in order to use it as a temporary |
| 462 // filename. | 468 // filename. |
| 463 auto test_info = ::testing::UnitTest::GetInstance()->current_test_info(); | 469 auto test_info = ::testing::UnitTest::GetInstance()->current_test_info(); |
| 464 const std::string temp_filename = | 470 const std::string temp_filename = |
| 465 test::OutputPath() + test_info->test_case_name() + test_info->name(); | 471 test::OutputPath() + test_info->test_case_name() + test_info->name(); |
| 466 | 472 |
| 467 // When log_dumper goes out of scope, it causes the log file to be flushed | 473 // When log_dumper goes out of scope, it causes the log file to be flushed |
| 468 // to disk. | 474 // to disk. |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 | 585 |
| 580 // Try all combinations of header extensions and up to 2 CSRCS. | 586 // Try all combinations of header extensions and up to 2 CSRCS. |
| 581 for (extensions = 0; extensions < (1u << kNumExtensions); extensions++) { | 587 for (extensions = 0; extensions < (1u << kNumExtensions); extensions++) { |
| 582 for (uint32_t csrcs_count = 0; csrcs_count < 3; csrcs_count++) { | 588 for (uint32_t csrcs_count = 0; csrcs_count < 3; csrcs_count++) { |
| 583 LogSessionAndReadBack(5 + extensions, // Number of RTP packets. | 589 LogSessionAndReadBack(5 + extensions, // Number of RTP packets. |
| 584 2 + csrcs_count, // Number of RTCP packets. | 590 2 + csrcs_count, // Number of RTCP packets. |
| 585 3 + csrcs_count, // Number of playout events. | 591 3 + csrcs_count, // Number of playout events. |
| 586 1 + csrcs_count, // Number of BWE loss events. | 592 1 + csrcs_count, // Number of BWE loss events. |
| 587 extensions, // Bit vector choosing extensions. | 593 extensions, // Bit vector choosing extensions. |
| 588 csrcs_count, // Number of contributing sources. | 594 csrcs_count, // Number of contributing sources. |
| 589 rand()); | 595 extensions + csrcs_count); // Random seed. |
| 590 } | 596 } |
| 591 } | 597 } |
| 592 } | 598 } |
| 593 | 599 |
| 594 // Tests that the event queue works correctly, i.e. drops old RTP, RTCP and | 600 // Tests that the event queue works correctly, i.e. drops old RTP, RTCP and |
| 595 // debug events, but keeps config events even if they are older than the limit. | 601 // debug events, but keeps config events even if they are older than the limit. |
| 596 void DropOldEvents(uint32_t extensions_bitvector, | 602 void DropOldEvents(uint32_t extensions_bitvector, |
| 597 uint32_t csrcs_count, | 603 uint32_t csrcs_count, |
| 598 unsigned int random_seed) { | 604 unsigned int random_seed) { |
| 599 rtc::Buffer old_rtp_packet; | 605 rtc::Buffer old_rtp_packet; |
| 600 rtc::Buffer recent_rtp_packet; | 606 rtc::Buffer recent_rtp_packet; |
| 601 rtc::Buffer old_rtcp_packet; | 607 rtc::Buffer old_rtcp_packet; |
| 602 rtc::Buffer recent_rtcp_packet; | 608 rtc::Buffer recent_rtcp_packet; |
| 603 | 609 |
| 604 VideoReceiveStream::Config receiver_config(nullptr); | 610 VideoReceiveStream::Config receiver_config(nullptr); |
| 605 VideoSendStream::Config sender_config(nullptr); | 611 VideoSendStream::Config sender_config(nullptr); |
| 606 | 612 |
| 607 srand(random_seed); | 613 test::Random prng(random_seed); |
| 608 | 614 |
| 609 // Create two RTP packets containing random data. | 615 // Create two RTP packets containing random data. |
| 610 size_t packet_size = 1000 + rand() % 64; | 616 size_t packet_size = prng.Rand(1000, 1100); |
| 611 old_rtp_packet.SetSize(packet_size); | 617 old_rtp_packet.SetSize(packet_size); |
| 612 GenerateRtpPacket(extensions_bitvector, csrcs_count, old_rtp_packet.data(), | 618 GenerateRtpPacket(extensions_bitvector, csrcs_count, old_rtp_packet.data(), |
| 613 packet_size); | 619 packet_size, &prng); |
| 614 packet_size = 1000 + rand() % 64; | 620 packet_size = prng.Rand(1000, 1100); |
| 615 recent_rtp_packet.SetSize(packet_size); | 621 recent_rtp_packet.SetSize(packet_size); |
| 616 size_t recent_header_size = GenerateRtpPacket( | 622 size_t recent_header_size = |
| 617 extensions_bitvector, csrcs_count, recent_rtp_packet.data(), packet_size); | 623 GenerateRtpPacket(extensions_bitvector, csrcs_count, |
| 624 recent_rtp_packet.data(), packet_size, &prng); |
| 618 | 625 |
| 619 // Create two RTCP packets containing random data. | 626 // Create two RTCP packets containing random data. |
| 620 packet_size = 1000 + rand() % 64; | 627 packet_size = prng.Rand(1000, 1100); |
| 621 old_rtcp_packet.SetSize(packet_size); | 628 old_rtcp_packet.SetSize(packet_size); |
| 622 GenerateRtcpPacket(old_rtcp_packet.data(), packet_size); | 629 GenerateRtcpPacket(old_rtcp_packet.data(), packet_size, &prng); |
| 623 packet_size = 1000 + rand() % 64; | 630 packet_size = prng.Rand(1000, 1100); |
| 624 recent_rtcp_packet.SetSize(packet_size); | 631 recent_rtcp_packet.SetSize(packet_size); |
| 625 GenerateRtcpPacket(recent_rtcp_packet.data(), packet_size); | 632 GenerateRtcpPacket(recent_rtcp_packet.data(), packet_size, &prng); |
| 626 | 633 |
| 627 // Create configurations for the video streams. | 634 // Create configurations for the video streams. |
| 628 GenerateVideoReceiveConfig(extensions_bitvector, &receiver_config); | 635 GenerateVideoReceiveConfig(extensions_bitvector, &receiver_config, &prng); |
| 629 GenerateVideoSendConfig(extensions_bitvector, &sender_config); | 636 GenerateVideoSendConfig(extensions_bitvector, &sender_config, &prng); |
| 630 | 637 |
| 631 // Find the name of the current test, in order to use it as a temporary | 638 // Find the name of the current test, in order to use it as a temporary |
| 632 // filename. | 639 // filename. |
| 633 auto test_info = ::testing::UnitTest::GetInstance()->current_test_info(); | 640 auto test_info = ::testing::UnitTest::GetInstance()->current_test_info(); |
| 634 const std::string temp_filename = | 641 const std::string temp_filename = |
| 635 test::OutputPath() + test_info->test_case_name() + test_info->name(); | 642 test::OutputPath() + test_info->test_case_name() + test_info->name(); |
| 636 | 643 |
| 637 // The log file will be flushed to disk when the log_dumper goes out of scope. | 644 // The log file will be flushed to disk when the log_dumper goes out of scope. |
| 638 { | 645 { |
| 639 rtc::scoped_ptr<RtcEventLog> log_dumper(RtcEventLog::Create()); | 646 rtc::scoped_ptr<RtcEventLog> log_dumper(RtcEventLog::Create()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 // Enable all header extensions | 687 // Enable all header extensions |
| 681 uint32_t extensions = (1u << kNumExtensions) - 1; | 688 uint32_t extensions = (1u << kNumExtensions) - 1; |
| 682 uint32_t csrcs_count = 2; | 689 uint32_t csrcs_count = 2; |
| 683 DropOldEvents(extensions, csrcs_count, 141421356); | 690 DropOldEvents(extensions, csrcs_count, 141421356); |
| 684 DropOldEvents(extensions, csrcs_count, 173205080); | 691 DropOldEvents(extensions, csrcs_count, 173205080); |
| 685 } | 692 } |
| 686 | 693 |
| 687 } // namespace webrtc | 694 } // namespace webrtc |
| 688 | 695 |
| 689 #endif // ENABLE_RTC_EVENT_LOG | 696 #endif // ENABLE_RTC_EVENT_LOG |
| OLD | NEW |