| Index: webrtc/video/video_loopback.cc
|
| diff --git a/webrtc/video/video_loopback.cc b/webrtc/video/video_loopback.cc
|
| index 0dceea82e6ea45e5f85bbfa7e5844036ac7a9956..d03060e7292f7d484bbc00fca0e017a5f3cf18da 100644
|
| --- a/webrtc/video/video_loopback.cc
|
| +++ b/webrtc/video/video_loopback.cc
|
| @@ -10,20 +10,17 @@
|
|
|
| #include <stdio.h>
|
|
|
| -#include <map>
|
| -
|
| #include "gflags/gflags.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| #include "webrtc/test/field_trial.h"
|
| #include "webrtc/test/run_test.h"
|
| -#include "webrtc/typedefs.h"
|
| #include "webrtc/video/video_quality_test.h"
|
|
|
| namespace webrtc {
|
| -
|
| namespace flags {
|
|
|
| +// Flags common with screenshare loopback, with different default values.
|
| DEFINE_int32(width, 640, "Video width.");
|
| size_t Width() {
|
| return static_cast<size_t>(FLAGS_width);
|
| @@ -59,11 +56,46 @@ int MaxBitrateKbps() {
|
| return static_cast<int>(FLAGS_max_bitrate);
|
| }
|
|
|
| +DEFINE_int32(num_temporal_layers,
|
| + 1,
|
| + "Number of temporal layers. Set to 1-4 to override.");
|
| +size_t NumTemporalLayers() {
|
| + return static_cast<size_t>(FLAGS_num_temporal_layers);
|
| +}
|
| +
|
| +// Flags common with screenshare loopback, with equal default values.
|
| DEFINE_string(codec, "VP8", "Video codec to use.");
|
| std::string Codec() {
|
| return static_cast<std::string>(FLAGS_codec);
|
| }
|
|
|
| +DEFINE_int32(selected_tl,
|
| + -1,
|
| + "Temporal layer to show or analyze. -1 to disable filtering.");
|
| +int SelectedTL() {
|
| + return static_cast<int>(FLAGS_selected_tl);
|
| +}
|
| +
|
| +DEFINE_int32(
|
| + duration,
|
| + 0,
|
| + "Duration of the test in seconds. If 0, rendered will be shown instead.");
|
| +int DurationSecs() {
|
| + return static_cast<int>(FLAGS_duration);
|
| +}
|
| +
|
| +DEFINE_string(output_filename, "", "Target graph data filename.");
|
| +std::string OutputFilename() {
|
| + return static_cast<std::string>(FLAGS_output_filename);
|
| +}
|
| +
|
| +DEFINE_string(graph_title,
|
| + AUTO_GRAPH_TITLE,
|
| + "If default value used, title will be generated automatically.");
|
| +std::string GraphTitle() {
|
| + return static_cast<std::string>(FLAGS_graph_title);
|
| +}
|
| +
|
| DEFINE_int32(loss_percent, 0, "Percentage of packets randomly lost.");
|
| int LossPercent() {
|
| return static_cast<int>(FLAGS_loss_percent);
|
| @@ -95,8 +127,53 @@ int StdPropagationDelayMs() {
|
| return static_cast<int>(FLAGS_std_propagation_delay_ms);
|
| }
|
|
|
| +DEFINE_int32(selected_stream, 0, "ID of the stream to show or analyze.");
|
| +size_t SelectedStream() {
|
| + return static_cast<size_t>(FLAGS_selected_stream);
|
| +}
|
| +
|
| +DEFINE_int32(num_spatial_layers, 1, "Number of spatial layers to use.");
|
| +int NumSpatialLayers() {
|
| + return static_cast<int>(FLAGS_num_spatial_layers);
|
| +}
|
| +
|
| +DEFINE_int32(selected_sl,
|
| + -1,
|
| + "Spatial layer to show or analyze. -1 to disable filtering.");
|
| +int SelectedSL() {
|
| + return static_cast<int>(FLAGS_selected_sl);
|
| +}
|
| +
|
| +DEFINE_string(stream0,
|
| + "",
|
| + "Comma separated values describing VideoStream for stream #0.");
|
| +std::string Stream0() {
|
| + return static_cast<std::string>(FLAGS_stream0);
|
| +}
|
| +
|
| +DEFINE_string(stream1,
|
| + "",
|
| + "Comma separated values describing VideoStream for stream #1.");
|
| +std::string Stream1() {
|
| + return static_cast<std::string>(FLAGS_stream1);
|
| +}
|
| +
|
| +DEFINE_string(
|
| + sl0, "", "Comma separated values describing SpatialLayer for layer #0.");
|
| +std::string SL0() {
|
| + return static_cast<std::string>(FLAGS_sl0);
|
| +}
|
| +
|
| +DEFINE_string(
|
| + sl1, "", "Comma separated values describing SpatialLayer for layer #1.");
|
| +std::string SL1() {
|
| + return static_cast<std::string>(FLAGS_sl1);
|
| +}
|
| +
|
| DEFINE_bool(logs, false, "print logs to stderr");
|
|
|
| +DEFINE_bool(send_side_bwe, true, "Use send-side bandwidth estimation");
|
| +
|
| DEFINE_string(
|
| force_fieldtrials,
|
| "",
|
| @@ -105,21 +182,7 @@ DEFINE_string(
|
| " will assign the group Enable to field trial WebRTC-FooFeature. Multiple "
|
| "trials are separated by \"/\"");
|
|
|
| -DEFINE_int32(num_temporal_layers,
|
| - 1,
|
| - "Number of temporal layers. Set to 1-4 to override.");
|
| -size_t NumTemporalLayers() {
|
| - return static_cast<size_t>(FLAGS_num_temporal_layers);
|
| -}
|
| -
|
| -DEFINE_int32(
|
| - tl_discard_threshold,
|
| - 0,
|
| - "Discard TLs with id greater or equal the threshold. 0 to disable.");
|
| -size_t TLDiscardThreshold() {
|
| - return static_cast<size_t>(FLAGS_tl_discard_threshold);
|
| -}
|
| -
|
| +// Video-specific flags.
|
| DEFINE_string(clip,
|
| "",
|
| "Name of the clip to show. If empty, using chroma generator.");
|
| @@ -127,21 +190,6 @@ std::string Clip() {
|
| return static_cast<std::string>(FLAGS_clip);
|
| }
|
|
|
| -DEFINE_string(
|
| - output_filename,
|
| - "",
|
| - "Name of a target graph data file. If set, no preview will be shown.");
|
| -std::string OutputFilename() {
|
| - return static_cast<std::string>(FLAGS_output_filename);
|
| -}
|
| -
|
| -DEFINE_int32(duration, 60, "Duration of the test in seconds.");
|
| -int DurationSecs() {
|
| - return static_cast<int>(FLAGS_duration);
|
| -}
|
| -
|
| -DEFINE_bool(send_side_bwe, true, "Use send-side bandwidth estimation");
|
| -
|
| } // namespace flags
|
|
|
| void Loopback() {
|
| @@ -157,27 +205,33 @@ void Loopback() {
|
| call_bitrate_config.start_bitrate_bps = flags::StartBitrateKbps() * 1000;
|
| call_bitrate_config.max_bitrate_bps = flags::MaxBitrateKbps() * 1000;
|
|
|
| - std::string clip = flags::Clip();
|
| - std::string graph_title = clip.empty() ? "" : "video " + clip;
|
| VideoQualityTest::Params params{
|
| {flags::Width(), flags::Height(), flags::Fps(),
|
| flags::MinBitrateKbps() * 1000, flags::TargetBitrateKbps() * 1000,
|
| flags::MaxBitrateKbps() * 1000, flags::Codec(),
|
| - flags::NumTemporalLayers(),
|
| + flags::NumTemporalLayers(), flags::SelectedTL(),
|
| 0, // No min transmit bitrate.
|
| - call_bitrate_config, flags::TLDiscardThreshold(),
|
| - flags::FLAGS_send_side_bwe},
|
| - {clip},
|
| + call_bitrate_config, flags::FLAGS_send_side_bwe},
|
| + {flags::Clip()},
|
| {}, // Screenshare specific.
|
| - {graph_title, 0.0, 0.0, flags::DurationSecs(), flags::OutputFilename()},
|
| + {"video", 0.0, 0.0, flags::DurationSecs(), flags::OutputFilename(),
|
| + flags::GraphTitle()},
|
| pipe_config,
|
| flags::FLAGS_logs};
|
|
|
| + VideoQualityTest::FillScalabilitySettings(
|
| + ¶ms,
|
| + {flags::Stream0(), flags::Stream1()},
|
| + flags::SelectedStream(),
|
| + flags::NumSpatialLayers(),
|
| + flags::SelectedSL(),
|
| + {flags::SL0(), flags::SL1()});
|
| +
|
| VideoQualityTest test;
|
| - if (flags::OutputFilename().empty())
|
| - test.RunWithVideoRenderer(params);
|
| - else
|
| + if (flags::DurationSecs())
|
| test.RunWithAnalyzer(params);
|
| + else
|
| + test.RunWithVideoRenderer(params);
|
| }
|
| } // namespace webrtc
|
|
|
|
|