From c11b0fec74fabff3d93fa0d340a133867533d73d Mon Sep 17 00:00:00 2001 From: philipel Date: Tue, 4 Oct 2022 08:10:20 +0200 Subject: [PATCH] Add --disable_decoding flag to video_replay Bug: webrtc:14508 Change-Id: I8758e4f166e18dbdbe7a6b9b7e55cc94e19366f8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/277446 Reviewed-by: Mirko Bonadei Commit-Queue: Philip Eliasson Cr-Commit-Position: refs/heads/main@{#38287} --- rtc_tools/video_replay.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/rtc_tools/video_replay.cc b/rtc_tools/video_replay.cc index 04828a6d99..173439af12 100644 --- a/rtc_tools/video_replay.cc +++ b/rtc_tools/video_replay.cc @@ -157,6 +157,8 @@ ABSL_FLAG(bool, simulated_time, false, "Run in simulated time"); ABSL_FLAG(bool, disable_preview, false, "Disable decoded video preview."); +ABSL_FLAG(bool, disable_decoding, false, "Disable video decoding."); + namespace { bool ValidatePayloadType(int32_t payload_type) { return payload_type > 0 && payload_type <= 127; @@ -307,7 +309,13 @@ std::unique_ptr ConfigureFromFile(const std::string& config_path, return nullptr; } - stream_state->decoder_factory = std::make_unique(); + if (absl::GetFlag(FLAGS_disable_decoding)) { + stream_state->decoder_factory = + std::make_unique( + []() { return std::make_unique(); }); + } else { + stream_state->decoder_factory = std::make_unique(); + } size_t config_count = 0; for (const auto& json : json_configs) { // Create the configuration and parse the JSON into the config. @@ -418,6 +426,10 @@ std::unique_ptr ConfigureFromFlags( absl::GetFlag(FLAGS_decoder_ivf_filename).c_str(), absl::GetFlag(FLAGS_codec)); }); + } else if (absl::GetFlag(FLAGS_disable_decoding)) { + stream_state->decoder_factory = + std::make_unique( + []() { return std::make_unique(); }); } else { stream_state->decoder_factory = std::make_unique(); }