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

Side by Side Diff: webrtc/video/rtc_event_log_unittest.cc

Issue 1340283002: Added support for logging the SSRC corresponding to AudioPlayout events. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added missing include and changed CHECK_EQ to RTC_CHECK_EQ. Created 5 years, 3 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
« no previous file with comments | « webrtc/video/rtc_event_log.proto ('k') | webrtc/voice_engine/channel.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 EXPECT_EQ(incoming, rtcp_packet.incoming()); 258 EXPECT_EQ(incoming, rtcp_packet.incoming());
259 ASSERT_TRUE(rtcp_packet.has_type()); 259 ASSERT_TRUE(rtcp_packet.has_type());
260 EXPECT_EQ(media_type, GetRuntimeMediaType(rtcp_packet.type())); 260 EXPECT_EQ(media_type, GetRuntimeMediaType(rtcp_packet.type()));
261 ASSERT_TRUE(rtcp_packet.has_packet_data()); 261 ASSERT_TRUE(rtcp_packet.has_packet_data());
262 ASSERT_EQ(total_size, rtcp_packet.packet_data().size()); 262 ASSERT_EQ(total_size, rtcp_packet.packet_data().size());
263 for (size_t i = 0; i < total_size; i++) { 263 for (size_t i = 0; i < total_size; i++) {
264 EXPECT_EQ(packet[i], static_cast<uint8_t>(rtcp_packet.packet_data()[i])); 264 EXPECT_EQ(packet[i], static_cast<uint8_t>(rtcp_packet.packet_data()[i]));
265 } 265 }
266 } 266 }
267 267
268 void VerifyPlayoutEvent(const rtclog::Event& event) { 268 void VerifyPlayoutEvent(const rtclog::Event& event, uint32_t ssrc) {
269 ASSERT_TRUE(IsValidBasicEvent(event)); 269 ASSERT_TRUE(IsValidBasicEvent(event));
270 ASSERT_EQ(rtclog::Event::DEBUG_EVENT, event.type()); 270 ASSERT_EQ(rtclog::Event::DEBUG_EVENT, event.type());
271 const rtclog::DebugEvent& debug_event = event.debug_event(); 271 const rtclog::DebugEvent& debug_event = event.debug_event();
272 ASSERT_TRUE(debug_event.has_type()); 272 ASSERT_TRUE(debug_event.has_type());
273 EXPECT_EQ(rtclog::DebugEvent::AUDIO_PLAYOUT, debug_event.type()); 273 EXPECT_EQ(rtclog::DebugEvent::AUDIO_PLAYOUT, debug_event.type());
274 ASSERT_TRUE(debug_event.has_local_ssrc());
275 EXPECT_EQ(ssrc, debug_event.local_ssrc());
274 } 276 }
275 277
276 void VerifyLogStartEvent(const rtclog::Event& event) { 278 void VerifyLogStartEvent(const rtclog::Event& event) {
277 ASSERT_TRUE(IsValidBasicEvent(event)); 279 ASSERT_TRUE(IsValidBasicEvent(event));
278 ASSERT_EQ(rtclog::Event::DEBUG_EVENT, event.type()); 280 ASSERT_EQ(rtclog::Event::DEBUG_EVENT, event.type());
279 const rtclog::DebugEvent& debug_event = event.debug_event(); 281 const rtclog::DebugEvent& debug_event = event.debug_event();
280 ASSERT_TRUE(debug_event.has_type()); 282 ASSERT_TRUE(debug_event.has_type());
281 EXPECT_EQ(rtclog::DebugEvent::LOG_START, debug_event.type()); 283 EXPECT_EQ(rtclog::DebugEvent::LOG_START, debug_event.type());
282 } 284 }
283 285
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 size_t rtcp_count, 402 size_t rtcp_count,
401 size_t debug_count, 403 size_t debug_count,
402 uint32_t extensions_bitvector, 404 uint32_t extensions_bitvector,
403 uint32_t csrcs_count, 405 uint32_t csrcs_count,
404 unsigned random_seed) { 406 unsigned random_seed) {
405 ASSERT_LE(rtcp_count, rtp_count); 407 ASSERT_LE(rtcp_count, rtp_count);
406 ASSERT_LE(debug_count, rtp_count); 408 ASSERT_LE(debug_count, rtp_count);
407 std::vector<rtc::Buffer> rtp_packets; 409 std::vector<rtc::Buffer> rtp_packets;
408 std::vector<rtc::Buffer> rtcp_packets; 410 std::vector<rtc::Buffer> rtcp_packets;
409 std::vector<size_t> rtp_header_sizes; 411 std::vector<size_t> rtp_header_sizes;
412 std::vector<uint32_t> playout_ssrcs;
410 413
411 VideoReceiveStream::Config receiver_config(nullptr); 414 VideoReceiveStream::Config receiver_config(nullptr);
412 VideoSendStream::Config sender_config(nullptr); 415 VideoSendStream::Config sender_config(nullptr);
413 416
414 srand(random_seed); 417 srand(random_seed);
415 418
416 // Create rtp_count RTP packets containing random data. 419 // Create rtp_count RTP packets containing random data.
417 for (size_t i = 0; i < rtp_count; i++) { 420 for (size_t i = 0; i < rtp_count; i++) {
418 size_t packet_size = 1000 + rand() % 64; 421 size_t packet_size = 1000 + rand() % 64;
419 rtp_packets.push_back(rtc::Buffer(packet_size)); 422 rtp_packets.push_back(rtc::Buffer(packet_size));
420 size_t header_size = GenerateRtpPacket(extensions_bitvector, csrcs_count, 423 size_t header_size = GenerateRtpPacket(extensions_bitvector, csrcs_count,
421 rtp_packets[i].data(), packet_size); 424 rtp_packets[i].data(), packet_size);
422 rtp_header_sizes.push_back(header_size); 425 rtp_header_sizes.push_back(header_size);
423 } 426 }
424 // Create rtcp_count RTCP packets containing random data. 427 // Create rtcp_count RTCP packets containing random data.
425 for (size_t i = 0; i < rtcp_count; i++) { 428 for (size_t i = 0; i < rtcp_count; i++) {
426 size_t packet_size = 1000 + rand() % 64; 429 size_t packet_size = 1000 + rand() % 64;
427 rtcp_packets.push_back(rtc::Buffer(packet_size)); 430 rtcp_packets.push_back(rtc::Buffer(packet_size));
428 GenerateRtcpPacket(rtcp_packets[i].data(), packet_size); 431 GenerateRtcpPacket(rtcp_packets[i].data(), packet_size);
429 } 432 }
433 // Create debug_count random SSRCs to use when logging AudioPlayout events.
434 for (size_t i = 0; i < debug_count; i++) {
435 playout_ssrcs.push_back(static_cast<uint32_t>(rand()));
436 }
430 // Create configurations for the video streams. 437 // Create configurations for the video streams.
431 GenerateVideoReceiveConfig(extensions_bitvector, &receiver_config); 438 GenerateVideoReceiveConfig(extensions_bitvector, &receiver_config);
432 GenerateVideoSendConfig(extensions_bitvector, &sender_config); 439 GenerateVideoSendConfig(extensions_bitvector, &sender_config);
433 const int config_count = 2; 440 const int config_count = 2;
434 441
435 // Find the name of the current test, in order to use it as a temporary 442 // Find the name of the current test, in order to use it as a temporary
436 // filename. 443 // filename.
437 auto test_info = ::testing::UnitTest::GetInstance()->current_test_info(); 444 auto test_info = ::testing::UnitTest::GetInstance()->current_test_info();
438 const std::string temp_filename = 445 const std::string temp_filename =
439 test::OutputPath() + test_info->test_case_name() + test_info->name(); 446 test::OutputPath() + test_info->test_case_name() + test_info->name();
(...skipping 12 matching lines...) Expand all
452 rtp_packets[i - 1].data(), rtp_packets[i - 1].size()); 459 rtp_packets[i - 1].data(), rtp_packets[i - 1].size());
453 if (i * rtcp_count >= rtcp_index * rtp_count) { 460 if (i * rtcp_count >= rtcp_index * rtp_count) {
454 log_dumper->LogRtcpPacket( 461 log_dumper->LogRtcpPacket(
455 rtcp_index % 2 == 0, // Every second packet is incoming 462 rtcp_index % 2 == 0, // Every second packet is incoming
456 rtcp_index % 3 == 0 ? MediaType::AUDIO : MediaType::VIDEO, 463 rtcp_index % 3 == 0 ? MediaType::AUDIO : MediaType::VIDEO,
457 rtcp_packets[rtcp_index - 1].data(), 464 rtcp_packets[rtcp_index - 1].data(),
458 rtcp_packets[rtcp_index - 1].size()); 465 rtcp_packets[rtcp_index - 1].size());
459 rtcp_index++; 466 rtcp_index++;
460 } 467 }
461 if (i * debug_count >= debug_index * rtp_count) { 468 if (i * debug_count >= debug_index * rtp_count) {
462 log_dumper->LogDebugEvent(RtcEventLog::DebugEvent::kAudioPlayout); 469 log_dumper->LogAudioPlayout(playout_ssrcs[debug_index - 1]);
463 debug_index++; 470 debug_index++;
464 } 471 }
465 if (i == rtp_count / 2) { 472 if (i == rtp_count / 2) {
466 log_dumper->StartLogging(temp_filename, 10000000); 473 log_dumper->StartLogging(temp_filename, 10000000);
467 } 474 }
468 } 475 }
469 } 476 }
470 477
471 // Read the generated file from disk. 478 // Read the generated file from disk.
472 rtclog::EventStream parsed_stream; 479 rtclog::EventStream parsed_stream;
(...skipping 17 matching lines...) Expand all
490 if (i * rtcp_count >= rtcp_index * rtp_count) { 497 if (i * rtcp_count >= rtcp_index * rtp_count) {
491 VerifyRtcpEvent(parsed_stream.stream(event_index), 498 VerifyRtcpEvent(parsed_stream.stream(event_index),
492 rtcp_index % 2 == 0, // Every second packet is incoming. 499 rtcp_index % 2 == 0, // Every second packet is incoming.
493 rtcp_index % 3 == 0 ? MediaType::AUDIO : MediaType::VIDEO, 500 rtcp_index % 3 == 0 ? MediaType::AUDIO : MediaType::VIDEO,
494 rtcp_packets[rtcp_index - 1].data(), 501 rtcp_packets[rtcp_index - 1].data(),
495 rtcp_packets[rtcp_index - 1].size()); 502 rtcp_packets[rtcp_index - 1].size());
496 event_index++; 503 event_index++;
497 rtcp_index++; 504 rtcp_index++;
498 } 505 }
499 if (i * debug_count >= debug_index * rtp_count) { 506 if (i * debug_count >= debug_index * rtp_count) {
500 VerifyPlayoutEvent(parsed_stream.stream(event_index)); 507 VerifyPlayoutEvent(parsed_stream.stream(event_index),
508 playout_ssrcs[debug_index - 1]);
501 event_index++; 509 event_index++;
502 debug_index++; 510 debug_index++;
503 } 511 }
504 if (i == rtp_count / 2) { 512 if (i == rtp_count / 2) {
505 VerifyLogStartEvent(parsed_stream.stream(event_index)); 513 VerifyLogStartEvent(parsed_stream.stream(event_index));
506 event_index++; 514 event_index++;
507 } 515 }
508 } 516 }
509 517
510 // Clean up temporary file - can be pretty slow. 518 // Clean up temporary file - can be pretty slow.
(...skipping 27 matching lines...) Expand all
538 extensions, // Bit vector choosing extensions 546 extensions, // Bit vector choosing extensions
539 csrcs_count, // Number of contributing sources 547 csrcs_count, // Number of contributing sources
540 rand()); 548 rand());
541 } 549 }
542 } 550 }
543 } 551 }
544 552
545 } // namespace webrtc 553 } // namespace webrtc
546 554
547 #endif // ENABLE_RTC_EVENT_LOG 555 #endif // ENABLE_RTC_EVENT_LOG
OLDNEW
« no previous file with comments | « webrtc/video/rtc_event_log.proto ('k') | webrtc/voice_engine/channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698