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

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

Issue 1353263005: Adding support for simulcast and spatial layers into VideoQualityTest (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressing comments + other small changes Created 5 years, 2 months 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
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 size_t NumTemporalLayers() {
75 return static_cast<size_t>(FLAGS_num_temporal_layers); 61 return static_cast<size_t>(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 AUTO_GRAPH_TITLE,
92 "If default value used, 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 size_t SelectedStream() {
130 return static_cast<size_t>(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(
160 sl0, "", "Comma separated values describing SpatialLayer for layer #0.");
161 std::string SL0() {
162 return static_cast<std::string>(FLAGS_sl0);
163 }
164
165 DEFINE_string(
166 sl1, "", "Comma separated values describing SpatialLayer for layer #1.");
167 std::string SL1() {
168 return static_cast<std::string>(FLAGS_sl1);
169 }
170
127 DEFINE_bool(logs, false, "print logs to stderr"); 171 DEFINE_bool(logs, false, "print logs to stderr");
128 172
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"); 173 DEFINE_bool(send_side_bwe, true, "Use send-side bandwidth estimation");
143 174
144 DEFINE_string( 175 DEFINE_string(
145 force_fieldtrials, 176 force_fieldtrials,
146 "", 177 "",
147 "Field trials control experimental feature code which can be forced. " 178 "Field trials control experimental feature code which can be forced. "
148 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" 179 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/"
149 " will assign the group Enable to field trial WebRTC-FooFeature. Multiple " 180 " will assign the group Enable to field trial WebRTC-FooFeature. Multiple "
150 "trials are separated by \"/\""); 181 "trials are separated by \"/\"");
182
183 // Screenshare-specific flags.
184 DEFINE_int32(min_transmit_bitrate, 400, "Min transmit bitrate incl. padding.");
185 int MinTransmitBitrateKbps() {
186 return FLAGS_min_transmit_bitrate;
187 }
188
189 DEFINE_int32(slide_change_interval,
190 10,
191 "Interval (in seconds) between simulated slide changes.");
192 int SlideChangeInterval() {
193 return static_cast<int>(FLAGS_slide_change_interval);
194 }
195
196 DEFINE_int32(
197 scroll_duration,
198 0,
199 "Duration (in seconds) during which a slide will be scrolled into place.");
200 int ScrollDuration() {
201 return static_cast<int>(FLAGS_scroll_duration);
202 }
203
151 } // namespace flags 204 } // namespace flags
152 205
153 void Loopback() { 206 void Loopback() {
154 FakeNetworkPipe::Config pipe_config; 207 FakeNetworkPipe::Config pipe_config;
155 pipe_config.loss_percent = flags::LossPercent(); 208 pipe_config.loss_percent = flags::LossPercent();
156 pipe_config.link_capacity_kbps = flags::LinkCapacityKbps(); 209 pipe_config.link_capacity_kbps = flags::LinkCapacityKbps();
157 pipe_config.queue_length_packets = flags::QueueSize(); 210 pipe_config.queue_length_packets = flags::QueueSize();
158 pipe_config.queue_delay_ms = flags::AvgPropagationDelayMs(); 211 pipe_config.queue_delay_ms = flags::AvgPropagationDelayMs();
159 pipe_config.delay_standard_deviation_ms = flags::StdPropagationDelayMs(); 212 pipe_config.delay_standard_deviation_ms = flags::StdPropagationDelayMs();
160 213
161 Call::Config::BitrateConfig call_bitrate_config; 214 Call::Config::BitrateConfig call_bitrate_config;
162 call_bitrate_config.min_bitrate_bps = flags::MinBitrateKbps() * 1000; 215 call_bitrate_config.min_bitrate_bps = flags::MinBitrateKbps() * 1000;
163 call_bitrate_config.start_bitrate_bps = flags::StartBitrateKbps() * 1000; 216 call_bitrate_config.start_bitrate_bps = flags::StartBitrateKbps() * 1000;
164 call_bitrate_config.max_bitrate_bps = flags::MaxBitrateKbps() * 1000; 217 call_bitrate_config.max_bitrate_bps = flags::MaxBitrateKbps() * 1000;
165 218
166 VideoQualityTest::Params params{ 219 VideoQualityTest::Params params{
167 {flags::Width(), flags::Height(), flags::Fps(), 220 {flags::Width(), flags::Height(), flags::Fps(),
168 flags::MinBitrateKbps() * 1000, flags::TargetBitrateKbps() * 1000, 221 flags::MinBitrateKbps() * 1000, flags::TargetBitrateKbps() * 1000,
169 flags::MaxBitrateKbps() * 1000, flags::Codec(), 222 flags::MaxBitrateKbps() * 1000, flags::Codec(),
170 flags::NumTemporalLayers(), flags::MinTransmitBitrateKbps() * 1000, 223 flags::NumTemporalLayers(), flags::SelectedTL(),
171 call_bitrate_config, flags::TLDiscardThreshold(), 224 flags::MinTransmitBitrateKbps() * 1000, call_bitrate_config,
172 flags::FLAGS_send_side_bwe}, 225 flags::FLAGS_send_side_bwe},
173 {}, // Video specific. 226 {}, // Video specific.
174 {true, flags::SlideChangeInterval(), flags::ScrollDuration()}, 227 {true, flags::SlideChangeInterval(), flags::ScrollDuration()},
175 {"screenshare", 0.0, 0.0, flags::DurationSecs(), flags::OutputFilename()}, 228 {"screenshare", 0.0, 0.0, flags::DurationSecs(), flags::OutputFilename(),
229 flags::GraphTitle()},
176 pipe_config, 230 pipe_config,
177 flags::FLAGS_logs}; 231 flags::FLAGS_logs};
178 232
233 VideoQualityTest::FillScalabilitySettings(
234 &params,
235 {flags::Stream0(), flags::Stream1()},
236 flags::SelectedStream(),
237 flags::NumSpatialLayers(),
238 flags::SelectedSL(),
239 {flags::SL0(), flags::SL1()});
240
179 VideoQualityTest test; 241 VideoQualityTest test;
180 if (flags::OutputFilename().empty()) 242 if (flags::DurationSecs())
243 test.RunWithAnalyzer(params);
244 else
181 test.RunWithVideoRenderer(params); 245 test.RunWithVideoRenderer(params);
182 else
183 test.RunWithAnalyzer(params);
184 } 246 }
185 } // namespace webrtc 247 } // namespace webrtc
186 248
187 int main(int argc, char* argv[]) { 249 int main(int argc, char* argv[]) {
188 ::testing::InitGoogleTest(&argc, argv); 250 ::testing::InitGoogleTest(&argc, argv);
189 google::ParseCommandLineFlags(&argc, &argv, true); 251 google::ParseCommandLineFlags(&argc, &argv, true);
190 webrtc::test::InitFieldTrialsFromString( 252 webrtc::test::InitFieldTrialsFromString(
191 webrtc::flags::FLAGS_force_fieldtrials); 253 webrtc::flags::FLAGS_force_fieldtrials);
192 webrtc::test::RunTest(webrtc::Loopback); 254 webrtc::test::RunTest(webrtc::Loopback);
193 return 0; 255 return 0;
194 } 256 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698