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

Side by Side Diff: webrtc/video/video_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/screenshare_loopback.cc ('k') | webrtc/video/video_quality_test.h » ('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 screenshare loopback, with different default values.
23 DEFINE_int32(width, 640, "Video width."); 24 DEFINE_int32(width, 640, "Video width.");
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, 480, "Video height."); 29 DEFINE_int32(height, 480, "Video height.");
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
(...skipping 15 matching lines...) Expand all
48 DEFINE_int32(target_bitrate, 800, "Stream target bitrate in kbps."); 49 DEFINE_int32(target_bitrate, 800, "Stream target bitrate in kbps.");
49 int TargetBitrateKbps() { 50 int TargetBitrateKbps() {
50 return static_cast<int>(FLAGS_target_bitrate); 51 return static_cast<int>(FLAGS_target_bitrate);
51 } 52 }
52 53
53 DEFINE_int32(max_bitrate, 800, "Call and stream max bitrate in kbps."); 54 DEFINE_int32(max_bitrate, 800, "Call and stream max bitrate in kbps.");
54 int MaxBitrateKbps() { 55 int MaxBitrateKbps() {
55 return static_cast<int>(FLAGS_max_bitrate); 56 return static_cast<int>(FLAGS_max_bitrate);
56 } 57 }
57 58
59 DEFINE_int32(num_temporal_layers,
60 1,
61 "Number of temporal layers. Set to 1-4 to override.");
62 int NumTemporalLayers() {
63 return static_cast<int>(FLAGS_num_temporal_layers);
64 }
65
66 // Flags common with screenshare loopback, with equal default values.
58 DEFINE_string(codec, "VP8", "Video codec to use."); 67 DEFINE_string(codec, "VP8", "Video codec to use.");
59 std::string Codec() { 68 std::string Codec() {
60 return static_cast<std::string>(FLAGS_codec); 69 return static_cast<std::string>(FLAGS_codec);
61 } 70 }
62 71
72 DEFINE_int32(selected_tl,
73 -1,
74 "Temporal layer to show or analyze. -1 to disable filtering.");
75 int SelectedTL() {
76 return static_cast<int>(FLAGS_selected_tl);
77 }
78
79 DEFINE_int32(
80 duration,
81 0,
82 "Duration of the test in seconds. If 0, rendered will be shown instead.");
83 int DurationSecs() {
84 return static_cast<int>(FLAGS_duration);
85 }
86
87 DEFINE_string(output_filename, "", "Target graph data filename.");
88 std::string OutputFilename() {
89 return static_cast<std::string>(FLAGS_output_filename);
90 }
91
92 DEFINE_string(graph_title,
93 "",
94 "If empty, title will be generated automatically.");
95 std::string GraphTitle() {
96 return static_cast<std::string>(FLAGS_graph_title);
97 }
98
63 DEFINE_int32(loss_percent, 0, "Percentage of packets randomly lost."); 99 DEFINE_int32(loss_percent, 0, "Percentage of packets randomly lost.");
64 int LossPercent() { 100 int LossPercent() {
65 return static_cast<int>(FLAGS_loss_percent); 101 return static_cast<int>(FLAGS_loss_percent);
66 } 102 }
67 103
68 DEFINE_int32(link_capacity, 104 DEFINE_int32(link_capacity,
69 0, 105 0,
70 "Capacity (kbps) of the fake link. 0 means infinite."); 106 "Capacity (kbps) of the fake link. 0 means infinite.");
71 int LinkCapacityKbps() { 107 int LinkCapacityKbps() {
72 return static_cast<int>(FLAGS_link_capacity); 108 return static_cast<int>(FLAGS_link_capacity);
(...skipping 11 matching lines...) Expand all
84 return static_cast<int>(FLAGS_avg_propagation_delay_ms); 120 return static_cast<int>(FLAGS_avg_propagation_delay_ms);
85 } 121 }
86 122
87 DEFINE_int32(std_propagation_delay_ms, 123 DEFINE_int32(std_propagation_delay_ms,
88 0, 124 0,
89 "Link propagation delay standard deviation in ms."); 125 "Link propagation delay standard deviation in ms.");
90 int StdPropagationDelayMs() { 126 int StdPropagationDelayMs() {
91 return static_cast<int>(FLAGS_std_propagation_delay_ms); 127 return static_cast<int>(FLAGS_std_propagation_delay_ms);
92 } 128 }
93 129
130 DEFINE_int32(selected_stream, 0, "ID of the stream to show or analyze.");
131 int SelectedStream() {
132 return static_cast<int>(FLAGS_selected_stream);
133 }
134
135 DEFINE_int32(num_spatial_layers, 1, "Number of spatial layers to use.");
136 int NumSpatialLayers() {
137 return static_cast<int>(FLAGS_num_spatial_layers);
138 }
139
140 DEFINE_int32(selected_sl,
141 -1,
142 "Spatial layer to show or analyze. -1 to disable filtering.");
143 int SelectedSL() {
144 return static_cast<int>(FLAGS_selected_sl);
145 }
146
147 DEFINE_string(stream0,
148 "",
149 "Comma separated values describing VideoStream for stream #0.");
150 std::string Stream0() {
151 return static_cast<std::string>(FLAGS_stream0);
152 }
153
154 DEFINE_string(stream1,
155 "",
156 "Comma separated values describing VideoStream for stream #1.");
157 std::string Stream1() {
158 return static_cast<std::string>(FLAGS_stream1);
159 }
160
161 DEFINE_string(sl0,
162 "",
163 "Comma separated values describing SpatialLayer for layer #0.");
164 std::string SL0() {
165 return static_cast<std::string>(FLAGS_sl0);
166 }
167
168 DEFINE_string(sl1,
169 "",
170 "Comma separated values describing SpatialLayer for layer #1.");
171 std::string SL1() {
172 return static_cast<std::string>(FLAGS_sl1);
173 }
174
94 DEFINE_bool(logs, false, "print logs to stderr"); 175 DEFINE_bool(logs, false, "print logs to stderr");
95 176
177 DEFINE_bool(send_side_bwe, true, "Use send-side bandwidth estimation");
178
96 DEFINE_string( 179 DEFINE_string(
97 force_fieldtrials, 180 force_fieldtrials,
98 "", 181 "",
99 "Field trials control experimental feature code which can be forced. " 182 "Field trials control experimental feature code which can be forced. "
100 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" 183 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/"
101 " will assign the group Enable to field trial WebRTC-FooFeature. Multiple " 184 " will assign the group Enable to field trial WebRTC-FooFeature. Multiple "
102 "trials are separated by \"/\""); 185 "trials are separated by \"/\"");
103 186
104 DEFINE_int32(num_temporal_layers, 187 // Video-specific flags.
105 1,
106 "Number of temporal layers. Set to 1-4 to override.");
107 size_t NumTemporalLayers() {
108 return static_cast<size_t>(FLAGS_num_temporal_layers);
109 }
110
111 DEFINE_int32(
112 tl_discard_threshold,
113 0,
114 "Discard TLs with id greater or equal the threshold. 0 to disable.");
115 size_t TLDiscardThreshold() {
116 return static_cast<size_t>(FLAGS_tl_discard_threshold);
117 }
118
119 DEFINE_string(clip, 188 DEFINE_string(clip,
120 "", 189 "",
121 "Name of the clip to show. If empty, using chroma generator."); 190 "Name of the clip to show. If empty, using chroma generator.");
122 std::string Clip() { 191 std::string Clip() {
123 return static_cast<std::string>(FLAGS_clip); 192 return static_cast<std::string>(FLAGS_clip);
124 } 193 }
125 194
126 DEFINE_string(
127 output_filename,
128 "",
129 "Name of a target graph data file. If set, no preview will be shown.");
130 std::string OutputFilename() {
131 return static_cast<std::string>(FLAGS_output_filename);
132 }
133
134 DEFINE_int32(duration, 60, "Duration of the test in seconds.");
135 int DurationSecs() {
136 return static_cast<int>(FLAGS_duration);
137 }
138
139 DEFINE_bool(send_side_bwe, true, "Use send-side bandwidth estimation");
140
141 } // namespace flags 195 } // namespace flags
142 196
143 void Loopback() { 197 void Loopback() {
144 FakeNetworkPipe::Config pipe_config; 198 FakeNetworkPipe::Config pipe_config;
145 pipe_config.loss_percent = flags::LossPercent(); 199 pipe_config.loss_percent = flags::LossPercent();
146 pipe_config.link_capacity_kbps = flags::LinkCapacityKbps(); 200 pipe_config.link_capacity_kbps = flags::LinkCapacityKbps();
147 pipe_config.queue_length_packets = flags::QueueSize(); 201 pipe_config.queue_length_packets = flags::QueueSize();
148 pipe_config.queue_delay_ms = flags::AvgPropagationDelayMs(); 202 pipe_config.queue_delay_ms = flags::AvgPropagationDelayMs();
149 pipe_config.delay_standard_deviation_ms = flags::StdPropagationDelayMs(); 203 pipe_config.delay_standard_deviation_ms = flags::StdPropagationDelayMs();
150 204
151 Call::Config::BitrateConfig call_bitrate_config; 205 Call::Config::BitrateConfig call_bitrate_config;
152 call_bitrate_config.min_bitrate_bps = flags::MinBitrateKbps() * 1000; 206 call_bitrate_config.min_bitrate_bps = flags::MinBitrateKbps() * 1000;
153 call_bitrate_config.start_bitrate_bps = flags::StartBitrateKbps() * 1000; 207 call_bitrate_config.start_bitrate_bps = flags::StartBitrateKbps() * 1000;
154 call_bitrate_config.max_bitrate_bps = flags::MaxBitrateKbps() * 1000; 208 call_bitrate_config.max_bitrate_bps = flags::MaxBitrateKbps() * 1000;
155 209
156 std::string clip = flags::Clip();
157 std::string graph_title = clip.empty() ? "" : "video " + clip;
158 VideoQualityTest::Params params{ 210 VideoQualityTest::Params params{
159 {flags::Width(), flags::Height(), flags::Fps(), 211 {flags::Width(), flags::Height(), flags::Fps(),
160 flags::MinBitrateKbps() * 1000, flags::TargetBitrateKbps() * 1000, 212 flags::MinBitrateKbps() * 1000, flags::TargetBitrateKbps() * 1000,
161 flags::MaxBitrateKbps() * 1000, flags::Codec(), 213 flags::MaxBitrateKbps() * 1000, flags::Codec(),
162 flags::NumTemporalLayers(), 214 flags::NumTemporalLayers(), flags::SelectedTL(),
163 0, // No min transmit bitrate. 215 0, // No min transmit bitrate.
164 call_bitrate_config, flags::TLDiscardThreshold(), 216 call_bitrate_config, flags::FLAGS_send_side_bwe},
165 flags::FLAGS_send_side_bwe}, 217 {flags::Clip()},
166 {clip},
167 {}, // Screenshare specific. 218 {}, // Screenshare specific.
168 {graph_title, 0.0, 0.0, flags::DurationSecs(), flags::OutputFilename()}, 219 {"video", 0.0, 0.0, flags::DurationSecs(), flags::OutputFilename(),
220 flags::GraphTitle()},
169 pipe_config, 221 pipe_config,
170 flags::FLAGS_logs}; 222 flags::FLAGS_logs};
171 223
224 std::vector<std::string> stream_descriptors;
225 stream_descriptors.push_back(flags::Stream0());
226 stream_descriptors.push_back(flags::Stream1());
227 std::vector<std::string> SL_descriptors;
228 SL_descriptors.push_back(flags::SL0());
229 SL_descriptors.push_back(flags::SL1());
230 VideoQualityTest::FillScalabilitySettings(
231 &params, stream_descriptors, flags::SelectedStream(),
232 flags::NumSpatialLayers(), flags::SelectedSL(), SL_descriptors);
233
172 VideoQualityTest test; 234 VideoQualityTest test;
173 if (flags::OutputFilename().empty()) 235 if (flags::DurationSecs()) {
236 test.RunWithAnalyzer(params);
237 } else {
174 test.RunWithVideoRenderer(params); 238 test.RunWithVideoRenderer(params);
175 else 239 }
176 test.RunWithAnalyzer(params);
177 } 240 }
178 } // namespace webrtc 241 } // namespace webrtc
179 242
180 int main(int argc, char* argv[]) { 243 int main(int argc, char* argv[]) {
181 ::testing::InitGoogleTest(&argc, argv); 244 ::testing::InitGoogleTest(&argc, argv);
182 google::ParseCommandLineFlags(&argc, &argv, true); 245 google::ParseCommandLineFlags(&argc, &argv, true);
183 webrtc::test::InitFieldTrialsFromString( 246 webrtc::test::InitFieldTrialsFromString(
184 webrtc::flags::FLAGS_force_fieldtrials); 247 webrtc::flags::FLAGS_force_fieldtrials);
185 webrtc::test::RunTest(webrtc::Loopback); 248 webrtc::test::RunTest(webrtc::Loopback);
186 return 0; 249 return 0;
187 } 250 }
OLDNEW
« no previous file with comments | « webrtc/video/screenshare_loopback.cc ('k') | webrtc/video/video_quality_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698