Index: webrtc/video/video_loopback.cc |
diff --git a/webrtc/video/video_loopback.cc b/webrtc/video/video_loopback.cc |
index 789b5cceacf0f4601a7c391bc7590c069b3cce16..c5e9254c087ff4a106903885be2797e56551657e 100644 |
--- a/webrtc/video/video_loopback.cc |
+++ b/webrtc/video/video_loopback.cc |
@@ -18,7 +18,7 @@ |
#include "webrtc/test/field_trial.h" |
#include "webrtc/test/run_test.h" |
#include "webrtc/typedefs.h" |
-#include "webrtc/video/loopback.h" |
+#include "webrtc/video/video_quality_test.h" |
namespace webrtc { |
@@ -39,24 +39,25 @@ int Fps() { |
return static_cast<int>(FLAGS_fps); |
} |
-DEFINE_int32(min_bitrate, 50, "Minimum video bitrate."); |
-size_t MinBitrate() { |
- return static_cast<size_t>(FLAGS_min_bitrate); |
+DEFINE_int32(min_bitrate, 50, "Call and stream min bitrate in kbps."); |
+int MinBitrateKbps() { |
+ return static_cast<int>(FLAGS_min_bitrate); |
} |
-DEFINE_int32(start_bitrate, 300, "Video starting bitrate."); |
-size_t StartBitrate() { |
- return static_cast<size_t>(FLAGS_start_bitrate); |
+DEFINE_int32(start_bitrate, 300, "Call start bitrate in kbps."); |
+int StartBitrateKbps() { |
+ return static_cast<int>(FLAGS_start_bitrate); |
} |
-DEFINE_int32(max_bitrate, 800, "Maximum video bitrate."); |
-size_t MaxBitrate() { |
- return static_cast<size_t>(FLAGS_max_bitrate); |
+DEFINE_int32(target_bitrate, 800, "Stream target bitrate in kbps."); |
+int TargetBitrateKbps() { |
+ return static_cast<int>(FLAGS_target_bitrate); |
} |
-int MinTransmitBitrate() { |
- return 0; |
-} // No min padding for regular video. |
+DEFINE_int32(max_bitrate, 800, "Call and stream max bitrate in kbps."); |
+int MaxBitrateKbps() { |
+ return static_cast<int>(FLAGS_max_bitrate); |
+} |
DEFINE_string(codec, "VP8", "Video codec to use."); |
std::string Codec() { |
@@ -71,7 +72,7 @@ int LossPercent() { |
DEFINE_int32(link_capacity, |
0, |
"Capacity (kbps) of the fake link. 0 means infinite."); |
-int LinkCapacity() { |
+int LinkCapacityKbps() { |
return static_cast<int>(FLAGS_link_capacity); |
} |
@@ -105,33 +106,82 @@ DEFINE_string( |
"trials are separated by \"/\""); |
DEFINE_int32(num_temporal_layers, |
- 0, |
+ 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); |
+} |
+ |
+DEFINE_string(clip, |
+ "", |
+ "Name of the clip to show. If empty, using chroma generator."); |
+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); |
+} |
+ |
} // namespace flags |
void Loopback() { |
- test::Loopback::Config config{flags::Width(), |
- flags::Height(), |
- flags::Fps(), |
- flags::MinBitrate(), |
- flags::StartBitrate(), |
- flags::MaxBitrate(), |
- 0, // No min transmit bitrate. |
- flags::Codec(), |
- flags::NumTemporalLayers(), |
- flags::LossPercent(), |
- flags::LinkCapacity(), |
- flags::QueueSize(), |
- flags::AvgPropagationDelayMs(), |
- flags::StdPropagationDelayMs(), |
- flags::FLAGS_logs}; |
- test::Loopback loopback(config); |
- loopback.Run(); |
+ FakeNetworkPipe::Config pipe_config; |
+ pipe_config.loss_percent = flags::LossPercent(); |
+ pipe_config.link_capacity_kbps = flags::LinkCapacityKbps(); |
+ pipe_config.queue_length_packets = flags::QueueSize(); |
+ pipe_config.queue_delay_ms = flags::AvgPropagationDelayMs(); |
+ pipe_config.delay_standard_deviation_ms = flags::StdPropagationDelayMs(); |
+ |
+ Call::Config::BitrateConfig call_bitrate_config; |
+ call_bitrate_config.min_bitrate_bps = flags::MinBitrateKbps() * 1000; |
+ 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(), |
+ 0, // No min transmit bitrate. |
+ call_bitrate_config, |
+ flags::TLDiscardThreshold() |
+ }, |
+ {clip}, |
+ {}, // Screenshare specific. |
+ {graph_title, 0.0, 0.0, flags::DurationSecs(), flags::OutputFilename()}, |
+ pipe_config, |
+ flags::FLAGS_logs}; |
+ |
+ VideoQualityTest test; |
+ if (flags::OutputFilename().empty()) |
+ test.RunWithVideoRenderer(params); |
+ else |
+ test.RunWithAnalyzer(params); |
} |
} // namespace webrtc |