diff --git a/webrtc/test/rtp_file_reader.cc b/webrtc/test/rtp_file_reader.cc index d437d41924..c4fd42dd05 100644 --- a/webrtc/test/rtp_file_reader.cc +++ b/webrtc/test/rtp_file_reader.cc @@ -19,6 +19,7 @@ #include "webrtc/base/checks.h" #include "webrtc/base/constructormagic.h" #include "webrtc/base/format_macros.h" +#include "webrtc/base/logging.h" #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" namespace webrtc { @@ -27,18 +28,10 @@ namespace test { static const size_t kFirstLineLength = 40; static uint16_t kPacketHeaderSize = 8; -#if 1 -# define DEBUG_LOG(text) -# define DEBUG_LOG1(text, arg) -#else -# define DEBUG_LOG(text) (printf(text "\n")) -# define DEBUG_LOG1(text, arg) (printf(text "\n", arg)) -#endif - #define TRY(expr) \ do { \ if (!(expr)) { \ - DEBUG_LOG1("FAIL at " __FILE__ ":%d", __LINE__); \ + LOG(LS_INFO) << "Failed to read"; \ return false; \ } \ } while (0) @@ -139,21 +132,21 @@ class RtpDumpReader : public RtpFileReaderImpl { char firstline[kFirstLineLength + 1] = {0}; if (fgets(firstline, kFirstLineLength, file_) == NULL) { - DEBUG_LOG("ERROR: Can't read from file\n"); + LOG(LS_INFO) << "Can't read from file"; return false; } if (strncmp(firstline, "#!rtpplay", 9) == 0) { if (strncmp(firstline, "#!rtpplay1.0", 12) != 0) { - DEBUG_LOG("ERROR: wrong rtpplay version, must be 1.0\n"); + LOG(LS_INFO) << "Wrong rtpplay version, must be 1.0"; return false; } } else if (strncmp(firstline, "#!RTPencode", 11) == 0) { if (strncmp(firstline, "#!RTPencode1.0", 14) != 0) { - DEBUG_LOG("ERROR: wrong RTPencode version, must be 1.0\n"); + LOG(LS_INFO) << "Wrong RTPencode version, must be 1.0"; return false; } } else { - DEBUG_LOG("ERROR: wrong file format of input file\n"); + LOG(LS_INFO) << "Wrong file format of input file"; return false; } @@ -236,7 +229,7 @@ const uint32_t kPcapBOMNoSwapOrder = 0xa1b2c3d4UL; do { \ int r = (expr); \ if (r == kResultFail) { \ - DEBUG_LOG1("FAIL at " __FILE__ ":%d", __LINE__); \ + LOG(LS_INFO) << "FAIL at " << __FILE__ << ":" << __LINE__; \ return kResultFail; \ } else if (r == kResultSkip) { \ return kResultSkip; \ @@ -459,7 +452,7 @@ class PcapReader : public RtpFileReaderImpl { packets_.push_back(marker); } else { if (!rtp_parser.Parse(&marker.rtp_header, nullptr)) { - DEBUG_LOG("Not recognized as RTP/RTCP"); + LOG(LS_INFO) << "Not recognized as RTP/RTCP"; return kResultSkip; } @@ -487,7 +480,7 @@ class PcapReader : public RtpFileReaderImpl { TRY_PCAP(Read(&protocol, true)); if (protocol == kBsdNullLoopback1 || protocol == kBsdNullLoopback2) { int result = ReadXxpIpHeader(marker); - DEBUG_LOG("Recognized loopback frame"); + LOG(LS_INFO) << "Recognized loopback frame"; if (result != kResultSkip) { return result; } @@ -501,7 +494,7 @@ class PcapReader : public RtpFileReaderImpl { TRY_PCAP(Read(&type, true)); if (type == kEthertypeIp) { int result = ReadXxpIpHeader(marker); - DEBUG_LOG("Recognized ethernet 2 frame"); + LOG(LS_INFO) << "Recognized ethernet 2 frame"; if (result != kResultSkip) { return result; } @@ -541,13 +534,13 @@ class PcapReader : public RtpFileReaderImpl { TRY_PCAP(Read(&marker->dest_ip, true)); if (((version >> 12) & 0x000f) != kIpVersion4) { - DEBUG_LOG("IP header is not IPv4"); + LOG(LS_INFO) << "IP header is not IPv4"; return kResultSkip; } if (fragment != kFragmentOffsetClear && fragment != kFragmentOffsetDoNotFragment) { - DEBUG_LOG("IP fragments cannot be handled"); + LOG(LS_INFO) << "IP fragments cannot be handled"; return kResultSkip; } @@ -558,7 +551,7 @@ class PcapReader : public RtpFileReaderImpl { protocol = protocol & 0x00ff; if (protocol == kProtocolTcp) { - DEBUG_LOG("TCP packets are not handled"); + LOG(LS_INFO) << "TCP packets are not handled"; return kResultSkip; } else if (protocol == kProtocolUdp) { uint16_t length; @@ -569,7 +562,7 @@ class PcapReader : public RtpFileReaderImpl { TRY_PCAP(Read(&checksum, true)); marker->payload_length = length - kUdpHeaderLength; } else { - DEBUG_LOG("Unknown transport (expected UDP or TCP)"); + LOG(LS_INFO) << "Unknown transport (expected UDP or TCP)"; return kResultSkip; } diff --git a/webrtc/video/BUILD.gn b/webrtc/video/BUILD.gn index 312f3f450c..87a9800b85 100644 --- a/webrtc/video/BUILD.gn +++ b/webrtc/video/BUILD.gn @@ -134,8 +134,6 @@ if (rtc_include_tests) { "../test:run_test", "../test:test_common", "../test:test_renderer", - "//testing/gmock", - "//testing/gtest", "//third_party/gflags", ] if (!build_with_chromium && is_clang) { @@ -145,6 +143,28 @@ if (rtc_include_tests) { } } + rtc_executable("video_replay") { + testonly = true + sources = [ + "replay.cc", + ] + deps = [ + "../system_wrappers:metrics_default", + "../test:field_trial", + "../test:run_test", + "../test:test_common", + "../test:test_renderer", + "//third_party/gflags", + ] + if (!is_android) { + deps += [ "../modules/video_capture:video_capture_internal_impl" ] + } + if (!build_with_chromium && is_clang) { + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). + suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] + } + } + # TODO(pbos): Rename test suite. rtc_source_set("video_tests") { testonly = true diff --git a/webrtc/video/replay.cc b/webrtc/video/replay.cc index 2a73917551..aa844605dd 100644 --- a/webrtc/video/replay.cc +++ b/webrtc/video/replay.cc @@ -18,6 +18,7 @@ #include "webrtc/base/checks.h" #include "webrtc/call/call.h" #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" +#include "webrtc/logging/rtc_event_log/rtc_event_log.h" #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" #include "webrtc/system_wrappers/include/clock.h" #include "webrtc/system_wrappers/include/sleep.h" @@ -211,7 +212,8 @@ void RtpReplay() { FileRenderPassthrough file_passthrough(flags::OutBase(), playback_video.get()); - std::unique_ptr call(Call::Create(Call::Config())); + webrtc::RtcEventLogNullImpl event_log; + std::unique_ptr call(Call::Create(Call::Config(&event_log))); test::NullTransport transport; VideoReceiveStream::Config receive_config(&transport);