From 863f03ba38f397c078931d2bd27d40a4d60efc02 Mon Sep 17 00:00:00 2001 From: ilnik Date: Tue, 11 Jul 2017 02:38:36 -0700 Subject: [PATCH] Fix video_replay tool to respect RTX stream and fix default parameters. Defaults are consistent with these used in CallTest. BUG=none Review-Url: https://codereview.webrtc.org/2972423002 Cr-Commit-Position: refs/heads/master@{#18961} --- webrtc/test/call_test.cc | 3 +++ webrtc/test/call_test.h | 3 +++ webrtc/video/replay.cc | 25 +++++++++++++++++++++++-- webrtc/video/video_quality_test.cc | 9 +++------ 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/webrtc/test/call_test.cc b/webrtc/test/call_test.cc index c1db322bd8..893d7e07de 100644 --- a/webrtc/test/call_test.cc +++ b/webrtc/test/call_test.cc @@ -427,6 +427,9 @@ const uint8_t CallTest::kRtxRedPayloadType = 99; const uint8_t CallTest::kUlpfecPayloadType = 119; const uint8_t CallTest::kFlexfecPayloadType = 120; const uint8_t CallTest::kAudioSendPayloadType = 103; +const uint8_t CallTest::kPayloadTypeH264 = 122; +const uint8_t CallTest::kPayloadTypeVP8 = 123; +const uint8_t CallTest::kPayloadTypeVP9 = 124; const uint32_t CallTest::kSendRtxSsrcs[kNumSsrcs] = {0xBADCAFD, 0xBADCAFE, 0xBADCAFF}; const uint32_t CallTest::kVideoSendSsrcs[kNumSsrcs] = {0xC0FFED, 0xC0FFEE, diff --git a/webrtc/test/call_test.h b/webrtc/test/call_test.h index 215d8aa431..5c4fdcec28 100644 --- a/webrtc/test/call_test.h +++ b/webrtc/test/call_test.h @@ -50,6 +50,9 @@ class CallTest : public ::testing::Test { static const uint8_t kUlpfecPayloadType; static const uint8_t kFlexfecPayloadType; static const uint8_t kAudioSendPayloadType; + static const uint8_t kPayloadTypeH264; + static const uint8_t kPayloadTypeVP8; + static const uint8_t kPayloadTypeVP9; static const uint32_t kSendRtxSsrcs[kNumSsrcs]; static const uint32_t kVideoSendSsrcs[kNumSsrcs]; static const uint32_t kAudioSendSsrc; diff --git a/webrtc/video/replay.cc b/webrtc/video/replay.cc index 915f5880f9..736db449cc 100644 --- a/webrtc/video/replay.cc +++ b/webrtc/video/replay.cc @@ -23,6 +23,7 @@ #include "webrtc/rtc_base/checks.h" #include "webrtc/system_wrappers/include/clock.h" #include "webrtc/system_wrappers/include/sleep.h" +#include "webrtc/test/call_test.h" #include "webrtc/test/encoder_settings.h" #include "webrtc/test/fake_decoder.h" #include "webrtc/test/gtest.h" @@ -43,21 +44,38 @@ namespace flags { static bool ValidatePayloadType(const char* flagname, int32_t payload_type) { return payload_type > 0 && payload_type <= 127; } -DEFINE_int32(payload_type, 0, "Payload type"); +DEFINE_int32(payload_type, test::CallTest::kPayloadTypeVP8, "Payload type"); static int PayloadType() { return static_cast(FLAGS_payload_type); } static const bool payload_dummy = google::RegisterFlagValidator(&FLAGS_payload_type, &ValidatePayloadType); +DEFINE_int32(payload_type_rtx, + test::CallTest::kSendRtxPayloadType, + "RTX payload type"); +static int PayloadTypeRtx() { + return static_cast(FLAGS_payload_type_rtx); +} +static const bool payload_rtx_dummy = + google::RegisterFlagValidator(&FLAGS_payload_type_rtx, + &ValidatePayloadType); + // Flag for SSRC. static bool ValidateSsrc(const char* flagname, uint64_t ssrc) { return ssrc > 0 && ssrc <= 0xFFFFFFFFu; } -DEFINE_uint64(ssrc, 0, "Incoming SSRC"); +DEFINE_uint64(ssrc, test::CallTest::kVideoSendSsrcs[0], "Incoming SSRC"); static uint32_t Ssrc() { return static_cast(FLAGS_ssrc); } static const bool ssrc_dummy = google::RegisterFlagValidator(&FLAGS_ssrc, &ValidateSsrc); +DEFINE_uint64(ssrc_rtx, test::CallTest::kSendRtxSsrcs[0], "Incoming RTX SSRC"); +static uint32_t SsrcRtx() { + return static_cast(FLAGS_ssrc_rtx); +} +static const bool ssrc_rtx_dummy = + google::RegisterFlagValidator(&FLAGS_ssrc_rtx, &ValidateSsrc); + static bool ValidateOptionalPayloadType(const char* flagname, int32_t payload_type) { return payload_type == -1 || ValidatePayloadType(flagname, payload_type); @@ -219,6 +237,9 @@ void RtpReplay() { VideoReceiveStream::Config receive_config(&transport); receive_config.rtp.remote_ssrc = flags::Ssrc(); receive_config.rtp.local_ssrc = kReceiverLocalSsrc; + receive_config.rtp.rtx_ssrc = flags::SsrcRtx(); + receive_config.rtp.rtx_payload_types[flags::PayloadType()] = + flags::PayloadTypeRtx(); receive_config.rtp.ulpfec.ulpfec_payload_type = flags::FecPayloadType(); receive_config.rtp.ulpfec.red_payload_type = flags::RedPayloadType(); receive_config.rtp.nack.rtp_history_ms = 1000; diff --git a/webrtc/video/video_quality_test.cc b/webrtc/video/video_quality_test.cc index 4b16df7428..49a758956b 100644 --- a/webrtc/video/video_quality_test.cc +++ b/webrtc/video/video_quality_test.cc @@ -52,9 +52,6 @@ namespace { constexpr int kSendStatsPollingIntervalMs = 1000; -constexpr int kPayloadTypeH264 = 122; -constexpr int kPayloadTypeVP8 = 123; -constexpr int kPayloadTypeVP9 = 124; constexpr size_t kMaxComparisons = 10; constexpr char kSyncGroup[] = "av_sync"; @@ -588,15 +585,15 @@ class VideoAnalyzer : public PacketReceiver, bool IsInSelectedSpatialAndTemporalLayer(const uint8_t* packet, size_t length, const RTPHeader& header) { - if (header.payloadType != kPayloadTypeVP9 && - header.payloadType != kPayloadTypeVP8) { + if (header.payloadType != test::CallTest::kPayloadTypeVP9 && + header.payloadType != test::CallTest::kPayloadTypeVP8) { return true; } else { // Get VP8 and VP9 specific header to check layers indexes. const uint8_t* payload = packet + header.headerLength; const size_t payload_length = length - header.headerLength; const size_t payload_data_length = payload_length - header.paddingLength; - const bool is_vp8 = header.payloadType == kPayloadTypeVP8; + const bool is_vp8 = header.payloadType == test::CallTest::kPayloadTypeVP8; std::unique_ptr depacketizer( RtpDepacketizer::Create(is_vp8 ? kRtpVideoVp8 : kRtpVideoVp9)); RtpDepacketizer::ParsedPayload parsed_payload;