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

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

Powered by Google App Engine
This is Rietveld 408576698