Add --disable_preview flag to video_replay.
Bug: webrtc:14508 Change-Id: I4c8c6e2807a77c5bfd8705f003d93e9ac23497b6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/277821 Commit-Queue: Philip Eliasson <philipel@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38286}
This commit is contained in:
@ -155,6 +155,8 @@ ABSL_FLAG(
|
|||||||
|
|
||||||
ABSL_FLAG(bool, simulated_time, false, "Run in simulated time");
|
ABSL_FLAG(bool, simulated_time, false, "Run in simulated time");
|
||||||
|
|
||||||
|
ABSL_FLAG(bool, disable_preview, false, "Disable decoded video preview.");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
bool ValidatePayloadType(int32_t payload_type) {
|
bool ValidatePayloadType(int32_t payload_type) {
|
||||||
return payload_type > 0 && payload_type <= 127;
|
return payload_type > 0 && payload_type <= 127;
|
||||||
@ -178,6 +180,11 @@ namespace {
|
|||||||
|
|
||||||
const uint32_t kReceiverLocalSsrc = 0x123456;
|
const uint32_t kReceiverLocalSsrc = 0x123456;
|
||||||
|
|
||||||
|
class NullRenderer : public rtc::VideoSinkInterface<VideoFrame> {
|
||||||
|
public:
|
||||||
|
void OnFrame(const VideoFrame& frame) override {}
|
||||||
|
};
|
||||||
|
|
||||||
class FileRenderPassthrough : public rtc::VideoSinkInterface<VideoFrame> {
|
class FileRenderPassthrough : public rtc::VideoSinkInterface<VideoFrame> {
|
||||||
public:
|
public:
|
||||||
FileRenderPassthrough(const std::string& basename,
|
FileRenderPassthrough(const std::string& basename,
|
||||||
@ -314,9 +321,13 @@ std::unique_ptr<StreamState> ConfigureFromFile(const std::string& config_path,
|
|||||||
// Create a window for this config.
|
// Create a window for this config.
|
||||||
std::stringstream window_title;
|
std::stringstream window_title;
|
||||||
window_title << "Playback Video (" << config_count++ << ")";
|
window_title << "Playback Video (" << config_count++ << ")";
|
||||||
stream_state->sinks.emplace_back(test::VideoRenderer::Create(
|
if (absl::GetFlag(FLAGS_disable_preview)) {
|
||||||
window_title.str().c_str(), absl::GetFlag(FLAGS_render_width),
|
stream_state->sinks.emplace_back(std::make_unique<NullRenderer>());
|
||||||
absl::GetFlag(FLAGS_render_height)));
|
} else {
|
||||||
|
stream_state->sinks.emplace_back(test::VideoRenderer::Create(
|
||||||
|
window_title.str().c_str(), absl::GetFlag(FLAGS_render_width),
|
||||||
|
absl::GetFlag(FLAGS_render_height)));
|
||||||
|
}
|
||||||
// Create a receive stream for this config.
|
// Create a receive stream for this config.
|
||||||
receive_config.renderer = stream_state->sinks.back().get();
|
receive_config.renderer = stream_state->sinks.back().get();
|
||||||
receive_config.decoder_factory = stream_state->decoder_factory.get();
|
receive_config.decoder_factory = stream_state->decoder_factory.get();
|
||||||
@ -335,10 +346,14 @@ std::unique_ptr<StreamState> ConfigureFromFlags(
|
|||||||
// them from deallocating.
|
// them from deallocating.
|
||||||
std::stringstream window_title;
|
std::stringstream window_title;
|
||||||
window_title << "Playback Video (" << rtp_dump_path << ")";
|
window_title << "Playback Video (" << rtp_dump_path << ")";
|
||||||
std::unique_ptr<test::VideoRenderer> playback_video(
|
std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>> playback_video;
|
||||||
test::VideoRenderer::Create(window_title.str().c_str(),
|
if (absl::GetFlag(FLAGS_disable_preview)) {
|
||||||
absl::GetFlag(FLAGS_render_width),
|
playback_video = std::make_unique<NullRenderer>();
|
||||||
absl::GetFlag(FLAGS_render_height)));
|
} else {
|
||||||
|
playback_video.reset(test::VideoRenderer::Create(
|
||||||
|
window_title.str().c_str(), absl::GetFlag(FLAGS_render_width),
|
||||||
|
absl::GetFlag(FLAGS_render_height)));
|
||||||
|
}
|
||||||
auto file_passthrough = std::make_unique<FileRenderPassthrough>(
|
auto file_passthrough = std::make_unique<FileRenderPassthrough>(
|
||||||
absl::GetFlag(FLAGS_out_base), playback_video.get());
|
absl::GetFlag(FLAGS_out_base), playback_video.get());
|
||||||
stream_state->sinks.push_back(std::move(playback_video));
|
stream_state->sinks.push_back(std::move(playback_video));
|
||||||
|
|||||||
Reference in New Issue
Block a user