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 <memory> |
13 #include <string> | 14 #include <string> |
14 #include <utility> | 15 #include <utility> |
15 #include <vector> | 16 #include <vector> |
16 | 17 |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "webrtc/base/buffer.h" | 19 #include "webrtc/base/buffer.h" |
19 #include "webrtc/base/checks.h" | 20 #include "webrtc/base/checks.h" |
20 #include "webrtc/base/random.h" | 21 #include "webrtc/base/random.h" |
21 #include "webrtc/base/scoped_ptr.h" | |
22 #include "webrtc/base/thread.h" | 22 #include "webrtc/base/thread.h" |
23 #include "webrtc/call.h" | 23 #include "webrtc/call.h" |
24 #include "webrtc/call/rtc_event_log.h" | 24 #include "webrtc/call/rtc_event_log.h" |
25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" | 25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" |
26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" | 26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" |
27 #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h" | 27 #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h" |
28 #include "webrtc/system_wrappers/include/clock.h" | 28 #include "webrtc/system_wrappers/include/clock.h" |
29 #include "webrtc/test/test_suite.h" | 29 #include "webrtc/test/test_suite.h" |
30 #include "webrtc/test/testsupport/fileutils.h" | 30 #include "webrtc/test/testsupport/fileutils.h" |
31 | 31 |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 | 466 |
467 // 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 |
468 // filename. | 468 // filename. |
469 auto test_info = ::testing::UnitTest::GetInstance()->current_test_info(); | 469 auto test_info = ::testing::UnitTest::GetInstance()->current_test_info(); |
470 const std::string temp_filename = | 470 const std::string temp_filename = |
471 test::OutputPath() + test_info->test_case_name() + test_info->name(); | 471 test::OutputPath() + test_info->test_case_name() + test_info->name(); |
472 | 472 |
473 // 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 |
474 // to disk. | 474 // to disk. |
475 { | 475 { |
476 rtc::scoped_ptr<RtcEventLog> log_dumper(RtcEventLog::Create()); | 476 std::unique_ptr<RtcEventLog> log_dumper(RtcEventLog::Create()); |
477 log_dumper->LogVideoReceiveStreamConfig(receiver_config); | 477 log_dumper->LogVideoReceiveStreamConfig(receiver_config); |
478 log_dumper->LogVideoSendStreamConfig(sender_config); | 478 log_dumper->LogVideoSendStreamConfig(sender_config); |
479 size_t rtcp_index = 1; | 479 size_t rtcp_index = 1; |
480 size_t playout_index = 1; | 480 size_t playout_index = 1; |
481 size_t bwe_loss_index = 1; | 481 size_t bwe_loss_index = 1; |
482 for (size_t i = 1; i <= rtp_count; i++) { | 482 for (size_t i = 1; i <= rtp_count; i++) { |
483 log_dumper->LogRtpHeader( | 483 log_dumper->LogRtpHeader( |
484 (i % 2 == 0) ? kIncomingPacket : kOutgoingPacket, | 484 (i % 2 == 0) ? kIncomingPacket : kOutgoingPacket, |
485 (i % 3 == 0) ? MediaType::AUDIO : MediaType::VIDEO, | 485 (i % 3 == 0) ? MediaType::AUDIO : MediaType::VIDEO, |
486 rtp_packets[i - 1].data(), rtp_packets[i - 1].size()); | 486 rtp_packets[i - 1].data(), rtp_packets[i - 1].size()); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 GenerateVideoSendConfig(extensions_bitvector, &sender_config, &prng); | 632 GenerateVideoSendConfig(extensions_bitvector, &sender_config, &prng); |
633 | 633 |
634 // Find the name of the current test, in order to use it as a temporary | 634 // Find the name of the current test, in order to use it as a temporary |
635 // filename. | 635 // filename. |
636 auto test_info = ::testing::UnitTest::GetInstance()->current_test_info(); | 636 auto test_info = ::testing::UnitTest::GetInstance()->current_test_info(); |
637 const std::string temp_filename = | 637 const std::string temp_filename = |
638 test::OutputPath() + test_info->test_case_name() + test_info->name(); | 638 test::OutputPath() + test_info->test_case_name() + test_info->name(); |
639 | 639 |
640 // The log file will be flushed to disk when the log_dumper goes out of scope. | 640 // The log file will be flushed to disk when the log_dumper goes out of scope. |
641 { | 641 { |
642 rtc::scoped_ptr<RtcEventLog> log_dumper(RtcEventLog::Create()); | 642 std::unique_ptr<RtcEventLog> log_dumper(RtcEventLog::Create()); |
643 // Reduce the time old events are stored to 50 ms. | 643 // Reduce the time old events are stored to 50 ms. |
644 log_dumper->SetBufferDuration(50000); | 644 log_dumper->SetBufferDuration(50000); |
645 log_dumper->LogVideoReceiveStreamConfig(receiver_config); | 645 log_dumper->LogVideoReceiveStreamConfig(receiver_config); |
646 log_dumper->LogVideoSendStreamConfig(sender_config); | 646 log_dumper->LogVideoSendStreamConfig(sender_config); |
647 log_dumper->LogRtpHeader(kOutgoingPacket, MediaType::AUDIO, | 647 log_dumper->LogRtpHeader(kOutgoingPacket, MediaType::AUDIO, |
648 old_rtp_packet.data(), old_rtp_packet.size()); | 648 old_rtp_packet.data(), old_rtp_packet.size()); |
649 log_dumper->LogRtcpPacket(kIncomingPacket, MediaType::AUDIO, | 649 log_dumper->LogRtcpPacket(kIncomingPacket, MediaType::AUDIO, |
650 old_rtcp_packet.data(), | 650 old_rtcp_packet.data(), |
651 old_rtcp_packet.size()); | 651 old_rtcp_packet.size()); |
652 // Sleep 55 ms to let old events be removed from the queue. | 652 // Sleep 55 ms to let old events be removed from the queue. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 // Enable all header extensions | 685 // Enable all header extensions |
686 uint32_t extensions = (1u << kNumExtensions) - 1; | 686 uint32_t extensions = (1u << kNumExtensions) - 1; |
687 uint32_t csrcs_count = 2; | 687 uint32_t csrcs_count = 2; |
688 DropOldEvents(extensions, csrcs_count, 141421356); | 688 DropOldEvents(extensions, csrcs_count, 141421356); |
689 DropOldEvents(extensions, csrcs_count, 173205080); | 689 DropOldEvents(extensions, csrcs_count, 173205080); |
690 } | 690 } |
691 | 691 |
692 } // namespace webrtc | 692 } // namespace webrtc |
693 | 693 |
694 #endif // ENABLE_RTC_EVENT_LOG | 694 #endif // ENABLE_RTC_EVENT_LOG |
OLD | NEW |