Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: webrtc/video/screenshare_loopback.cc

Issue 1412233003: Support simulcast and spatial layers in VideoQualityTest (PERF NOTE) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase + suppress log spamming Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/video/full_stack.cc ('k') | webrtc/video/video_loopback.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <stdio.h> 11 #include <stdio.h>
12 12
13 #include "gflags/gflags.h" 13 #include "gflags/gflags.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 #include "webrtc/test/field_trial.h" 16 #include "webrtc/test/field_trial.h"
17 #include "webrtc/test/run_test.h" 17 #include "webrtc/test/run_test.h"
18 #include "webrtc/video/video_quality_test.h" 18 #include "webrtc/video/video_quality_test.h"
19 19
20 namespace webrtc { 20 namespace webrtc {
21 namespace flags { 21 namespace flags {
22 22
23 // Flags common with video loopback, with different default values.
23 DEFINE_int32(width, 1850, "Video width (crops source)."); 24 DEFINE_int32(width, 1850, "Video width (crops source).");
24 size_t Width() { 25 size_t Width() {
25 return static_cast<size_t>(FLAGS_width); 26 return static_cast<size_t>(FLAGS_width);
26 } 27 }
27 28
28 DEFINE_int32(height, 1110, "Video height (crops source)."); 29 DEFINE_int32(height, 1110, "Video height (crops source).");
29 size_t Height() { 30 size_t Height() {
30 return static_cast<size_t>(FLAGS_height); 31 return static_cast<size_t>(FLAGS_height);
31 } 32 }
32 33
33 DEFINE_int32(fps, 5, "Frames per second."); 34 DEFINE_int32(fps, 5, "Frames per second.");
34 int Fps() { 35 int Fps() {
35 return static_cast<int>(FLAGS_fps); 36 return static_cast<int>(FLAGS_fps);
36 } 37 }
37 38
38 DEFINE_int32(slide_change_interval,
39 10,
40 "Interval (in seconds) between simulated slide changes.");
41 int SlideChangeInterval() {
42 return static_cast<int>(FLAGS_slide_change_interval);
43 }
44
45 DEFINE_int32(
46 scroll_duration,
47 0,
48 "Duration (in seconds) during which a slide will be scrolled into place.");
49 int ScrollDuration() {
50 return static_cast<int>(FLAGS_scroll_duration);
51 }
52
53 DEFINE_int32(min_bitrate, 50, "Call and stream min bitrate in kbps."); 39 DEFINE_int32(min_bitrate, 50, "Call and stream min bitrate in kbps.");
54 int MinBitrateKbps() { 40 int MinBitrateKbps() {
55 return static_cast<int>(FLAGS_min_bitrate); 41 return static_cast<int>(FLAGS_min_bitrate);
56 } 42 }
57 43
58 DEFINE_int32(start_bitrate, 200, "Call start bitrate in kbps."); 44 DEFINE_int32(start_bitrate, 200, "Call start bitrate in kbps.");
59 int StartBitrateKbps() { 45 int StartBitrateKbps() {
60 return static_cast<int>(FLAGS_start_bitrate); 46 return static_cast<int>(FLAGS_start_bitrate);
61 } 47 }
62 48
63 DEFINE_int32(target_bitrate, 2000, "Stream target bitrate in kbps."); 49 DEFINE_int32(target_bitrate, 2000, "Stream target bitrate in kbps.");
64 int TargetBitrateKbps() { 50 int TargetBitrateKbps() {
65 return static_cast<int>(FLAGS_target_bitrate); 51 return static_cast<int>(FLAGS_target_bitrate);
66 } 52 }
67 53
68 DEFINE_int32(max_bitrate, 2000, "Call and stream max bitrate in kbps."); 54 DEFINE_int32(max_bitrate, 2000, "Call and stream max bitrate in kbps.");
69 int MaxBitrateKbps() { 55 int MaxBitrateKbps() {
70 return static_cast<int>(FLAGS_max_bitrate); 56 return static_cast<int>(FLAGS_max_bitrate);
71 } 57 }
72 58
73 DEFINE_int32(num_temporal_layers, 2, "Number of temporal layers to use."); 59 DEFINE_int32(num_temporal_layers, 2, "Number of temporal layers to use.");
74 size_t NumTemporalLayers() { 60 int NumTemporalLayers() {
75 return static_cast<size_t>(FLAGS_num_temporal_layers); 61 return static_cast<int>(FLAGS_num_temporal_layers);
76 } 62 }
77 63
78 DEFINE_int32( 64 // Flags common with video loopback, with equal default values.
79 tl_discard_threshold,
80 0,
81 "Discard TLs with id greater or equal the threshold. 0 to disable.");
82 size_t TLDiscardThreshold() {
83 return static_cast<size_t>(FLAGS_tl_discard_threshold);
84 }
85
86 DEFINE_int32(min_transmit_bitrate, 400, "Min transmit bitrate incl. padding.");
87 int MinTransmitBitrateKbps() {
88 return FLAGS_min_transmit_bitrate;
89 }
90
91 DEFINE_string(codec, "VP8", "Video codec to use."); 65 DEFINE_string(codec, "VP8", "Video codec to use.");
92 std::string Codec() { 66 std::string Codec() {
93 return static_cast<std::string>(FLAGS_codec); 67 return static_cast<std::string>(FLAGS_codec);
94 } 68 }
95 69
70 DEFINE_int32(selected_tl,
71 -1,
72 "Temporal layer to show or analyze. -1 to disable filtering.");
73 int SelectedTL() {
74 return static_cast<int>(FLAGS_selected_tl);
75 }
76
77 DEFINE_int32(
78 duration,
79 0,
80 "Duration of the test in seconds. If 0, rendered will be shown instead.");
81 int DurationSecs() {
82 return static_cast<int>(FLAGS_duration);
83 }
84
85 DEFINE_string(output_filename, "", "Target graph data filename.");
86 std::string OutputFilename() {
87 return static_cast<std::string>(FLAGS_output_filename);
88 }
89
90 DEFINE_string(graph_title,
91 "",
92 "If empty, title will be generated automatically.");
93 std::string GraphTitle() {
94 return static_cast<std::string>(FLAGS_graph_title);
95 }
96
96 DEFINE_int32(loss_percent, 0, "Percentage of packets randomly lost."); 97 DEFINE_int32(loss_percent, 0, "Percentage of packets randomly lost.");
97 int LossPercent() { 98 int LossPercent() {
98 return static_cast<int>(FLAGS_loss_percent); 99 return static_cast<int>(FLAGS_loss_percent);
99 } 100 }
100 101
101 DEFINE_int32(link_capacity, 102 DEFINE_int32(link_capacity,
102 0, 103 0,
103 "Capacity (kbps) of the fake link. 0 means infinite."); 104 "Capacity (kbps) of the fake link. 0 means infinite.");
104 int LinkCapacityKbps() { 105 int LinkCapacityKbps() {
105 return static_cast<int>(FLAGS_link_capacity); 106 return static_cast<int>(FLAGS_link_capacity);
(...skipping 11 matching lines...) Expand all
117 return static_cast<int>(FLAGS_avg_propagation_delay_ms); 118 return static_cast<int>(FLAGS_avg_propagation_delay_ms);
118 } 119 }
119 120
120 DEFINE_int32(std_propagation_delay_ms, 121 DEFINE_int32(std_propagation_delay_ms,
121 0, 122 0,
122 "Link propagation delay standard deviation in ms."); 123 "Link propagation delay standard deviation in ms.");
123 int StdPropagationDelayMs() { 124 int StdPropagationDelayMs() {
124 return static_cast<int>(FLAGS_std_propagation_delay_ms); 125 return static_cast<int>(FLAGS_std_propagation_delay_ms);
125 } 126 }
126 127
128 DEFINE_int32(selected_stream, 0, "ID of the stream to show or analyze.");
129 int SelectedStream() {
130 return static_cast<int>(FLAGS_selected_stream);
131 }
132
133 DEFINE_int32(num_spatial_layers, 1, "Number of spatial layers to use.");
134 int NumSpatialLayers() {
135 return static_cast<int>(FLAGS_num_spatial_layers);
136 }
137
138 DEFINE_int32(selected_sl,
139 -1,
140 "Spatial layer to show or analyze. -1 to disable filtering.");
141 int SelectedSL() {
142 return static_cast<int>(FLAGS_selected_sl);
143 }
144
145 DEFINE_string(stream0,
146 "",
147 "Comma separated values describing VideoStream for stream #0.");
148 std::string Stream0() {
149 return static_cast<std::string>(FLAGS_stream0);
150 }
151
152 DEFINE_string(stream1,
153 "",
154 "Comma separated values describing VideoStream for stream #1.");
155 std::string Stream1() {
156 return static_cast<std::string>(FLAGS_stream1);
157 }
158
159 DEFINE_string(sl0,
160 "",
161 "Comma separated values describing SpatialLayer for layer #0.");
162 std::string SL0() {
163 return static_cast<std::string>(FLAGS_sl0);
164 }
165
166 DEFINE_string(sl1,
167 "",
168 "Comma separated values describing SpatialLayer for layer #1.");
169 std::string SL1() {
170 return static_cast<std::string>(FLAGS_sl1);
171 }
172
127 DEFINE_bool(logs, false, "print logs to stderr"); 173 DEFINE_bool(logs, false, "print logs to stderr");
128 174
129 DEFINE_string(
130 output_filename,
131 "",
132 "Name of a target graph data file. If set, no preview will be shown.");
133 std::string OutputFilename() {
134 return static_cast<std::string>(FLAGS_output_filename);
135 }
136
137 DEFINE_int32(duration, 60, "Duration of the test in seconds.");
138 int DurationSecs() {
139 return static_cast<int>(FLAGS_duration);
140 }
141
142 DEFINE_bool(send_side_bwe, true, "Use send-side bandwidth estimation"); 175 DEFINE_bool(send_side_bwe, true, "Use send-side bandwidth estimation");
143 176
144 DEFINE_string( 177 DEFINE_string(
145 force_fieldtrials, 178 force_fieldtrials,
146 "", 179 "",
147 "Field trials control experimental feature code which can be forced. " 180 "Field trials control experimental feature code which can be forced. "
148 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" 181 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/"
149 " will assign the group Enable to field trial WebRTC-FooFeature. Multiple " 182 " will assign the group Enable to field trial WebRTC-FooFeature. Multiple "
150 "trials are separated by \"/\""); 183 "trials are separated by \"/\"");
184
185 // Screenshare-specific flags.
186 DEFINE_int32(min_transmit_bitrate, 400, "Min transmit bitrate incl. padding.");
187 int MinTransmitBitrateKbps() {
188 return FLAGS_min_transmit_bitrate;
189 }
190
191 DEFINE_int32(slide_change_interval,
192 10,
193 "Interval (in seconds) between simulated slide changes.");
194 int SlideChangeInterval() {
195 return static_cast<int>(FLAGS_slide_change_interval);
196 }
197
198 DEFINE_int32(
199 scroll_duration,
200 0,
201 "Duration (in seconds) during which a slide will be scrolled into place.");
202 int ScrollDuration() {
203 return static_cast<int>(FLAGS_scroll_duration);
204 }
205
151 } // namespace flags 206 } // namespace flags
152 207
153 void Loopback() { 208 void Loopback() {
154 FakeNetworkPipe::Config pipe_config; 209 FakeNetworkPipe::Config pipe_config;
155 pipe_config.loss_percent = flags::LossPercent(); 210 pipe_config.loss_percent = flags::LossPercent();
156 pipe_config.link_capacity_kbps = flags::LinkCapacityKbps(); 211 pipe_config.link_capacity_kbps = flags::LinkCapacityKbps();
157 pipe_config.queue_length_packets = flags::QueueSize(); 212 pipe_config.queue_length_packets = flags::QueueSize();
158 pipe_config.queue_delay_ms = flags::AvgPropagationDelayMs(); 213 pipe_config.queue_delay_ms = flags::AvgPropagationDelayMs();
159 pipe_config.delay_standard_deviation_ms = flags::StdPropagationDelayMs(); 214 pipe_config.delay_standard_deviation_ms = flags::StdPropagationDelayMs();
160 215
161 Call::Config::BitrateConfig call_bitrate_config; 216 Call::Config::BitrateConfig call_bitrate_config;
162 call_bitrate_config.min_bitrate_bps = flags::MinBitrateKbps() * 1000; 217 call_bitrate_config.min_bitrate_bps = flags::MinBitrateKbps() * 1000;
163 call_bitrate_config.start_bitrate_bps = flags::StartBitrateKbps() * 1000; 218 call_bitrate_config.start_bitrate_bps = flags::StartBitrateKbps() * 1000;
164 call_bitrate_config.max_bitrate_bps = flags::MaxBitrateKbps() * 1000; 219 call_bitrate_config.max_bitrate_bps = flags::MaxBitrateKbps() * 1000;
165 220
166 VideoQualityTest::Params params{ 221 VideoQualityTest::Params params{
167 {flags::Width(), flags::Height(), flags::Fps(), 222 {flags::Width(), flags::Height(), flags::Fps(),
168 flags::MinBitrateKbps() * 1000, flags::TargetBitrateKbps() * 1000, 223 flags::MinBitrateKbps() * 1000, flags::TargetBitrateKbps() * 1000,
169 flags::MaxBitrateKbps() * 1000, flags::Codec(), 224 flags::MaxBitrateKbps() * 1000, flags::Codec(),
170 flags::NumTemporalLayers(), flags::MinTransmitBitrateKbps() * 1000, 225 flags::NumTemporalLayers(), flags::SelectedTL(),
171 call_bitrate_config, flags::TLDiscardThreshold(), 226 flags::MinTransmitBitrateKbps() * 1000, call_bitrate_config,
172 flags::FLAGS_send_side_bwe}, 227 flags::FLAGS_send_side_bwe},
173 {}, // Video specific. 228 {}, // Video specific.
174 {true, flags::SlideChangeInterval(), flags::ScrollDuration()}, 229 {true, flags::SlideChangeInterval(), flags::ScrollDuration()},
175 {"screenshare", 0.0, 0.0, flags::DurationSecs(), flags::OutputFilename()}, 230 {"screenshare", 0.0, 0.0, flags::DurationSecs(), flags::OutputFilename(),
231 flags::GraphTitle()},
176 pipe_config, 232 pipe_config,
177 flags::FLAGS_logs}; 233 flags::FLAGS_logs};
178 234
235 std::vector<std::string> stream_descriptors;
236 stream_descriptors.push_back(flags::Stream0());
237 stream_descriptors.push_back(flags::Stream1());
238 std::vector<std::string> SL_descriptors;
239 SL_descriptors.push_back(flags::SL0());
240 SL_descriptors.push_back(flags::SL1());
241 VideoQualityTest::FillScalabilitySettings(
242 &params, stream_descriptors, flags::SelectedStream(),
243 flags::NumSpatialLayers(), flags::SelectedSL(), SL_descriptors);
244
179 VideoQualityTest test; 245 VideoQualityTest test;
180 if (flags::OutputFilename().empty()) 246 if (flags::DurationSecs()) {
247 test.RunWithAnalyzer(params);
248 } else {
181 test.RunWithVideoRenderer(params); 249 test.RunWithVideoRenderer(params);
182 else 250 }
183 test.RunWithAnalyzer(params);
184 } 251 }
185 } // namespace webrtc 252 } // namespace webrtc
186 253
187 int main(int argc, char* argv[]) { 254 int main(int argc, char* argv[]) {
188 ::testing::InitGoogleTest(&argc, argv); 255 ::testing::InitGoogleTest(&argc, argv);
189 google::ParseCommandLineFlags(&argc, &argv, true); 256 google::ParseCommandLineFlags(&argc, &argv, true);
190 webrtc::test::InitFieldTrialsFromString( 257 webrtc::test::InitFieldTrialsFromString(
191 webrtc::flags::FLAGS_force_fieldtrials); 258 webrtc::flags::FLAGS_force_fieldtrials);
192 webrtc::test::RunTest(webrtc::Loopback); 259 webrtc::test::RunTest(webrtc::Loopback);
193 return 0; 260 return 0;
194 } 261 }
OLDNEW
« no previous file with comments | « webrtc/video/full_stack.cc ('k') | webrtc/video/video_loopback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698