blob: f3c8a870be37f4c404e1e4bd3b07261f8c9c4b90 [file] [log] [blame]
sprang@webrtc.org131bea82015-02-18 12:46:06 +00001/*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include <stdio.h>
Yves Gerey3e707812018-11-28 16:47:49 +010012#include <memory>
13#include <string>
14#include <vector>
sprang@webrtc.org131bea82015-02-18 12:46:06 +000015
Yves Gerey3e707812018-11-28 16:47:49 +010016#include "absl/memory/memory.h"
17#include "absl/types/optional.h"
18#include "api/bitrate_constraints.h"
19#include "api/test/simulated_network.h"
20#include "api/test/video_quality_test_fixture.h"
21#include "api/video_codecs/video_codec.h"
22#include "rtc_base/checks.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020023#include "rtc_base/flags.h"
Mirko Bonadei45a4c412018-07-31 15:07:28 +020024#include "rtc_base/logging.h"
Mirko Bonadei17f48782018-09-28 08:51:10 +020025#include "system_wrappers/include/field_trial.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020026#include "test/field_trial.h"
27#include "test/gtest.h"
28#include "test/run_test.h"
29#include "video/video_quality_test.h"
sprang@webrtc.org131bea82015-02-18 12:46:06 +000030
31namespace webrtc {
sprang@webrtc.org131bea82015-02-18 12:46:06 +000032namespace flags {
33
sprangce4aef12015-11-02 07:23:20 -080034// Flags common with screenshare loopback, with different default values.
Mirko Bonadei2dfa9982018-10-18 11:35:32 +020035WEBRTC_DEFINE_int(width, 640, "Video width.");
sprang@webrtc.org131bea82015-02-18 12:46:06 +000036size_t Width() {
sprang1168fd42017-06-21 09:00:17 -070037 return static_cast<size_t>(FLAG_width);
sprang@webrtc.org131bea82015-02-18 12:46:06 +000038}
39
Mirko Bonadei2dfa9982018-10-18 11:35:32 +020040WEBRTC_DEFINE_int(height, 480, "Video height.");
sprang@webrtc.org131bea82015-02-18 12:46:06 +000041size_t Height() {
sprang1168fd42017-06-21 09:00:17 -070042 return static_cast<size_t>(FLAG_height);
sprang@webrtc.org131bea82015-02-18 12:46:06 +000043}
44
Mirko Bonadei2dfa9982018-10-18 11:35:32 +020045WEBRTC_DEFINE_int(fps, 30, "Frames per second.");
sprang@webrtc.org131bea82015-02-18 12:46:06 +000046int Fps() {
sprang1168fd42017-06-21 09:00:17 -070047 return static_cast<int>(FLAG_fps);
sprang@webrtc.org131bea82015-02-18 12:46:06 +000048}
49
Mirko Bonadei2dfa9982018-10-18 11:35:32 +020050WEBRTC_DEFINE_int(capture_device_index, 0, "Capture device to select");
Tarun Chawla8e857d12017-05-31 19:20:57 +053051size_t GetCaptureDevice() {
sprang1168fd42017-06-21 09:00:17 -070052 return static_cast<size_t>(FLAG_capture_device_index);
Tarun Chawla8e857d12017-05-31 19:20:57 +053053}
54
Mirko Bonadei2dfa9982018-10-18 11:35:32 +020055WEBRTC_DEFINE_int(min_bitrate, 50, "Call and stream min bitrate in kbps.");
ivica5d6a06c2015-09-17 05:30:24 -070056int MinBitrateKbps() {
sprang1168fd42017-06-21 09:00:17 -070057 return static_cast<int>(FLAG_min_bitrate);
sprang@webrtc.org131bea82015-02-18 12:46:06 +000058}
59
Mirko Bonadei2dfa9982018-10-18 11:35:32 +020060WEBRTC_DEFINE_int(start_bitrate, 300, "Call start bitrate in kbps.");
ivica5d6a06c2015-09-17 05:30:24 -070061int StartBitrateKbps() {
sprang1168fd42017-06-21 09:00:17 -070062 return static_cast<int>(FLAG_start_bitrate);
sprang@webrtc.org131bea82015-02-18 12:46:06 +000063}
64
Mirko Bonadei2dfa9982018-10-18 11:35:32 +020065WEBRTC_DEFINE_int(target_bitrate, 800, "Stream target bitrate in kbps.");
ivica5d6a06c2015-09-17 05:30:24 -070066int TargetBitrateKbps() {
sprang1168fd42017-06-21 09:00:17 -070067 return static_cast<int>(FLAG_target_bitrate);
sprang@webrtc.org131bea82015-02-18 12:46:06 +000068}
69
Mirko Bonadei2dfa9982018-10-18 11:35:32 +020070WEBRTC_DEFINE_int(max_bitrate, 800, "Call and stream max bitrate in kbps.");
ivica5d6a06c2015-09-17 05:30:24 -070071int MaxBitrateKbps() {
sprang1168fd42017-06-21 09:00:17 -070072 return static_cast<int>(FLAG_max_bitrate);
ivica5d6a06c2015-09-17 05:30:24 -070073}
sprang@webrtc.org131bea82015-02-18 12:46:06 +000074
Mirko Bonadei2dfa9982018-10-18 11:35:32 +020075WEBRTC_DEFINE_bool(suspend_below_min_bitrate,
76 false,
77 "Suspends video below the configured min bitrate.");
mflodman48a4beb2016-07-01 13:03:59 +020078
Mirko Bonadei2dfa9982018-10-18 11:35:32 +020079WEBRTC_DEFINE_int(num_temporal_layers,
80 1,
81 "Number of temporal layers. Set to 1-4 to override.");
sprangce4aef12015-11-02 07:23:20 -080082int NumTemporalLayers() {
sprang1168fd42017-06-21 09:00:17 -070083 return static_cast<int>(FLAG_num_temporal_layers);
sprangce4aef12015-11-02 07:23:20 -080084}
85
Mirko Bonadei2dfa9982018-10-18 11:35:32 +020086WEBRTC_DEFINE_int(
87 inter_layer_pred,
88 2,
89 "Inter-layer prediction mode. "
90 "0 - enabled, 1 - disabled, 2 - enabled only for key pictures.");
Sergey Silkin57027362018-05-15 09:12:05 +020091InterLayerPredMode InterLayerPred() {
92 if (FLAG_inter_layer_pred == 0) {
93 return InterLayerPredMode::kOn;
94 } else if (FLAG_inter_layer_pred == 1) {
95 return InterLayerPredMode::kOff;
96 } else {
97 RTC_DCHECK_EQ(FLAG_inter_layer_pred, 2);
98 return InterLayerPredMode::kOnKeyPic;
99 }
100}
101
sprangce4aef12015-11-02 07:23:20 -0800102// Flags common with screenshare loopback, with equal default values.
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200103WEBRTC_DEFINE_string(codec, "VP8", "Video codec to use.");
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000104std::string Codec() {
sprang1168fd42017-06-21 09:00:17 -0700105 return static_cast<std::string>(FLAG_codec);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000106}
107
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200108WEBRTC_DEFINE_int(
109 selected_tl,
110 -1,
111 "Temporal layer to show or analyze. -1 to disable filtering.");
sprangce4aef12015-11-02 07:23:20 -0800112int SelectedTL() {
sprang1168fd42017-06-21 09:00:17 -0700113 return static_cast<int>(FLAG_selected_tl);
sprangce4aef12015-11-02 07:23:20 -0800114}
115
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200116WEBRTC_DEFINE_int(
sprangce4aef12015-11-02 07:23:20 -0800117 duration,
118 0,
119 "Duration of the test in seconds. If 0, rendered will be shown instead.");
120int DurationSecs() {
sprang1168fd42017-06-21 09:00:17 -0700121 return static_cast<int>(FLAG_duration);
sprangce4aef12015-11-02 07:23:20 -0800122}
123
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200124WEBRTC_DEFINE_string(output_filename, "", "Target graph data filename.");
sprangce4aef12015-11-02 07:23:20 -0800125std::string OutputFilename() {
sprang1168fd42017-06-21 09:00:17 -0700126 return static_cast<std::string>(FLAG_output_filename);
sprangce4aef12015-11-02 07:23:20 -0800127}
128
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200129WEBRTC_DEFINE_string(graph_title,
130 "",
131 "If empty, title will be generated automatically.");
sprangce4aef12015-11-02 07:23:20 -0800132std::string GraphTitle() {
sprang1168fd42017-06-21 09:00:17 -0700133 return static_cast<std::string>(FLAG_graph_title);
sprangce4aef12015-11-02 07:23:20 -0800134}
135
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200136WEBRTC_DEFINE_int(loss_percent, 0, "Percentage of packets randomly lost.");
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000137int LossPercent() {
sprang1168fd42017-06-21 09:00:17 -0700138 return static_cast<int>(FLAG_loss_percent);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000139}
140
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200141WEBRTC_DEFINE_int(avg_burst_loss_length,
142 -1,
143 "Average burst length of lost packets.");
philipel536378b2016-05-31 03:20:23 -0700144int AvgBurstLossLength() {
sprang1168fd42017-06-21 09:00:17 -0700145 return static_cast<int>(FLAG_avg_burst_loss_length);
philipel536378b2016-05-31 03:20:23 -0700146}
147
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200148WEBRTC_DEFINE_int(link_capacity,
149 0,
150 "Capacity (kbps) of the fake link. 0 means infinite.");
ivica5d6a06c2015-09-17 05:30:24 -0700151int LinkCapacityKbps() {
sprang1168fd42017-06-21 09:00:17 -0700152 return static_cast<int>(FLAG_link_capacity);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000153}
154
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200155WEBRTC_DEFINE_int(queue_size,
156 0,
157 "Size of the bottleneck link queue in packets.");
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000158int QueueSize() {
sprang1168fd42017-06-21 09:00:17 -0700159 return static_cast<int>(FLAG_queue_size);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000160}
161
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200162WEBRTC_DEFINE_int(avg_propagation_delay_ms,
163 0,
164 "Average link propagation delay in ms.");
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000165int AvgPropagationDelayMs() {
sprang1168fd42017-06-21 09:00:17 -0700166 return static_cast<int>(FLAG_avg_propagation_delay_ms);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000167}
168
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200169WEBRTC_DEFINE_string(rtc_event_log_name,
170 "",
171 "Filename for rtc event log. Two files "
172 "with \"_send\" and \"_recv\" suffixes will be created.");
ilnik98436952017-07-13 00:47:03 -0700173std::string RtcEventLogName() {
174 return static_cast<std::string>(FLAG_rtc_event_log_name);
175}
176
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200177WEBRTC_DEFINE_string(rtp_dump_name,
178 "",
179 "Filename for dumped received RTP stream.");
ilnik98436952017-07-13 00:47:03 -0700180std::string RtpDumpName() {
181 return static_cast<std::string>(FLAG_rtp_dump_name);
182}
183
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200184WEBRTC_DEFINE_int(std_propagation_delay_ms,
185 0,
186 "Link propagation delay standard deviation in ms.");
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000187int StdPropagationDelayMs() {
sprang1168fd42017-06-21 09:00:17 -0700188 return static_cast<int>(FLAG_std_propagation_delay_ms);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000189}
190
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200191WEBRTC_DEFINE_int(num_streams, 0, "Number of streams to show or analyze.");
sprang1168fd42017-06-21 09:00:17 -0700192int NumStreams() {
193 return static_cast<int>(FLAG_num_streams);
194}
195
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200196WEBRTC_DEFINE_int(selected_stream,
197 0,
198 "ID of the stream to show or analyze. "
199 "Set to the number of streams to show them all.");
sprangce4aef12015-11-02 07:23:20 -0800200int SelectedStream() {
sprang1168fd42017-06-21 09:00:17 -0700201 return static_cast<int>(FLAG_selected_stream);
sprangce4aef12015-11-02 07:23:20 -0800202}
203
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200204WEBRTC_DEFINE_int(num_spatial_layers, 1, "Number of spatial layers to use.");
sprangce4aef12015-11-02 07:23:20 -0800205int NumSpatialLayers() {
sprang1168fd42017-06-21 09:00:17 -0700206 return static_cast<int>(FLAG_num_spatial_layers);
sprangce4aef12015-11-02 07:23:20 -0800207}
208
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200209WEBRTC_DEFINE_int(selected_sl,
210 -1,
211 "Spatial layer to show or analyze. -1 to disable filtering.");
sprangce4aef12015-11-02 07:23:20 -0800212int SelectedSL() {
sprang1168fd42017-06-21 09:00:17 -0700213 return static_cast<int>(FLAG_selected_sl);
sprangce4aef12015-11-02 07:23:20 -0800214}
215
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200216WEBRTC_DEFINE_string(
217 stream0,
218 "",
219 "Comma separated values describing VideoStream for stream #0.");
sprangce4aef12015-11-02 07:23:20 -0800220std::string Stream0() {
sprang1168fd42017-06-21 09:00:17 -0700221 return static_cast<std::string>(FLAG_stream0);
sprangce4aef12015-11-02 07:23:20 -0800222}
223
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200224WEBRTC_DEFINE_string(
225 stream1,
226 "",
227 "Comma separated values describing VideoStream for stream #1.");
sprangce4aef12015-11-02 07:23:20 -0800228std::string Stream1() {
sprang1168fd42017-06-21 09:00:17 -0700229 return static_cast<std::string>(FLAG_stream1);
sprangce4aef12015-11-02 07:23:20 -0800230}
231
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200232WEBRTC_DEFINE_string(
233 sl0,
234 "",
235 "Comma separated values describing SpatialLayer for layer #0.");
sprangce4aef12015-11-02 07:23:20 -0800236std::string SL0() {
sprang1168fd42017-06-21 09:00:17 -0700237 return static_cast<std::string>(FLAG_sl0);
sprangce4aef12015-11-02 07:23:20 -0800238}
239
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200240WEBRTC_DEFINE_string(
241 sl1,
242 "",
243 "Comma separated values describing SpatialLayer for layer #1.");
sprangce4aef12015-11-02 07:23:20 -0800244std::string SL1() {
sprang1168fd42017-06-21 09:00:17 -0700245 return static_cast<std::string>(FLAG_sl1);
sprangce4aef12015-11-02 07:23:20 -0800246}
247
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200248WEBRTC_DEFINE_string(
249 encoded_frame_path,
250 "",
251 "The base path for encoded frame logs. Created files will have "
252 "the form <encoded_frame_path>.<n>.(recv|send.<m>).ivf");
palmkviste75f2042016-09-28 06:19:48 -0700253std::string EncodedFramePath() {
sprang1168fd42017-06-21 09:00:17 -0700254 return static_cast<std::string>(FLAG_encoded_frame_path);
palmkviste75f2042016-09-28 06:19:48 -0700255}
256
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200257WEBRTC_DEFINE_bool(logs, false, "print logs to stderr");
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000258
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200259WEBRTC_DEFINE_bool(send_side_bwe, true, "Use send-side bandwidth estimation");
sprangce4aef12015-11-02 07:23:20 -0800260
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200261WEBRTC_DEFINE_bool(generic_descriptor,
262 false,
263 "Use the generic frame descriptor.");
philipel569397f2018-09-26 12:25:31 +0200264
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200265WEBRTC_DEFINE_bool(allow_reordering, false, "Allow packet reordering to occur");
philipela2c55232016-01-26 08:41:53 -0800266
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200267WEBRTC_DEFINE_bool(use_ulpfec,
268 false,
269 "Use RED+ULPFEC forward error correction.");
brandtra62f5822016-11-17 00:21:13 -0800270
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200271WEBRTC_DEFINE_bool(use_flexfec, false, "Use FlexFEC forward error correction.");
philipel274c1dc2016-05-04 06:21:01 -0700272
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200273WEBRTC_DEFINE_bool(audio, false, "Add audio stream");
minyue73208662016-08-18 06:28:55 -0700274
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200275WEBRTC_DEFINE_bool(
276 use_real_adm,
277 false,
278 "Use real ADM instead of fake (no effect if audio is false)");
henrika255750b2018-08-27 16:13:37 +0200279
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200280WEBRTC_DEFINE_bool(audio_video_sync,
281 false,
282 "Sync audio and video stream (no effect if"
283 " audio is false)");
minyue73208662016-08-18 06:28:55 -0700284
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200285WEBRTC_DEFINE_bool(audio_dtx,
286 false,
287 "Enable audio DTX (no effect if audio is false)");
minyue4c8b9422017-03-21 04:11:43 -0700288
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200289WEBRTC_DEFINE_bool(video, true, "Add video stream");
minyuea27172d2016-11-01 05:59:29 -0700290
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200291WEBRTC_DEFINE_string(
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000292 force_fieldtrials,
293 "",
294 "Field trials control experimental feature code which can be forced. "
Elad Alon1e3ed162018-10-15 17:50:37 +0200295 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enabled/"
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000296 " will assign the group Enable to field trial WebRTC-FooFeature. Multiple "
297 "trials are separated by \"/\"");
pbos9874ee02015-06-22 04:44:26 -0700298
sprangce4aef12015-11-02 07:23:20 -0800299// Video-specific flags.
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200300WEBRTC_DEFINE_string(
301 clip,
302 "",
303 "Name of the clip to show. If empty, using chroma generator.");
ivica5d6a06c2015-09-17 05:30:24 -0700304std::string Clip() {
sprang1168fd42017-06-21 09:00:17 -0700305 return static_cast<std::string>(FLAG_clip);
ivica5d6a06c2015-09-17 05:30:24 -0700306}
307
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200308WEBRTC_DEFINE_bool(help, false, "prints this message");
sprang1168fd42017-06-21 09:00:17 -0700309
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000310} // namespace flags
311
312void Loopback() {
Artem Titov75e36472018-10-08 12:28:56 +0200313 BuiltInNetworkBehaviorConfig pipe_config;
ivica5d6a06c2015-09-17 05:30:24 -0700314 pipe_config.loss_percent = flags::LossPercent();
philipel536378b2016-05-31 03:20:23 -0700315 pipe_config.avg_burst_loss_length = flags::AvgBurstLossLength();
ivica5d6a06c2015-09-17 05:30:24 -0700316 pipe_config.link_capacity_kbps = flags::LinkCapacityKbps();
317 pipe_config.queue_length_packets = flags::QueueSize();
318 pipe_config.queue_delay_ms = flags::AvgPropagationDelayMs();
319 pipe_config.delay_standard_deviation_ms = flags::StdPropagationDelayMs();
sprang1168fd42017-06-21 09:00:17 -0700320 pipe_config.allow_reordering = flags::FLAG_allow_reordering;
ivica5d6a06c2015-09-17 05:30:24 -0700321
Sebastian Janssonfc8d26b2018-02-21 09:52:06 +0100322 BitrateConstraints call_bitrate_config;
ivica5d6a06c2015-09-17 05:30:24 -0700323 call_bitrate_config.min_bitrate_bps = flags::MinBitrateKbps() * 1000;
324 call_bitrate_config.start_bitrate_bps = flags::StartBitrateKbps() * 1000;
Erik Språng28bb3912018-07-11 16:06:55 +0200325 call_bitrate_config.max_bitrate_bps = -1; // Don't cap bandwidth estimate.
ivica5d6a06c2015-09-17 05:30:24 -0700326
minyue73208662016-08-18 06:28:55 -0700327 VideoQualityTest::Params params;
philipel569397f2018-09-26 12:25:31 +0200328 params.call = {flags::FLAG_send_side_bwe, flags::FLAG_generic_descriptor,
329 call_bitrate_config, 0};
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +0100330 params.video[0] = {flags::FLAG_video,
331 flags::Width(),
332 flags::Height(),
333 flags::Fps(),
334 flags::MinBitrateKbps() * 1000,
335 flags::TargetBitrateKbps() * 1000,
336 flags::MaxBitrateKbps() * 1000,
337 flags::FLAG_suspend_below_min_bitrate,
338 flags::Codec(),
339 flags::NumTemporalLayers(),
340 flags::SelectedTL(),
341 0, // No min transmit bitrate.
342 flags::FLAG_use_ulpfec,
343 flags::FLAG_use_flexfec,
philipel5affbf22019-01-24 15:49:40 +0100344 flags::NumStreams() < 2, // Automatic quality scaling.
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +0100345 flags::Clip(),
346 flags::GetCaptureDevice()};
sprang1168fd42017-06-21 09:00:17 -0700347 params.audio = {flags::FLAG_audio, flags::FLAG_audio_video_sync,
henrika255750b2018-08-27 16:13:37 +0200348 flags::FLAG_audio_dtx, flags::FLAG_use_real_adm};
Mirko Bonadei45a4c412018-07-31 15:07:28 +0200349 params.logging = {flags::FLAG_rtc_event_log_name, flags::FLAG_rtp_dump_name,
350 flags::FLAG_encoded_frame_path};
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +0100351 params.screenshare[0].enabled = false;
Yves Gerey665174f2018-06-19 15:03:05 +0200352 params.analyzer = {"video",
353 0.0,
354 0.0,
355 flags::DurationSecs(),
356 flags::OutputFilename(),
357 flags::GraphTitle()};
Artem Titovf18b3522018-08-28 16:54:24 +0200358 params.config = pipe_config;
sprang1168fd42017-06-21 09:00:17 -0700359
360 if (flags::NumStreams() > 1 && flags::Stream0().empty() &&
361 flags::Stream1().empty()) {
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +0100362 params.ss[0].infer_streams = true;
sprang1168fd42017-06-21 09:00:17 -0700363 }
ivica5d6a06c2015-09-17 05:30:24 -0700364
sprangce4aef12015-11-02 07:23:20 -0800365 std::vector<std::string> stream_descriptors;
366 stream_descriptors.push_back(flags::Stream0());
367 stream_descriptors.push_back(flags::Stream1());
368 std::vector<std::string> SL_descriptors;
369 SL_descriptors.push_back(flags::SL0());
370 SL_descriptors.push_back(flags::SL1());
371 VideoQualityTest::FillScalabilitySettings(
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +0100372 &params, 0, stream_descriptors, flags::NumStreams(),
373 flags::SelectedStream(), flags::NumSpatialLayers(), flags::SelectedSL(),
Sergey Silkin57027362018-05-15 09:12:05 +0200374 flags::InterLayerPred(), SL_descriptors);
sprangce4aef12015-11-02 07:23:20 -0800375
Karl Wiberg918f50c2018-07-05 11:40:33 +0200376 auto fixture = absl::make_unique<VideoQualityTest>(nullptr);
sprangce4aef12015-11-02 07:23:20 -0800377 if (flags::DurationSecs()) {
Patrik Höglundb6b29e02018-06-21 16:58:01 +0200378 fixture->RunWithAnalyzer(params);
sprangce4aef12015-11-02 07:23:20 -0800379 } else {
Patrik Höglundb6b29e02018-06-21 16:58:01 +0200380 fixture->RunWithRenderers(params);
sprangce4aef12015-11-02 07:23:20 -0800381 }
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000382}
383} // namespace webrtc
384
385int main(int argc, char* argv[]) {
386 ::testing::InitGoogleTest(&argc, argv);
sprang1168fd42017-06-21 09:00:17 -0700387 rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
388 if (webrtc::flags::FLAG_help) {
389 rtc::FlagList::Print(nullptr, false);
390 return 0;
391 }
392
Mirko Bonadei45a4c412018-07-31 15:07:28 +0200393 rtc::LogMessage::SetLogToStderr(webrtc::flags::FLAG_logs);
394
Bjorn Tereliusedab3012018-01-31 17:23:40 +0100395 webrtc::test::ValidateFieldTrialsStringOrDie(
396 webrtc::flags::FLAG_force_fieldtrials);
397 // InitFieldTrialsFromString stores the char*, so the char array must outlive
398 // the application.
399 webrtc::field_trial::InitFieldTrialsFromString(
400 webrtc::flags::FLAG_force_fieldtrials);
sprang89c4a7e2017-06-30 13:27:40 -0700401
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000402 webrtc::test::RunTest(webrtc::Loopback);
403 return 0;
404}