blob: ef32ae64ddf97e2675fbff01ed11425b512cc690 [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(
Sergey Silkina89800c2019-02-19 12:52:56 +0100249 sl2,
250 "",
251 "Comma separated values describing SpatialLayer for layer #2.");
252std::string SL2() {
253 return static_cast<std::string>(FLAG_sl2);
254}
255
256WEBRTC_DEFINE_string(
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200257 encoded_frame_path,
258 "",
259 "The base path for encoded frame logs. Created files will have "
260 "the form <encoded_frame_path>.<n>.(recv|send.<m>).ivf");
palmkviste75f2042016-09-28 06:19:48 -0700261std::string EncodedFramePath() {
sprang1168fd42017-06-21 09:00:17 -0700262 return static_cast<std::string>(FLAG_encoded_frame_path);
palmkviste75f2042016-09-28 06:19:48 -0700263}
264
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200265WEBRTC_DEFINE_bool(logs, false, "print logs to stderr");
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000266
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200267WEBRTC_DEFINE_bool(send_side_bwe, true, "Use send-side bandwidth estimation");
sprangce4aef12015-11-02 07:23:20 -0800268
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200269WEBRTC_DEFINE_bool(generic_descriptor,
270 false,
271 "Use the generic frame descriptor.");
philipel569397f2018-09-26 12:25:31 +0200272
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200273WEBRTC_DEFINE_bool(allow_reordering, false, "Allow packet reordering to occur");
philipela2c55232016-01-26 08:41:53 -0800274
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200275WEBRTC_DEFINE_bool(use_ulpfec,
276 false,
277 "Use RED+ULPFEC forward error correction.");
brandtra62f5822016-11-17 00:21:13 -0800278
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200279WEBRTC_DEFINE_bool(use_flexfec, false, "Use FlexFEC forward error correction.");
philipel274c1dc2016-05-04 06:21:01 -0700280
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200281WEBRTC_DEFINE_bool(audio, false, "Add audio stream");
minyue73208662016-08-18 06:28:55 -0700282
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200283WEBRTC_DEFINE_bool(
284 use_real_adm,
285 false,
286 "Use real ADM instead of fake (no effect if audio is false)");
henrika255750b2018-08-27 16:13:37 +0200287
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200288WEBRTC_DEFINE_bool(audio_video_sync,
289 false,
290 "Sync audio and video stream (no effect if"
291 " audio is false)");
minyue73208662016-08-18 06:28:55 -0700292
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200293WEBRTC_DEFINE_bool(audio_dtx,
294 false,
295 "Enable audio DTX (no effect if audio is false)");
minyue4c8b9422017-03-21 04:11:43 -0700296
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200297WEBRTC_DEFINE_bool(video, true, "Add video stream");
minyuea27172d2016-11-01 05:59:29 -0700298
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200299WEBRTC_DEFINE_string(
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000300 force_fieldtrials,
301 "",
302 "Field trials control experimental feature code which can be forced. "
Elad Alon1e3ed162018-10-15 17:50:37 +0200303 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enabled/"
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000304 " will assign the group Enable to field trial WebRTC-FooFeature. Multiple "
305 "trials are separated by \"/\"");
pbos9874ee02015-06-22 04:44:26 -0700306
sprangce4aef12015-11-02 07:23:20 -0800307// Video-specific flags.
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200308WEBRTC_DEFINE_string(
309 clip,
310 "",
311 "Name of the clip to show. If empty, using chroma generator.");
ivica5d6a06c2015-09-17 05:30:24 -0700312std::string Clip() {
sprang1168fd42017-06-21 09:00:17 -0700313 return static_cast<std::string>(FLAG_clip);
ivica5d6a06c2015-09-17 05:30:24 -0700314}
315
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200316WEBRTC_DEFINE_bool(help, false, "prints this message");
sprang1168fd42017-06-21 09:00:17 -0700317
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000318} // namespace flags
319
320void Loopback() {
Artem Titov75e36472018-10-08 12:28:56 +0200321 BuiltInNetworkBehaviorConfig pipe_config;
ivica5d6a06c2015-09-17 05:30:24 -0700322 pipe_config.loss_percent = flags::LossPercent();
philipel536378b2016-05-31 03:20:23 -0700323 pipe_config.avg_burst_loss_length = flags::AvgBurstLossLength();
ivica5d6a06c2015-09-17 05:30:24 -0700324 pipe_config.link_capacity_kbps = flags::LinkCapacityKbps();
325 pipe_config.queue_length_packets = flags::QueueSize();
326 pipe_config.queue_delay_ms = flags::AvgPropagationDelayMs();
327 pipe_config.delay_standard_deviation_ms = flags::StdPropagationDelayMs();
sprang1168fd42017-06-21 09:00:17 -0700328 pipe_config.allow_reordering = flags::FLAG_allow_reordering;
ivica5d6a06c2015-09-17 05:30:24 -0700329
Sebastian Janssonfc8d26b2018-02-21 09:52:06 +0100330 BitrateConstraints call_bitrate_config;
ivica5d6a06c2015-09-17 05:30:24 -0700331 call_bitrate_config.min_bitrate_bps = flags::MinBitrateKbps() * 1000;
332 call_bitrate_config.start_bitrate_bps = flags::StartBitrateKbps() * 1000;
Erik Språng28bb3912018-07-11 16:06:55 +0200333 call_bitrate_config.max_bitrate_bps = -1; // Don't cap bandwidth estimate.
ivica5d6a06c2015-09-17 05:30:24 -0700334
minyue73208662016-08-18 06:28:55 -0700335 VideoQualityTest::Params params;
philipel569397f2018-09-26 12:25:31 +0200336 params.call = {flags::FLAG_send_side_bwe, flags::FLAG_generic_descriptor,
337 call_bitrate_config, 0};
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +0100338 params.video[0] = {flags::FLAG_video,
339 flags::Width(),
340 flags::Height(),
341 flags::Fps(),
342 flags::MinBitrateKbps() * 1000,
343 flags::TargetBitrateKbps() * 1000,
344 flags::MaxBitrateKbps() * 1000,
345 flags::FLAG_suspend_below_min_bitrate,
346 flags::Codec(),
347 flags::NumTemporalLayers(),
348 flags::SelectedTL(),
349 0, // No min transmit bitrate.
350 flags::FLAG_use_ulpfec,
351 flags::FLAG_use_flexfec,
philipel5affbf22019-01-24 15:49:40 +0100352 flags::NumStreams() < 2, // Automatic quality scaling.
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +0100353 flags::Clip(),
354 flags::GetCaptureDevice()};
sprang1168fd42017-06-21 09:00:17 -0700355 params.audio = {flags::FLAG_audio, flags::FLAG_audio_video_sync,
henrika255750b2018-08-27 16:13:37 +0200356 flags::FLAG_audio_dtx, flags::FLAG_use_real_adm};
Mirko Bonadei45a4c412018-07-31 15:07:28 +0200357 params.logging = {flags::FLAG_rtc_event_log_name, flags::FLAG_rtp_dump_name,
358 flags::FLAG_encoded_frame_path};
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +0100359 params.screenshare[0].enabled = false;
Yves Gerey665174f2018-06-19 15:03:05 +0200360 params.analyzer = {"video",
361 0.0,
362 0.0,
363 flags::DurationSecs(),
364 flags::OutputFilename(),
365 flags::GraphTitle()};
Artem Titovf18b3522018-08-28 16:54:24 +0200366 params.config = pipe_config;
sprang1168fd42017-06-21 09:00:17 -0700367
368 if (flags::NumStreams() > 1 && flags::Stream0().empty() &&
369 flags::Stream1().empty()) {
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +0100370 params.ss[0].infer_streams = true;
sprang1168fd42017-06-21 09:00:17 -0700371 }
ivica5d6a06c2015-09-17 05:30:24 -0700372
sprangce4aef12015-11-02 07:23:20 -0800373 std::vector<std::string> stream_descriptors;
374 stream_descriptors.push_back(flags::Stream0());
375 stream_descriptors.push_back(flags::Stream1());
376 std::vector<std::string> SL_descriptors;
377 SL_descriptors.push_back(flags::SL0());
378 SL_descriptors.push_back(flags::SL1());
Sergey Silkina89800c2019-02-19 12:52:56 +0100379 SL_descriptors.push_back(flags::SL2());
sprangce4aef12015-11-02 07:23:20 -0800380 VideoQualityTest::FillScalabilitySettings(
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +0100381 &params, 0, stream_descriptors, flags::NumStreams(),
382 flags::SelectedStream(), flags::NumSpatialLayers(), flags::SelectedSL(),
Sergey Silkin57027362018-05-15 09:12:05 +0200383 flags::InterLayerPred(), SL_descriptors);
sprangce4aef12015-11-02 07:23:20 -0800384
Karl Wiberg918f50c2018-07-05 11:40:33 +0200385 auto fixture = absl::make_unique<VideoQualityTest>(nullptr);
sprangce4aef12015-11-02 07:23:20 -0800386 if (flags::DurationSecs()) {
Patrik Höglundb6b29e02018-06-21 16:58:01 +0200387 fixture->RunWithAnalyzer(params);
sprangce4aef12015-11-02 07:23:20 -0800388 } else {
Patrik Höglundb6b29e02018-06-21 16:58:01 +0200389 fixture->RunWithRenderers(params);
sprangce4aef12015-11-02 07:23:20 -0800390 }
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000391}
392} // namespace webrtc
393
394int main(int argc, char* argv[]) {
395 ::testing::InitGoogleTest(&argc, argv);
sprang1168fd42017-06-21 09:00:17 -0700396 rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
397 if (webrtc::flags::FLAG_help) {
398 rtc::FlagList::Print(nullptr, false);
399 return 0;
400 }
401
Mirko Bonadei45a4c412018-07-31 15:07:28 +0200402 rtc::LogMessage::SetLogToStderr(webrtc::flags::FLAG_logs);
403
Bjorn Tereliusedab3012018-01-31 17:23:40 +0100404 webrtc::test::ValidateFieldTrialsStringOrDie(
405 webrtc::flags::FLAG_force_fieldtrials);
406 // InitFieldTrialsFromString stores the char*, so the char array must outlive
407 // the application.
408 webrtc::field_trial::InitFieldTrialsFromString(
409 webrtc::flags::FLAG_force_fieldtrials);
sprang89c4a7e2017-06-30 13:27:40 -0700410
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000411 webrtc::test::RunTest(webrtc::Loopback);
412 return 0;
413}