blob: ed14b30d5f5deca99f441ceedae848d65653319b [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/memory/memory.h"
20#include "absl/types/optional.h"
21#include "api/bitrate_constraints.h"
22#include "api/test/simulated_network.h"
23#include "api/test/video_quality_test_fixture.h"
24#include "api/video_codecs/video_codec.h"
25#include "rtc_base/checks.h"
Mirko Bonadei45a4c412018-07-31 15:07:28 +020026#include "rtc_base/logging.h"
Steve Anton10542f22019-01-11 09:11:00 -080027#include "rtc_base/string_encode.h"
Mirko Bonadei17f48782018-09-28 08:51:10 +020028#include "system_wrappers/include/field_trial.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020029#include "test/field_trial.h"
30#include "test/gtest.h"
31#include "test/run_test.h"
32#include "video/video_quality_test.h"
sprang@webrtc.org131bea82015-02-18 12:46:06 +000033
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020034using ::webrtc::BitrateConstraints;
35using ::webrtc::BuiltInNetworkBehaviorConfig;
36using ::webrtc::InterLayerPredMode;
37using ::webrtc::SdpVideoFormat;
38using ::webrtc::VideoQualityTest;
sprang@webrtc.org131bea82015-02-18 12:46:06 +000039
sprangce4aef12015-11-02 07:23:20 -080040// Flags common with video loopback, with different default values.
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020041ABSL_FLAG(int, width, 1850, "Video width (crops source).");
sprang@webrtc.org131bea82015-02-18 12:46:06 +000042size_t Width() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020043 return static_cast<size_t>(absl::GetFlag(FLAGS_width));
sprang@webrtc.org131bea82015-02-18 12:46:06 +000044}
sprangd6358952015-07-29 07:58:13 -070045
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020046ABSL_FLAG(int, height, 1110, "Video height (crops source).");
sprang@webrtc.org131bea82015-02-18 12:46:06 +000047size_t Height() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020048 return static_cast<size_t>(absl::GetFlag(FLAGS_height));
sprang@webrtc.org131bea82015-02-18 12:46:06 +000049}
50
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020051ABSL_FLAG(int, fps, 5, "Frames per second.");
sprang@webrtc.org131bea82015-02-18 12:46:06 +000052int Fps() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020053 return absl::GetFlag(FLAGS_fps);
sprang@webrtc.org131bea82015-02-18 12:46:06 +000054}
55
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020056ABSL_FLAG(int, min_bitrate, 50, "Call and stream min bitrate in kbps.");
ivica5d6a06c2015-09-17 05:30:24 -070057int MinBitrateKbps() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020058 return absl::GetFlag(FLAGS_min_bitrate);
sprang@webrtc.org131bea82015-02-18 12:46:06 +000059}
60
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020061ABSL_FLAG(int, start_bitrate, 300, "Call start bitrate in kbps.");
ivica5d6a06c2015-09-17 05:30:24 -070062int StartBitrateKbps() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020063 return absl::GetFlag(FLAGS_start_bitrate);
sprang@webrtc.org131bea82015-02-18 12:46:06 +000064}
65
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020066ABSL_FLAG(int, target_bitrate, 200, "Stream target bitrate in kbps.");
ivica5d6a06c2015-09-17 05:30:24 -070067int TargetBitrateKbps() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020068 return absl::GetFlag(FLAGS_target_bitrate);
ivica5d6a06c2015-09-17 05:30:24 -070069}
70
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020071ABSL_FLAG(int, max_bitrate, 1000, "Call and stream max bitrate in kbps.");
ivica5d6a06c2015-09-17 05:30:24 -070072int MaxBitrateKbps() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020073 return absl::GetFlag(FLAGS_max_bitrate);
sprang@webrtc.org131bea82015-02-18 12:46:06 +000074}
75
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020076ABSL_FLAG(int, num_temporal_layers, 2, "Number of temporal layers to use.");
sprangce4aef12015-11-02 07:23:20 -080077int NumTemporalLayers() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020078 return absl::GetFlag(FLAGS_num_temporal_layers);
ivica87f83a92015-10-08 05:13:32 -070079}
80
sprangce4aef12015-11-02 07:23:20 -080081// Flags common with video loopback, with equal default values.
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020082ABSL_FLAG(std::string, codec, "VP8", "Video codec to use.");
sprang7a975f72015-10-12 06:33:21 -070083std::string Codec() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020084 return absl::GetFlag(FLAGS_codec);
ivica87f83a92015-10-08 05:13:32 -070085}
86
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020087ABSL_FLAG(std::string,
88 rtc_event_log_name,
89 "",
90 "Filename for rtc event log. Two files "
91 "with \"_send\" and \"_recv\" suffixes will be created.");
ilnik98436952017-07-13 00:47:03 -070092std::string RtcEventLogName() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020093 return absl::GetFlag(FLAGS_rtc_event_log_name);
ilnik98436952017-07-13 00:47:03 -070094}
95
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020096ABSL_FLAG(std::string,
97 rtp_dump_name,
98 "",
99 "Filename for dumped received RTP stream.");
ilnik98436952017-07-13 00:47:03 -0700100std::string RtpDumpName() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200101 return absl::GetFlag(FLAGS_rtp_dump_name);
ilnik98436952017-07-13 00:47:03 -0700102}
103
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200104ABSL_FLAG(int,
105 selected_tl,
106 -1,
107 "Temporal layer to show or analyze. -1 to disable filtering.");
sprangce4aef12015-11-02 07:23:20 -0800108int SelectedTL() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200109 return absl::GetFlag(FLAGS_selected_tl);
sprangce4aef12015-11-02 07:23:20 -0800110}
111
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200112ABSL_FLAG(
113 int,
sprangce4aef12015-11-02 07:23:20 -0800114 duration,
115 0,
116 "Duration of the test in seconds. If 0, rendered will be shown instead.");
117int DurationSecs() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200118 return absl::GetFlag(FLAGS_duration);
sprangce4aef12015-11-02 07:23:20 -0800119}
120
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200121ABSL_FLAG(std::string, output_filename, "", "Target graph data filename.");
sprangce4aef12015-11-02 07:23:20 -0800122std::string OutputFilename() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200123 return absl::GetFlag(FLAGS_output_filename);
sprangce4aef12015-11-02 07:23:20 -0800124}
125
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200126ABSL_FLAG(std::string,
127 graph_title,
128 "",
129 "If empty, title will be generated automatically.");
sprangce4aef12015-11-02 07:23:20 -0800130std::string GraphTitle() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200131 return absl::GetFlag(FLAGS_graph_title);
sprangce4aef12015-11-02 07:23:20 -0800132}
133
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200134ABSL_FLAG(int, loss_percent, 0, "Percentage of packets randomly lost.");
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000135int LossPercent() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200136 return absl::GetFlag(FLAGS_loss_percent);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000137}
138
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200139ABSL_FLAG(int,
140 link_capacity,
141 0,
142 "Capacity (kbps) of the fake link. 0 means infinite.");
ivica5d6a06c2015-09-17 05:30:24 -0700143int LinkCapacityKbps() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200144 return absl::GetFlag(FLAGS_link_capacity);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000145}
146
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200147ABSL_FLAG(int, queue_size, 0, "Size of the bottleneck link queue in packets.");
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000148int QueueSize() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200149 return absl::GetFlag(FLAGS_queue_size);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000150}
151
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200152ABSL_FLAG(int,
153 avg_propagation_delay_ms,
154 0,
155 "Average link propagation delay in ms.");
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000156int AvgPropagationDelayMs() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200157 return absl::GetFlag(FLAGS_avg_propagation_delay_ms);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000158}
159
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200160ABSL_FLAG(int,
161 std_propagation_delay_ms,
162 0,
163 "Link propagation delay standard deviation in ms.");
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000164int StdPropagationDelayMs() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200165 return absl::GetFlag(FLAGS_std_propagation_delay_ms);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000166}
167
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200168ABSL_FLAG(int, num_streams, 0, "Number of streams to show or analyze.");
sprang1168fd42017-06-21 09:00:17 -0700169int NumStreams() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200170 return absl::GetFlag(FLAGS_num_streams);
sprang1168fd42017-06-21 09:00:17 -0700171}
172
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200173ABSL_FLAG(int,
174 selected_stream,
175 0,
176 "ID of the stream to show or analyze. "
177 "Set to the number of streams to show them all.");
sprangce4aef12015-11-02 07:23:20 -0800178int SelectedStream() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200179 return absl::GetFlag(FLAGS_selected_stream);
sprangce4aef12015-11-02 07:23:20 -0800180}
181
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200182ABSL_FLAG(int, num_spatial_layers, 1, "Number of spatial layers to use.");
sprangce4aef12015-11-02 07:23:20 -0800183int NumSpatialLayers() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200184 return absl::GetFlag(FLAGS_num_spatial_layers);
sprangce4aef12015-11-02 07:23:20 -0800185}
186
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200187ABSL_FLAG(int,
188 inter_layer_pred,
189 0,
190 "Inter-layer prediction mode. "
191 "0 - enabled, 1 - disabled, 2 - enabled only for key pictures.");
Sergey Silkin57027362018-05-15 09:12:05 +0200192InterLayerPredMode InterLayerPred() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200193 if (absl::GetFlag(FLAGS_inter_layer_pred) == 0) {
194 return webrtc::InterLayerPredMode::kOn;
195 } else if (absl::GetFlag(FLAGS_inter_layer_pred) == 1) {
196 return webrtc::InterLayerPredMode::kOff;
Sergey Silkin57027362018-05-15 09:12:05 +0200197 } else {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200198 RTC_DCHECK_EQ(absl::GetFlag(FLAGS_inter_layer_pred), 2);
199 return webrtc::InterLayerPredMode::kOnKeyPic;
Sergey Silkin57027362018-05-15 09:12:05 +0200200 }
201}
202
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200203ABSL_FLAG(int,
204 selected_sl,
205 -1,
206 "Spatial layer to show or analyze. -1 to disable filtering.");
sprangce4aef12015-11-02 07:23:20 -0800207int SelectedSL() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200208 return absl::GetFlag(FLAGS_selected_sl);
sprangce4aef12015-11-02 07:23:20 -0800209}
210
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200211ABSL_FLAG(std::string,
212 stream0,
213 "",
214 "Comma separated values describing VideoStream for stream #0.");
sprangce4aef12015-11-02 07:23:20 -0800215std::string Stream0() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200216 return absl::GetFlag(FLAGS_stream0);
sprangce4aef12015-11-02 07:23:20 -0800217}
218
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200219ABSL_FLAG(std::string,
220 stream1,
221 "",
222 "Comma separated values describing VideoStream for stream #1.");
sprangce4aef12015-11-02 07:23:20 -0800223std::string Stream1() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200224 return absl::GetFlag(FLAGS_stream1);
sprangce4aef12015-11-02 07:23:20 -0800225}
226
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200227ABSL_FLAG(std::string,
228 sl0,
229 "",
230 "Comma separated values describing SpatialLayer for layer #0.");
sprangce4aef12015-11-02 07:23:20 -0800231std::string SL0() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200232 return absl::GetFlag(FLAGS_sl0);
sprangce4aef12015-11-02 07:23:20 -0800233}
234
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200235ABSL_FLAG(std::string,
236 sl1,
237 "",
238 "Comma separated values describing SpatialLayer for layer #1.");
sprangce4aef12015-11-02 07:23:20 -0800239std::string SL1() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200240 return absl::GetFlag(FLAGS_sl1);
sprangce4aef12015-11-02 07:23:20 -0800241}
242
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200243ABSL_FLAG(std::string,
244 encoded_frame_path,
245 "",
246 "The base path for encoded frame logs. Created files will have "
247 "the form <encoded_frame_path>.<n>.(recv|send.<m>).ivf");
palmkviste75f2042016-09-28 06:19:48 -0700248std::string EncodedFramePath() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200249 return absl::GetFlag(FLAGS_encoded_frame_path);
palmkviste75f2042016-09-28 06:19:48 -0700250}
251
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200252ABSL_FLAG(bool, logs, false, "print logs to stderr");
ivica87f83a92015-10-08 05:13:32 -0700253
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200254ABSL_FLAG(bool, send_side_bwe, true, "Use send-side bandwidth estimation");
Erik Språng6b8d3552015-09-24 15:06:57 +0200255
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200256ABSL_FLAG(bool, generic_descriptor, false, "Use the generic frame descriptor.");
philipel569397f2018-09-26 12:25:31 +0200257
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200258ABSL_FLAG(bool, allow_reordering, false, "Allow packet reordering to occur");
philipela2c55232016-01-26 08:41:53 -0800259
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200260ABSL_FLAG(
261 std::string,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000262 force_fieldtrials,
263 "",
264 "Field trials control experimental feature code which can be forced. "
265 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/"
266 " will assign the group Enable to field trial WebRTC-FooFeature. Multiple "
267 "trials are separated by \"/\"");
sprangce4aef12015-11-02 07:23:20 -0800268
269// Screenshare-specific flags.
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200270ABSL_FLAG(int,
271 min_transmit_bitrate,
272 400,
273 "Min transmit bitrate incl. padding.");
sprangce4aef12015-11-02 07:23:20 -0800274int MinTransmitBitrateKbps() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200275 return absl::GetFlag(FLAGS_min_transmit_bitrate);
sprangce4aef12015-11-02 07:23:20 -0800276}
277
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200278ABSL_FLAG(bool,
279 generate_slides,
280 false,
281 "Whether to use randomly generated slides or read them from files.");
erikvarga579de6f2017-08-29 09:12:57 -0700282bool GenerateSlides() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200283 return absl::GetFlag(FLAGS_generate_slides);
erikvarga579de6f2017-08-29 09:12:57 -0700284}
285
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200286ABSL_FLAG(int,
287 slide_change_interval,
288 10,
289 "Interval (in seconds) between simulated slide changes.");
sprangce4aef12015-11-02 07:23:20 -0800290int SlideChangeInterval() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200291 return absl::GetFlag(FLAGS_slide_change_interval);
sprangce4aef12015-11-02 07:23:20 -0800292}
293
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200294ABSL_FLAG(
295 int,
sprangce4aef12015-11-02 07:23:20 -0800296 scroll_duration,
297 0,
298 "Duration (in seconds) during which a slide will be scrolled into place.");
299int ScrollDuration() {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200300 return absl::GetFlag(FLAGS_scroll_duration);
sprangce4aef12015-11-02 07:23:20 -0800301}
302
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200303ABSL_FLAG(std::string,
304 slides,
305 "",
306 "Comma-separated list of *.yuv files to display as slides.");
ilnik8d8185c2017-04-12 04:52:55 -0700307std::vector<std::string> Slides() {
308 std::vector<std::string> slides;
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200309 std::string slides_list = absl::GetFlag(FLAGS_slides);
ilnik8d8185c2017-04-12 04:52:55 -0700310 rtc::tokenize(slides_list, ',', &slides);
311 return slides;
312}
313
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000314void Loopback() {
Artem Titov75e36472018-10-08 12:28:56 +0200315 BuiltInNetworkBehaviorConfig pipe_config;
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200316 pipe_config.loss_percent = LossPercent();
317 pipe_config.link_capacity_kbps = LinkCapacityKbps();
318 pipe_config.queue_length_packets = QueueSize();
319 pipe_config.queue_delay_ms = AvgPropagationDelayMs();
320 pipe_config.delay_standard_deviation_ms = StdPropagationDelayMs();
321 pipe_config.allow_reordering = absl::GetFlag(FLAGS_allow_reordering);
ivica5d6a06c2015-09-17 05:30:24 -0700322
Sebastian Janssonfc8d26b2018-02-21 09:52:06 +0100323 BitrateConstraints call_bitrate_config;
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200324 call_bitrate_config.min_bitrate_bps = MinBitrateKbps() * 1000;
325 call_bitrate_config.start_bitrate_bps = StartBitrateKbps() * 1000;
Erik Språng28bb3912018-07-11 16:06:55 +0200326 call_bitrate_config.max_bitrate_bps = -1; // Don't cap bandwidth estimate.
ivica5d6a06c2015-09-17 05:30:24 -0700327
minyue73208662016-08-18 06:28:55 -0700328 VideoQualityTest::Params params;
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200329 params.call = {absl::GetFlag(FLAGS_send_side_bwe),
330 absl::GetFlag(FLAGS_generic_descriptor), call_bitrate_config};
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +0100331 params.video[0] = {true,
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200332 Width(),
333 Height(),
334 Fps(),
335 MinBitrateKbps() * 1000,
336 TargetBitrateKbps() * 1000,
337 MaxBitrateKbps() * 1000,
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +0100338 false,
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200339 Codec(),
340 NumTemporalLayers(),
341 SelectedTL(),
342 MinTransmitBitrateKbps() * 1000,
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +0100343 false, // ULPFEC disabled.
344 false, // FlexFEC disabled.
Niels Möller6aa415e2018-06-07 11:14:13 +0200345 false, // Automatic scaling disabled.
Ilya Nikolaevskiy1f0a84a2019-02-05 14:35:33 +0100346 "",
347 0, // capture_device_index.
Ilya Nikolaevskiy85fc3252019-02-11 10:41:50 +0100348 SdpVideoFormat::Parameters()};
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200349 params.screenshare[0] = {true, GenerateSlides(), SlideChangeInterval(),
350 ScrollDuration(), Slides()};
351 params.analyzer = {"screenshare", 0.0, 0.0, DurationSecs(),
352 OutputFilename(), GraphTitle()};
Artem Titovf18b3522018-08-28 16:54:24 +0200353 params.config = pipe_config;
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200354 params.logging = {RtcEventLogName(), RtpDumpName(), EncodedFramePath()};
ivica5d6a06c2015-09-17 05:30:24 -0700355
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200356 if (NumStreams() > 1 && Stream0().empty() && Stream1().empty()) {
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +0100357 params.ss[0].infer_streams = true;
sprang1168fd42017-06-21 09:00:17 -0700358 }
359
sprangce4aef12015-11-02 07:23:20 -0800360 std::vector<std::string> stream_descriptors;
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200361 stream_descriptors.push_back(Stream0());
362 stream_descriptors.push_back(Stream1());
sprangce4aef12015-11-02 07:23:20 -0800363 std::vector<std::string> SL_descriptors;
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200364 SL_descriptors.push_back(SL0());
365 SL_descriptors.push_back(SL1());
sprangce4aef12015-11-02 07:23:20 -0800366 VideoQualityTest::FillScalabilitySettings(
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200367 &params, 0, stream_descriptors, NumStreams(), SelectedStream(),
368 NumSpatialLayers(), SelectedSL(), InterLayerPred(), SL_descriptors);
sprangce4aef12015-11-02 07:23:20 -0800369
Karl Wiberg918f50c2018-07-05 11:40:33 +0200370 auto fixture = absl::make_unique<VideoQualityTest>(nullptr);
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200371 if (DurationSecs()) {
Patrik Höglundb6b29e02018-06-21 16:58:01 +0200372 fixture->RunWithAnalyzer(params);
sprangce4aef12015-11-02 07:23:20 -0800373 } else {
Patrik Höglundb6b29e02018-06-21 16:58:01 +0200374 fixture->RunWithRenderers(params);
sprangce4aef12015-11-02 07:23:20 -0800375 }
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000376}
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000377
378int main(int argc, char* argv[]) {
379 ::testing::InitGoogleTest(&argc, argv);
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200380 absl::ParseCommandLine(argc, argv);
kjellander12fa8f42017-05-17 11:19:58 -0700381
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200382 rtc::LogMessage::SetLogToStderr(absl::GetFlag(FLAGS_logs));
Mirko Bonadei45a4c412018-07-31 15:07:28 +0200383
Bjorn Tereliusedab3012018-01-31 17:23:40 +0100384 // InitFieldTrialsFromString stores the char*, so the char array must outlive
385 // the application.
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200386 const std::string field_trials = absl::GetFlag(FLAGS_force_fieldtrials);
387 webrtc::field_trial::InitFieldTrialsFromString(field_trials.c_str());
sprang89c4a7e2017-06-30 13:27:40 -0700388
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200389 webrtc::test::RunTest(Loopback);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000390 return 0;
391}