blob: b8121dc85c681fe18e243d5979ce901cf41c182f [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>
Jonas Olsson5b2eda42019-06-11 14:29:40 +020012
Yves Gerey3e707812018-11-28 16:47:49 +010013#include <memory>
14#include <string>
15#include <vector>
sprang@webrtc.org131bea82015-02-18 12:46:06 +000016
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020017#include "absl/flags/flag.h"
18#include "absl/flags/parse.h"
Yves Gerey3e707812018-11-28 16:47:49 +010019#include "absl/types/optional.h"
Yves Gerey3e707812018-11-28 16:47:49 +010020#include "api/test/simulated_network.h"
21#include "api/test/video_quality_test_fixture.h"
Mirko Bonadei738bfa72019-09-17 14:47:38 +020022#include "api/transport/bitrate_settings.h"
Yves Gerey3e707812018-11-28 16:47:49 +010023#include "api/video_codecs/video_codec.h"
24#include "rtc_base/checks.h"
Mirko Bonadei45a4c412018-07-31 15:07:28 +020025#include "rtc_base/logging.h"
Steve Anton10542f22019-01-11 09:11:00 -080026#include "rtc_base/string_encode.h"
Mirko Bonadei17f48782018-09-28 08:51:10 +020027#include "system_wrappers/include/field_trial.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020028#include "test/field_trial.h"
29#include "test/gtest.h"
30#include "test/run_test.h"
31#include "video/video_quality_test.h"
sprang@webrtc.org131bea82015-02-18 12:46:06 +000032
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020033using ::webrtc::BitrateConstraints;
34using ::webrtc::BuiltInNetworkBehaviorConfig;
35using ::webrtc::InterLayerPredMode;
36using ::webrtc::SdpVideoFormat;
37using ::webrtc::VideoQualityTest;
sprang@webrtc.org131bea82015-02-18 12:46:06 +000038
sprangce4aef12015-11-02 07:23:20 -080039// Flags common with video loopback, with different default values.
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020040ABSL_FLAG(int, width, 1850, "Video width (crops source).");
sprang@webrtc.org131bea82015-02-18 12:46:06 +000041size_t Width() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020042 return static_cast<size_t>(absl::GetFlag(FLAGS_width));
sprang@webrtc.org131bea82015-02-18 12:46:06 +000043}
sprangd6358952015-07-29 07:58:13 -070044
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020045ABSL_FLAG(int, height, 1110, "Video height (crops source).");
sprang@webrtc.org131bea82015-02-18 12:46:06 +000046size_t Height() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020047 return static_cast<size_t>(absl::GetFlag(FLAGS_height));
sprang@webrtc.org131bea82015-02-18 12:46:06 +000048}
49
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020050ABSL_FLAG(int, fps, 5, "Frames per second.");
sprang@webrtc.org131bea82015-02-18 12:46:06 +000051int Fps() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020052 return absl::GetFlag(FLAGS_fps);
sprang@webrtc.org131bea82015-02-18 12:46:06 +000053}
54
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020055ABSL_FLAG(int, min_bitrate, 50, "Call and stream min bitrate in kbps.");
ivica5d6a06c2015-09-17 05:30:24 -070056int MinBitrateKbps() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020057 return absl::GetFlag(FLAGS_min_bitrate);
sprang@webrtc.org131bea82015-02-18 12:46:06 +000058}
59
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020060ABSL_FLAG(int, start_bitrate, 300, "Call start bitrate in kbps.");
ivica5d6a06c2015-09-17 05:30:24 -070061int StartBitrateKbps() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020062 return absl::GetFlag(FLAGS_start_bitrate);
sprang@webrtc.org131bea82015-02-18 12:46:06 +000063}
64
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020065ABSL_FLAG(int, target_bitrate, 200, "Stream target bitrate in kbps.");
ivica5d6a06c2015-09-17 05:30:24 -070066int TargetBitrateKbps() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020067 return absl::GetFlag(FLAGS_target_bitrate);
ivica5d6a06c2015-09-17 05:30:24 -070068}
69
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020070ABSL_FLAG(int, max_bitrate, 1000, "Call and stream max bitrate in kbps.");
ivica5d6a06c2015-09-17 05:30:24 -070071int MaxBitrateKbps() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020072 return absl::GetFlag(FLAGS_max_bitrate);
sprang@webrtc.org131bea82015-02-18 12:46:06 +000073}
74
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020075ABSL_FLAG(int, num_temporal_layers, 2, "Number of temporal layers to use.");
sprangce4aef12015-11-02 07:23:20 -080076int NumTemporalLayers() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020077 return absl::GetFlag(FLAGS_num_temporal_layers);
ivica87f83a92015-10-08 05:13:32 -070078}
79
sprangce4aef12015-11-02 07:23:20 -080080// Flags common with video loopback, with equal default values.
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020081ABSL_FLAG(std::string, codec, "VP8", "Video codec to use.");
sprang7a975f72015-10-12 06:33:21 -070082std::string Codec() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020083 return absl::GetFlag(FLAGS_codec);
ivica87f83a92015-10-08 05:13:32 -070084}
85
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020086ABSL_FLAG(std::string,
87 rtc_event_log_name,
88 "",
89 "Filename for rtc event log. Two files "
90 "with \"_send\" and \"_recv\" suffixes will be created.");
ilnik98436952017-07-13 00:47:03 -070091std::string RtcEventLogName() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020092 return absl::GetFlag(FLAGS_rtc_event_log_name);
ilnik98436952017-07-13 00:47:03 -070093}
94
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020095ABSL_FLAG(std::string,
96 rtp_dump_name,
97 "",
98 "Filename for dumped received RTP stream.");
ilnik98436952017-07-13 00:47:03 -070099std::string RtpDumpName() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200100 return absl::GetFlag(FLAGS_rtp_dump_name);
ilnik98436952017-07-13 00:47:03 -0700101}
102
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200103ABSL_FLAG(int,
104 selected_tl,
105 -1,
106 "Temporal layer to show or analyze. -1 to disable filtering.");
sprangce4aef12015-11-02 07:23:20 -0800107int SelectedTL() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200108 return absl::GetFlag(FLAGS_selected_tl);
sprangce4aef12015-11-02 07:23:20 -0800109}
110
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200111ABSL_FLAG(
112 int,
sprangce4aef12015-11-02 07:23:20 -0800113 duration,
114 0,
115 "Duration of the test in seconds. If 0, rendered will be shown instead.");
116int DurationSecs() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200117 return absl::GetFlag(FLAGS_duration);
sprangce4aef12015-11-02 07:23:20 -0800118}
119
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200120ABSL_FLAG(std::string, output_filename, "", "Target graph data filename.");
sprangce4aef12015-11-02 07:23:20 -0800121std::string OutputFilename() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200122 return absl::GetFlag(FLAGS_output_filename);
sprangce4aef12015-11-02 07:23:20 -0800123}
124
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200125ABSL_FLAG(std::string,
126 graph_title,
127 "",
128 "If empty, title will be generated automatically.");
sprangce4aef12015-11-02 07:23:20 -0800129std::string GraphTitle() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200130 return absl::GetFlag(FLAGS_graph_title);
sprangce4aef12015-11-02 07:23:20 -0800131}
132
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200133ABSL_FLAG(int, loss_percent, 0, "Percentage of packets randomly lost.");
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000134int LossPercent() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200135 return absl::GetFlag(FLAGS_loss_percent);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000136}
137
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200138ABSL_FLAG(int,
139 link_capacity,
140 0,
141 "Capacity (kbps) of the fake link. 0 means infinite.");
ivica5d6a06c2015-09-17 05:30:24 -0700142int LinkCapacityKbps() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200143 return absl::GetFlag(FLAGS_link_capacity);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000144}
145
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200146ABSL_FLAG(int, queue_size, 0, "Size of the bottleneck link queue in packets.");
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000147int QueueSize() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200148 return absl::GetFlag(FLAGS_queue_size);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000149}
150
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200151ABSL_FLAG(int,
152 avg_propagation_delay_ms,
153 0,
154 "Average link propagation delay in ms.");
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000155int AvgPropagationDelayMs() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200156 return absl::GetFlag(FLAGS_avg_propagation_delay_ms);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000157}
158
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200159ABSL_FLAG(int,
160 std_propagation_delay_ms,
161 0,
162 "Link propagation delay standard deviation in ms.");
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000163int StdPropagationDelayMs() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200164 return absl::GetFlag(FLAGS_std_propagation_delay_ms);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000165}
166
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200167ABSL_FLAG(int, num_streams, 0, "Number of streams to show or analyze.");
sprang1168fd42017-06-21 09:00:17 -0700168int NumStreams() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200169 return absl::GetFlag(FLAGS_num_streams);
sprang1168fd42017-06-21 09:00:17 -0700170}
171
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200172ABSL_FLAG(int,
173 selected_stream,
174 0,
175 "ID of the stream to show or analyze. "
176 "Set to the number of streams to show them all.");
sprangce4aef12015-11-02 07:23:20 -0800177int SelectedStream() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200178 return absl::GetFlag(FLAGS_selected_stream);
sprangce4aef12015-11-02 07:23:20 -0800179}
180
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200181ABSL_FLAG(int, num_spatial_layers, 1, "Number of spatial layers to use.");
sprangce4aef12015-11-02 07:23:20 -0800182int NumSpatialLayers() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200183 return absl::GetFlag(FLAGS_num_spatial_layers);
sprangce4aef12015-11-02 07:23:20 -0800184}
185
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200186ABSL_FLAG(int,
187 inter_layer_pred,
188 0,
189 "Inter-layer prediction mode. "
190 "0 - enabled, 1 - disabled, 2 - enabled only for key pictures.");
Sergey Silkin57027362018-05-15 09:12:05 +0200191InterLayerPredMode InterLayerPred() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200192 if (absl::GetFlag(FLAGS_inter_layer_pred) == 0) {
193 return webrtc::InterLayerPredMode::kOn;
194 } else if (absl::GetFlag(FLAGS_inter_layer_pred) == 1) {
195 return webrtc::InterLayerPredMode::kOff;
Sergey Silkin57027362018-05-15 09:12:05 +0200196 } else {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200197 RTC_DCHECK_EQ(absl::GetFlag(FLAGS_inter_layer_pred), 2);
198 return webrtc::InterLayerPredMode::kOnKeyPic;
Sergey Silkin57027362018-05-15 09:12:05 +0200199 }
200}
201
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200202ABSL_FLAG(int,
203 selected_sl,
204 -1,
205 "Spatial layer to show or analyze. -1 to disable filtering.");
sprangce4aef12015-11-02 07:23:20 -0800206int SelectedSL() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200207 return absl::GetFlag(FLAGS_selected_sl);
sprangce4aef12015-11-02 07:23:20 -0800208}
209
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200210ABSL_FLAG(std::string,
211 stream0,
212 "",
213 "Comma separated values describing VideoStream for stream #0.");
sprangce4aef12015-11-02 07:23:20 -0800214std::string Stream0() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200215 return absl::GetFlag(FLAGS_stream0);
sprangce4aef12015-11-02 07:23:20 -0800216}
217
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200218ABSL_FLAG(std::string,
219 stream1,
220 "",
221 "Comma separated values describing VideoStream for stream #1.");
sprangce4aef12015-11-02 07:23:20 -0800222std::string Stream1() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200223 return absl::GetFlag(FLAGS_stream1);
sprangce4aef12015-11-02 07:23:20 -0800224}
225
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200226ABSL_FLAG(std::string,
227 sl0,
228 "",
229 "Comma separated values describing SpatialLayer for layer #0.");
sprangce4aef12015-11-02 07:23:20 -0800230std::string SL0() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200231 return absl::GetFlag(FLAGS_sl0);
sprangce4aef12015-11-02 07:23:20 -0800232}
233
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200234ABSL_FLAG(std::string,
235 sl1,
236 "",
237 "Comma separated values describing SpatialLayer for layer #1.");
sprangce4aef12015-11-02 07:23:20 -0800238std::string SL1() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200239 return absl::GetFlag(FLAGS_sl1);
sprangce4aef12015-11-02 07:23:20 -0800240}
241
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200242ABSL_FLAG(std::string,
243 encoded_frame_path,
244 "",
245 "The base path for encoded frame logs. Created files will have "
246 "the form <encoded_frame_path>.<n>.(recv|send.<m>).ivf");
palmkviste75f2042016-09-28 06:19:48 -0700247std::string EncodedFramePath() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200248 return absl::GetFlag(FLAGS_encoded_frame_path);
palmkviste75f2042016-09-28 06:19:48 -0700249}
250
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200251ABSL_FLAG(bool, logs, false, "print logs to stderr");
ivica87f83a92015-10-08 05:13:32 -0700252
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200253ABSL_FLAG(bool, send_side_bwe, true, "Use send-side bandwidth estimation");
Erik Språng6b8d3552015-09-24 15:06:57 +0200254
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200255ABSL_FLAG(bool, generic_descriptor, false, "Use the generic frame descriptor.");
philipel569397f2018-09-26 12:25:31 +0200256
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200257ABSL_FLAG(bool, allow_reordering, false, "Allow packet reordering to occur");
philipela2c55232016-01-26 08:41:53 -0800258
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200259ABSL_FLAG(
260 std::string,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000261 force_fieldtrials,
262 "",
263 "Field trials control experimental feature code which can be forced. "
264 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/"
265 " will assign the group Enable to field trial WebRTC-FooFeature. Multiple "
266 "trials are separated by \"/\"");
sprangce4aef12015-11-02 07:23:20 -0800267
268// Screenshare-specific flags.
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200269ABSL_FLAG(int,
270 min_transmit_bitrate,
271 400,
272 "Min transmit bitrate incl. padding.");
sprangce4aef12015-11-02 07:23:20 -0800273int MinTransmitBitrateKbps() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200274 return absl::GetFlag(FLAGS_min_transmit_bitrate);
sprangce4aef12015-11-02 07:23:20 -0800275}
276
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200277ABSL_FLAG(bool,
278 generate_slides,
279 false,
280 "Whether to use randomly generated slides or read them from files.");
erikvarga579de6f2017-08-29 09:12:57 -0700281bool GenerateSlides() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200282 return absl::GetFlag(FLAGS_generate_slides);
erikvarga579de6f2017-08-29 09:12:57 -0700283}
284
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200285ABSL_FLAG(int,
286 slide_change_interval,
287 10,
288 "Interval (in seconds) between simulated slide changes.");
sprangce4aef12015-11-02 07:23:20 -0800289int SlideChangeInterval() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200290 return absl::GetFlag(FLAGS_slide_change_interval);
sprangce4aef12015-11-02 07:23:20 -0800291}
292
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200293ABSL_FLAG(
294 int,
sprangce4aef12015-11-02 07:23:20 -0800295 scroll_duration,
296 0,
297 "Duration (in seconds) during which a slide will be scrolled into place.");
298int ScrollDuration() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200299 return absl::GetFlag(FLAGS_scroll_duration);
sprangce4aef12015-11-02 07:23:20 -0800300}
301
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200302ABSL_FLAG(std::string,
303 slides,
304 "",
305 "Comma-separated list of *.yuv files to display as slides.");
ilnik8d8185c2017-04-12 04:52:55 -0700306std::vector<std::string> Slides() {
307 std::vector<std::string> slides;
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200308 std::string slides_list = absl::GetFlag(FLAGS_slides);
ilnik8d8185c2017-04-12 04:52:55 -0700309 rtc::tokenize(slides_list, ',', &slides);
310 return slides;
311}
312
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000313void Loopback() {
Artem Titov75e36472018-10-08 12:28:56 +0200314 BuiltInNetworkBehaviorConfig pipe_config;
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200315 pipe_config.loss_percent = LossPercent();
316 pipe_config.link_capacity_kbps = LinkCapacityKbps();
317 pipe_config.queue_length_packets = QueueSize();
318 pipe_config.queue_delay_ms = AvgPropagationDelayMs();
319 pipe_config.delay_standard_deviation_ms = StdPropagationDelayMs();
320 pipe_config.allow_reordering = absl::GetFlag(FLAGS_allow_reordering);
ivica5d6a06c2015-09-17 05:30:24 -0700321
Sebastian Janssonfc8d26b2018-02-21 09:52:06 +0100322 BitrateConstraints call_bitrate_config;
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200323 call_bitrate_config.min_bitrate_bps = MinBitrateKbps() * 1000;
324 call_bitrate_config.start_bitrate_bps = 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;
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200328 params.call = {absl::GetFlag(FLAGS_send_side_bwe),
329 absl::GetFlag(FLAGS_generic_descriptor), call_bitrate_config};
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +0100330 params.video[0] = {true,
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200331 Width(),
332 Height(),
333 Fps(),
334 MinBitrateKbps() * 1000,
335 TargetBitrateKbps() * 1000,
336 MaxBitrateKbps() * 1000,
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +0100337 false,
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200338 Codec(),
339 NumTemporalLayers(),
340 SelectedTL(),
341 MinTransmitBitrateKbps() * 1000,
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +0100342 false, // ULPFEC disabled.
343 false, // FlexFEC disabled.
Niels Möller6aa415e2018-06-07 11:14:13 +0200344 false, // Automatic scaling disabled.
Ilya Nikolaevskiy1f0a84a2019-02-05 14:35:33 +0100345 "",
346 0, // capture_device_index.
Ilya Nikolaevskiy85fc3252019-02-11 10:41:50 +0100347 SdpVideoFormat::Parameters()};
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200348 params.screenshare[0] = {true, GenerateSlides(), SlideChangeInterval(),
349 ScrollDuration(), Slides()};
350 params.analyzer = {"screenshare", 0.0, 0.0, DurationSecs(),
351 OutputFilename(), GraphTitle()};
Artem Titovf18b3522018-08-28 16:54:24 +0200352 params.config = pipe_config;
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200353 params.logging = {RtcEventLogName(), RtpDumpName(), EncodedFramePath()};
ivica5d6a06c2015-09-17 05:30:24 -0700354
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200355 if (NumStreams() > 1 && Stream0().empty() && Stream1().empty()) {
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +0100356 params.ss[0].infer_streams = true;
sprang1168fd42017-06-21 09:00:17 -0700357 }
358
sprangce4aef12015-11-02 07:23:20 -0800359 std::vector<std::string> stream_descriptors;
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200360 stream_descriptors.push_back(Stream0());
361 stream_descriptors.push_back(Stream1());
sprangce4aef12015-11-02 07:23:20 -0800362 std::vector<std::string> SL_descriptors;
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200363 SL_descriptors.push_back(SL0());
364 SL_descriptors.push_back(SL1());
sprangce4aef12015-11-02 07:23:20 -0800365 VideoQualityTest::FillScalabilitySettings(
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200366 &params, 0, stream_descriptors, NumStreams(), SelectedStream(),
367 NumSpatialLayers(), SelectedSL(), InterLayerPred(), SL_descriptors);
sprangce4aef12015-11-02 07:23:20 -0800368
Mirko Bonadei317a1f02019-09-17 17:06:18 +0200369 auto fixture = std::make_unique<VideoQualityTest>(nullptr);
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200370 if (DurationSecs()) {
Patrik Höglundb6b29e02018-06-21 16:58:01 +0200371 fixture->RunWithAnalyzer(params);
sprangce4aef12015-11-02 07:23:20 -0800372 } else {
Patrik Höglundb6b29e02018-06-21 16:58:01 +0200373 fixture->RunWithRenderers(params);
sprangce4aef12015-11-02 07:23:20 -0800374 }
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000375}
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000376
377int main(int argc, char* argv[]) {
378 ::testing::InitGoogleTest(&argc, argv);
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200379 absl::ParseCommandLine(argc, argv);
kjellander12fa8f42017-05-17 11:19:58 -0700380
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200381 rtc::LogMessage::SetLogToStderr(absl::GetFlag(FLAGS_logs));
Mirko Bonadei45a4c412018-07-31 15:07:28 +0200382
Bjorn Tereliusedab3012018-01-31 17:23:40 +0100383 // InitFieldTrialsFromString stores the char*, so the char array must outlive
384 // the application.
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200385 const std::string field_trials = absl::GetFlag(FLAGS_force_fieldtrials);
386 webrtc::field_trial::InitFieldTrialsFromString(field_trials.c_str());
sprang89c4a7e2017-06-30 13:27:40 -0700387
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200388 webrtc::test::RunTest(Loopback);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000389 return 0;
390}