sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 1 | /* |
| 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> |
| 12 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 13 | #include "rtc_base/flags.h" |
Mirko Bonadei | 45a4c41 | 2018-07-31 15:07:28 +0200 | [diff] [blame] | 14 | #include "rtc_base/logging.h" |
Bjorn Terelius | edab301 | 2018-01-31 17:23:40 +0100 | [diff] [blame] | 15 | #include "system_wrappers/include/field_trial_default.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 16 | #include "test/field_trial.h" |
| 17 | #include "test/gtest.h" |
| 18 | #include "test/run_test.h" |
| 19 | #include "video/video_quality_test.h" |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 20 | |
| 21 | namespace webrtc { |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 22 | namespace flags { |
| 23 | |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 24 | // Flags common with screenshare loopback, with different default values. |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 25 | DEFINE_int(width, 640, "Video width."); |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 26 | size_t Width() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 27 | return static_cast<size_t>(FLAG_width); |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 28 | } |
| 29 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 30 | DEFINE_int(height, 480, "Video height."); |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 31 | size_t Height() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 32 | return static_cast<size_t>(FLAG_height); |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 33 | } |
| 34 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 35 | DEFINE_int(fps, 30, "Frames per second."); |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 36 | int Fps() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 37 | return static_cast<int>(FLAG_fps); |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 38 | } |
| 39 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 40 | DEFINE_int(capture_device_index, 0, "Capture device to select"); |
Tarun Chawla | 8e857d1 | 2017-05-31 19:20:57 +0530 | [diff] [blame] | 41 | size_t GetCaptureDevice() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 42 | return static_cast<size_t>(FLAG_capture_device_index); |
Tarun Chawla | 8e857d1 | 2017-05-31 19:20:57 +0530 | [diff] [blame] | 43 | } |
| 44 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 45 | DEFINE_int(min_bitrate, 50, "Call and stream min bitrate in kbps."); |
ivica | 5d6a06c | 2015-09-17 05:30:24 -0700 | [diff] [blame] | 46 | int MinBitrateKbps() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 47 | return static_cast<int>(FLAG_min_bitrate); |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 48 | } |
| 49 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 50 | DEFINE_int(start_bitrate, 300, "Call start bitrate in kbps."); |
ivica | 5d6a06c | 2015-09-17 05:30:24 -0700 | [diff] [blame] | 51 | int StartBitrateKbps() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 52 | return static_cast<int>(FLAG_start_bitrate); |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 53 | } |
| 54 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 55 | DEFINE_int(target_bitrate, 800, "Stream target bitrate in kbps."); |
ivica | 5d6a06c | 2015-09-17 05:30:24 -0700 | [diff] [blame] | 56 | int TargetBitrateKbps() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 57 | return static_cast<int>(FLAG_target_bitrate); |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 58 | } |
| 59 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 60 | DEFINE_int(max_bitrate, 800, "Call and stream max bitrate in kbps."); |
ivica | 5d6a06c | 2015-09-17 05:30:24 -0700 | [diff] [blame] | 61 | int MaxBitrateKbps() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 62 | return static_cast<int>(FLAG_max_bitrate); |
ivica | 5d6a06c | 2015-09-17 05:30:24 -0700 | [diff] [blame] | 63 | } |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 64 | |
mflodman | 48a4beb | 2016-07-01 13:03:59 +0200 | [diff] [blame] | 65 | DEFINE_bool(suspend_below_min_bitrate, |
| 66 | false, |
| 67 | "Suspends video below the configured min bitrate."); |
| 68 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 69 | DEFINE_int(num_temporal_layers, |
| 70 | 1, |
| 71 | "Number of temporal layers. Set to 1-4 to override."); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 72 | int NumTemporalLayers() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 73 | return static_cast<int>(FLAG_num_temporal_layers); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 74 | } |
| 75 | |
Sergey Silkin | 5702736 | 2018-05-15 09:12:05 +0200 | [diff] [blame] | 76 | DEFINE_int(inter_layer_pred, |
Sergey Silkin | df736d8 | 2018-05-23 23:22:46 +0200 | [diff] [blame] | 77 | 2, |
Sergey Silkin | 5702736 | 2018-05-15 09:12:05 +0200 | [diff] [blame] | 78 | "Inter-layer prediction mode. " |
| 79 | "0 - enabled, 1 - disabled, 2 - enabled only for key pictures."); |
| 80 | InterLayerPredMode InterLayerPred() { |
| 81 | if (FLAG_inter_layer_pred == 0) { |
| 82 | return InterLayerPredMode::kOn; |
| 83 | } else if (FLAG_inter_layer_pred == 1) { |
| 84 | return InterLayerPredMode::kOff; |
| 85 | } else { |
| 86 | RTC_DCHECK_EQ(FLAG_inter_layer_pred, 2); |
| 87 | return InterLayerPredMode::kOnKeyPic; |
| 88 | } |
| 89 | } |
| 90 | |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 91 | // Flags common with screenshare loopback, with equal default values. |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 92 | DEFINE_string(codec, "VP8", "Video codec to use."); |
| 93 | std::string Codec() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 94 | return static_cast<std::string>(FLAG_codec); |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 95 | } |
| 96 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 97 | DEFINE_int(selected_tl, |
| 98 | -1, |
| 99 | "Temporal layer to show or analyze. -1 to disable filtering."); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 100 | int SelectedTL() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 101 | return static_cast<int>(FLAG_selected_tl); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 102 | } |
| 103 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 104 | DEFINE_int( |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 105 | duration, |
| 106 | 0, |
| 107 | "Duration of the test in seconds. If 0, rendered will be shown instead."); |
| 108 | int DurationSecs() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 109 | return static_cast<int>(FLAG_duration); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | DEFINE_string(output_filename, "", "Target graph data filename."); |
| 113 | std::string OutputFilename() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 114 | return static_cast<std::string>(FLAG_output_filename); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | DEFINE_string(graph_title, |
| 118 | "", |
| 119 | "If empty, title will be generated automatically."); |
| 120 | std::string GraphTitle() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 121 | return static_cast<std::string>(FLAG_graph_title); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 122 | } |
| 123 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 124 | DEFINE_int(loss_percent, 0, "Percentage of packets randomly lost."); |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 125 | int LossPercent() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 126 | return static_cast<int>(FLAG_loss_percent); |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 127 | } |
| 128 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 129 | DEFINE_int(avg_burst_loss_length, -1, "Average burst length of lost packets."); |
philipel | 536378b | 2016-05-31 03:20:23 -0700 | [diff] [blame] | 130 | int AvgBurstLossLength() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 131 | return static_cast<int>(FLAG_avg_burst_loss_length); |
philipel | 536378b | 2016-05-31 03:20:23 -0700 | [diff] [blame] | 132 | } |
| 133 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 134 | DEFINE_int(link_capacity, |
| 135 | 0, |
| 136 | "Capacity (kbps) of the fake link. 0 means infinite."); |
ivica | 5d6a06c | 2015-09-17 05:30:24 -0700 | [diff] [blame] | 137 | int LinkCapacityKbps() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 138 | return static_cast<int>(FLAG_link_capacity); |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 139 | } |
| 140 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 141 | DEFINE_int(queue_size, 0, "Size of the bottleneck link queue in packets."); |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 142 | int QueueSize() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 143 | return static_cast<int>(FLAG_queue_size); |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 144 | } |
| 145 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 146 | DEFINE_int(avg_propagation_delay_ms, |
| 147 | 0, |
| 148 | "Average link propagation delay in ms."); |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 149 | int AvgPropagationDelayMs() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 150 | return static_cast<int>(FLAG_avg_propagation_delay_ms); |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 151 | } |
| 152 | |
Ilya Nikolaevskiy | a4259f6 | 2017-12-05 13:19:45 +0100 | [diff] [blame] | 153 | DEFINE_string(rtc_event_log_name, |
| 154 | "", |
| 155 | "Filename for rtc event log. Two files " |
| 156 | "with \"_send\" and \"_recv\" suffixes will be created."); |
ilnik | 9843695 | 2017-07-13 00:47:03 -0700 | [diff] [blame] | 157 | std::string RtcEventLogName() { |
| 158 | return static_cast<std::string>(FLAG_rtc_event_log_name); |
| 159 | } |
| 160 | |
| 161 | DEFINE_string(rtp_dump_name, "", "Filename for dumped received RTP stream."); |
| 162 | std::string RtpDumpName() { |
| 163 | return static_cast<std::string>(FLAG_rtp_dump_name); |
| 164 | } |
| 165 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 166 | DEFINE_int(std_propagation_delay_ms, |
| 167 | 0, |
| 168 | "Link propagation delay standard deviation in ms."); |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 169 | int StdPropagationDelayMs() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 170 | return static_cast<int>(FLAG_std_propagation_delay_ms); |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 171 | } |
| 172 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 173 | DEFINE_int(num_streams, 0, "Number of streams to show or analyze."); |
| 174 | int NumStreams() { |
| 175 | return static_cast<int>(FLAG_num_streams); |
| 176 | } |
| 177 | |
| 178 | DEFINE_int(selected_stream, |
| 179 | 0, |
| 180 | "ID of the stream to show or analyze. " |
| 181 | "Set to the number of streams to show them all."); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 182 | int SelectedStream() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 183 | return static_cast<int>(FLAG_selected_stream); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 184 | } |
| 185 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 186 | DEFINE_int(num_spatial_layers, 1, "Number of spatial layers to use."); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 187 | int NumSpatialLayers() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 188 | return static_cast<int>(FLAG_num_spatial_layers); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 189 | } |
| 190 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 191 | DEFINE_int(selected_sl, |
| 192 | -1, |
| 193 | "Spatial layer to show or analyze. -1 to disable filtering."); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 194 | int SelectedSL() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 195 | return static_cast<int>(FLAG_selected_sl); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 196 | } |
| 197 | |
| 198 | DEFINE_string(stream0, |
| 199 | "", |
| 200 | "Comma separated values describing VideoStream for stream #0."); |
| 201 | std::string Stream0() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 202 | return static_cast<std::string>(FLAG_stream0); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | DEFINE_string(stream1, |
| 206 | "", |
| 207 | "Comma separated values describing VideoStream for stream #1."); |
| 208 | std::string Stream1() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 209 | return static_cast<std::string>(FLAG_stream1); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | DEFINE_string(sl0, |
| 213 | "", |
| 214 | "Comma separated values describing SpatialLayer for layer #0."); |
| 215 | std::string SL0() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 216 | return static_cast<std::string>(FLAG_sl0); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | DEFINE_string(sl1, |
| 220 | "", |
| 221 | "Comma separated values describing SpatialLayer for layer #1."); |
| 222 | std::string SL1() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 223 | return static_cast<std::string>(FLAG_sl1); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 224 | } |
| 225 | |
palmkvist | e75f204 | 2016-09-28 06:19:48 -0700 | [diff] [blame] | 226 | DEFINE_string(encoded_frame_path, |
| 227 | "", |
| 228 | "The base path for encoded frame logs. Created files will have " |
| 229 | "the form <encoded_frame_path>.<n>.(recv|send.<m>).ivf"); |
| 230 | std::string EncodedFramePath() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 231 | return static_cast<std::string>(FLAG_encoded_frame_path); |
palmkvist | e75f204 | 2016-09-28 06:19:48 -0700 | [diff] [blame] | 232 | } |
| 233 | |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 234 | DEFINE_bool(logs, false, "print logs to stderr"); |
| 235 | |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 236 | DEFINE_bool(send_side_bwe, true, "Use send-side bandwidth estimation"); |
| 237 | |
philipel | 569397f | 2018-09-26 12:25:31 +0200 | [diff] [blame^] | 238 | DEFINE_bool(generic_descriptor, false, "Use the generic frame descriptor."); |
| 239 | |
philipel | a2c5523 | 2016-01-26 08:41:53 -0800 | [diff] [blame] | 240 | DEFINE_bool(allow_reordering, false, "Allow packet reordering to occur"); |
| 241 | |
brandtr | a62f582 | 2016-11-17 00:21:13 -0800 | [diff] [blame] | 242 | DEFINE_bool(use_ulpfec, false, "Use RED+ULPFEC forward error correction."); |
| 243 | |
| 244 | DEFINE_bool(use_flexfec, false, "Use FlexFEC forward error correction."); |
philipel | 274c1dc | 2016-05-04 06:21:01 -0700 | [diff] [blame] | 245 | |
minyue | 7320866 | 2016-08-18 06:28:55 -0700 | [diff] [blame] | 246 | DEFINE_bool(audio, false, "Add audio stream"); |
| 247 | |
henrika | 255750b | 2018-08-27 16:13:37 +0200 | [diff] [blame] | 248 | DEFINE_bool(use_real_adm, |
| 249 | false, |
| 250 | "Use real ADM instead of fake (no effect if audio is false)"); |
| 251 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 252 | DEFINE_bool(audio_video_sync, |
| 253 | false, |
| 254 | "Sync audio and video stream (no effect if" |
| 255 | " audio is false)"); |
minyue | 7320866 | 2016-08-18 06:28:55 -0700 | [diff] [blame] | 256 | |
minyue | 4c8b942 | 2017-03-21 04:11:43 -0700 | [diff] [blame] | 257 | DEFINE_bool(audio_dtx, false, "Enable audio DTX (no effect if audio is false)"); |
| 258 | |
minyue | a27172d | 2016-11-01 05:59:29 -0700 | [diff] [blame] | 259 | DEFINE_bool(video, true, "Add video stream"); |
| 260 | |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 261 | DEFINE_string( |
| 262 | 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 \"/\""); |
pbos | 9874ee0 | 2015-06-22 04:44:26 -0700 | [diff] [blame] | 268 | |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 269 | // Video-specific flags. |
ivica | 5d6a06c | 2015-09-17 05:30:24 -0700 | [diff] [blame] | 270 | DEFINE_string(clip, |
| 271 | "", |
| 272 | "Name of the clip to show. If empty, using chroma generator."); |
| 273 | std::string Clip() { |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 274 | return static_cast<std::string>(FLAG_clip); |
ivica | 5d6a06c | 2015-09-17 05:30:24 -0700 | [diff] [blame] | 275 | } |
| 276 | |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 277 | DEFINE_bool(help, false, "prints this message"); |
| 278 | |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 279 | } // namespace flags |
| 280 | |
| 281 | void Loopback() { |
Artem Titov | f18b352 | 2018-08-28 16:54:24 +0200 | [diff] [blame] | 282 | DefaultNetworkSimulationConfig pipe_config; |
ivica | 5d6a06c | 2015-09-17 05:30:24 -0700 | [diff] [blame] | 283 | pipe_config.loss_percent = flags::LossPercent(); |
philipel | 536378b | 2016-05-31 03:20:23 -0700 | [diff] [blame] | 284 | pipe_config.avg_burst_loss_length = flags::AvgBurstLossLength(); |
ivica | 5d6a06c | 2015-09-17 05:30:24 -0700 | [diff] [blame] | 285 | pipe_config.link_capacity_kbps = flags::LinkCapacityKbps(); |
| 286 | pipe_config.queue_length_packets = flags::QueueSize(); |
| 287 | pipe_config.queue_delay_ms = flags::AvgPropagationDelayMs(); |
| 288 | pipe_config.delay_standard_deviation_ms = flags::StdPropagationDelayMs(); |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 289 | pipe_config.allow_reordering = flags::FLAG_allow_reordering; |
ivica | 5d6a06c | 2015-09-17 05:30:24 -0700 | [diff] [blame] | 290 | |
Sebastian Jansson | fc8d26b | 2018-02-21 09:52:06 +0100 | [diff] [blame] | 291 | BitrateConstraints call_bitrate_config; |
ivica | 5d6a06c | 2015-09-17 05:30:24 -0700 | [diff] [blame] | 292 | call_bitrate_config.min_bitrate_bps = flags::MinBitrateKbps() * 1000; |
| 293 | call_bitrate_config.start_bitrate_bps = flags::StartBitrateKbps() * 1000; |
Erik Språng | 28bb391 | 2018-07-11 16:06:55 +0200 | [diff] [blame] | 294 | call_bitrate_config.max_bitrate_bps = -1; // Don't cap bandwidth estimate. |
ivica | 5d6a06c | 2015-09-17 05:30:24 -0700 | [diff] [blame] | 295 | |
minyue | 7320866 | 2016-08-18 06:28:55 -0700 | [diff] [blame] | 296 | VideoQualityTest::Params params; |
philipel | 569397f | 2018-09-26 12:25:31 +0200 | [diff] [blame^] | 297 | params.call = {flags::FLAG_send_side_bwe, flags::FLAG_generic_descriptor, |
| 298 | call_bitrate_config, 0}; |
Ilya Nikolaevskiy | 255d1cd | 2017-12-21 18:02:59 +0100 | [diff] [blame] | 299 | params.video[0] = {flags::FLAG_video, |
| 300 | flags::Width(), |
| 301 | flags::Height(), |
| 302 | flags::Fps(), |
| 303 | flags::MinBitrateKbps() * 1000, |
| 304 | flags::TargetBitrateKbps() * 1000, |
| 305 | flags::MaxBitrateKbps() * 1000, |
| 306 | flags::FLAG_suspend_below_min_bitrate, |
| 307 | flags::Codec(), |
| 308 | flags::NumTemporalLayers(), |
| 309 | flags::SelectedTL(), |
| 310 | 0, // No min transmit bitrate. |
| 311 | flags::FLAG_use_ulpfec, |
| 312 | flags::FLAG_use_flexfec, |
Niels Möller | 6aa415e | 2018-06-07 11:14:13 +0200 | [diff] [blame] | 313 | false, |
Ilya Nikolaevskiy | 255d1cd | 2017-12-21 18:02:59 +0100 | [diff] [blame] | 314 | flags::Clip(), |
| 315 | flags::GetCaptureDevice()}; |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 316 | params.audio = {flags::FLAG_audio, flags::FLAG_audio_video_sync, |
henrika | 255750b | 2018-08-27 16:13:37 +0200 | [diff] [blame] | 317 | flags::FLAG_audio_dtx, flags::FLAG_use_real_adm}; |
Mirko Bonadei | 45a4c41 | 2018-07-31 15:07:28 +0200 | [diff] [blame] | 318 | params.logging = {flags::FLAG_rtc_event_log_name, flags::FLAG_rtp_dump_name, |
| 319 | flags::FLAG_encoded_frame_path}; |
Ilya Nikolaevskiy | 255d1cd | 2017-12-21 18:02:59 +0100 | [diff] [blame] | 320 | params.screenshare[0].enabled = false; |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 321 | params.analyzer = {"video", |
| 322 | 0.0, |
| 323 | 0.0, |
| 324 | flags::DurationSecs(), |
| 325 | flags::OutputFilename(), |
| 326 | flags::GraphTitle()}; |
Artem Titov | f18b352 | 2018-08-28 16:54:24 +0200 | [diff] [blame] | 327 | params.config = pipe_config; |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 328 | |
| 329 | if (flags::NumStreams() > 1 && flags::Stream0().empty() && |
| 330 | flags::Stream1().empty()) { |
Ilya Nikolaevskiy | 255d1cd | 2017-12-21 18:02:59 +0100 | [diff] [blame] | 331 | params.ss[0].infer_streams = true; |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 332 | } |
ivica | 5d6a06c | 2015-09-17 05:30:24 -0700 | [diff] [blame] | 333 | |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 334 | std::vector<std::string> stream_descriptors; |
| 335 | stream_descriptors.push_back(flags::Stream0()); |
| 336 | stream_descriptors.push_back(flags::Stream1()); |
| 337 | std::vector<std::string> SL_descriptors; |
| 338 | SL_descriptors.push_back(flags::SL0()); |
| 339 | SL_descriptors.push_back(flags::SL1()); |
| 340 | VideoQualityTest::FillScalabilitySettings( |
Ilya Nikolaevskiy | 255d1cd | 2017-12-21 18:02:59 +0100 | [diff] [blame] | 341 | ¶ms, 0, stream_descriptors, flags::NumStreams(), |
| 342 | flags::SelectedStream(), flags::NumSpatialLayers(), flags::SelectedSL(), |
Sergey Silkin | 5702736 | 2018-05-15 09:12:05 +0200 | [diff] [blame] | 343 | flags::InterLayerPred(), SL_descriptors); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 344 | |
Karl Wiberg | 918f50c | 2018-07-05 11:40:33 +0200 | [diff] [blame] | 345 | auto fixture = absl::make_unique<VideoQualityTest>(nullptr); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 346 | if (flags::DurationSecs()) { |
Patrik Höglund | b6b29e0 | 2018-06-21 16:58:01 +0200 | [diff] [blame] | 347 | fixture->RunWithAnalyzer(params); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 348 | } else { |
Patrik Höglund | b6b29e0 | 2018-06-21 16:58:01 +0200 | [diff] [blame] | 349 | fixture->RunWithRenderers(params); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 350 | } |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 351 | } |
| 352 | } // namespace webrtc |
| 353 | |
| 354 | int main(int argc, char* argv[]) { |
| 355 | ::testing::InitGoogleTest(&argc, argv); |
sprang | 1168fd4 | 2017-06-21 09:00:17 -0700 | [diff] [blame] | 356 | rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true); |
| 357 | if (webrtc::flags::FLAG_help) { |
| 358 | rtc::FlagList::Print(nullptr, false); |
| 359 | return 0; |
| 360 | } |
| 361 | |
Mirko Bonadei | 45a4c41 | 2018-07-31 15:07:28 +0200 | [diff] [blame] | 362 | rtc::LogMessage::SetLogToStderr(webrtc::flags::FLAG_logs); |
| 363 | |
Bjorn Terelius | edab301 | 2018-01-31 17:23:40 +0100 | [diff] [blame] | 364 | webrtc::test::ValidateFieldTrialsStringOrDie( |
| 365 | webrtc::flags::FLAG_force_fieldtrials); |
| 366 | // InitFieldTrialsFromString stores the char*, so the char array must outlive |
| 367 | // the application. |
| 368 | webrtc::field_trial::InitFieldTrialsFromString( |
| 369 | webrtc::flags::FLAG_force_fieldtrials); |
sprang | 89c4a7e | 2017-06-30 13:27:40 -0700 | [diff] [blame] | 370 | |
sprang@webrtc.org | 131bea8 | 2015-02-18 12:46:06 +0000 | [diff] [blame] | 371 | webrtc::test::RunTest(webrtc::Loopback); |
| 372 | return 0; |
| 373 | } |