xref: /aosp_15_r20/external/webrtc/video/full_stack_tests.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2013 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 #include <memory>
11 #include <string>
12 #include <utility>
13 #include <vector>
14 
15 #include "absl/flags/flag.h"
16 #include "absl/flags/parse.h"
17 #include "absl/types/optional.h"
18 #include "api/test/simulated_network.h"
19 #include "api/test/test_dependency_factory.h"
20 #include "api/test/video_quality_test_fixture.h"
21 #include "api/video_codecs/sdp_video_format.h"
22 #include "api/video_codecs/video_codec.h"
23 #include "api/video_codecs/vp9_profile.h"
24 #include "modules/video_coding/codecs/vp9/include/vp9.h"
25 #include "system_wrappers/include/field_trial.h"
26 #include "test/field_trial.h"
27 #include "test/gtest.h"
28 #include "test/testsupport/file_utils.h"
29 #include "video/config/video_encoder_config.h"
30 #include "video/video_quality_test.h"
31 
32 ABSL_FLAG(std::string,
33           rtc_event_log_name,
34           "",
35           "Filename for rtc event log. Two files "
36           "with \"_send\" and \"_recv\" suffixes will be created.");
37 ABSL_FLAG(std::string,
38           rtp_dump_name,
39           "",
40           "Filename for dumped received RTP stream.");
41 ABSL_FLAG(std::string,
42           encoded_frame_path,
43           "",
44           "The base path for encoded frame logs. Created files will have "
45           "the form <encoded_frame_path>.<n>.(recv|send.<m>).ivf");
46 
47 namespace webrtc {
48 
49 namespace {
50 static const int kFullStackTestDurationSecs = 45;
51 
52 struct ParamsWithLogging : public VideoQualityTest::Params {
53  public:
ParamsWithLoggingwebrtc::__anon45a157310111::ParamsWithLogging54   ParamsWithLogging() {
55     // Use these logging flags by default, for everything.
56     logging = {absl::GetFlag(FLAGS_rtc_event_log_name),
57                absl::GetFlag(FLAGS_rtp_dump_name),
58                absl::GetFlag(FLAGS_encoded_frame_path)};
59     this->config = BuiltInNetworkBehaviorConfig();
60   }
61 };
62 
63 std::unique_ptr<VideoQualityTestFixtureInterface>
CreateVideoQualityTestFixture()64 CreateVideoQualityTestFixture() {
65   // The components will normally be nullptr (= use defaults), but it's possible
66   // for external test runners to override the list of injected components.
67   auto components = TestDependencyFactory::GetInstance().CreateComponents();
68   return std::make_unique<VideoQualityTest>(std::move(components));
69 }
70 
71 // Takes the current active field trials set, and appends some new trials.
AppendFieldTrials(std::string new_trial_string)72 std::string AppendFieldTrials(std::string new_trial_string) {
73   return std::string(field_trial::GetFieldTrialString()) + new_trial_string;
74 }
75 
ClipNameToClipPath(const char * clip_name)76 std::string ClipNameToClipPath(const char* clip_name) {
77   return test::ResourcePath(clip_name, "yuv");
78 }
79 }  // namespace
80 
81 // VideoQualityTest::Params params = {
82 //   { ... },      // Common.
83 //   { ... },      // Video-specific settings.
84 //   { ... },      // Screenshare-specific settings.
85 //   { ... },      // Analyzer settings.
86 //   pipe,         // FakeNetworkPipe::Config
87 //   { ... },      // Spatial scalability.
88 //   logs          // bool
89 // };
90 
91 #if defined(RTC_ENABLE_VP9)
TEST(FullStackTest,Foreman_Cif_Net_Delay_0_0_Plr_0_VP9)92 TEST(FullStackTest, Foreman_Cif_Net_Delay_0_0_Plr_0_VP9) {
93   auto fixture = CreateVideoQualityTestFixture();
94   ParamsWithLogging foreman_cif;
95   foreman_cif.call.send_side_bwe = true;
96   foreman_cif.video[0] = {
97       true,   352,    288,    30,
98       700000, 700000, 700000, false,
99       "VP9",  1,      0,      0,
100       false,  false,  true,   ClipNameToClipPath("foreman_cif")};
101   foreman_cif.analyzer = {"foreman_cif_net_delay_0_0_plr_0_VP9", 0.0, 0.0,
102                           kFullStackTestDurationSecs};
103   fixture->RunWithAnalyzer(foreman_cif);
104 }
105 
TEST(GenericDescriptorTest,Foreman_Cif_Delay_50_0_Plr_5_VP9_Generic_Descriptor)106 TEST(GenericDescriptorTest,
107      Foreman_Cif_Delay_50_0_Plr_5_VP9_Generic_Descriptor) {
108   auto fixture = CreateVideoQualityTestFixture();
109   ParamsWithLogging foreman_cif;
110   foreman_cif.call.send_side_bwe = true;
111   foreman_cif.video[0] = {
112       true,  352,    288,     30,
113       30000, 500000, 2000000, false,
114       "VP9", 1,      0,       0,
115       false, false,  true,    ClipNameToClipPath("foreman_cif")};
116   foreman_cif.analyzer = {"foreman_cif_delay_50_0_plr_5_VP9_generic_descriptor",
117                           0.0, 0.0, kFullStackTestDurationSecs};
118   foreman_cif.config->loss_percent = 5;
119   foreman_cif.config->queue_delay_ms = 50;
120   foreman_cif.call.generic_descriptor = true;
121   fixture->RunWithAnalyzer(foreman_cif);
122 }
123 
TEST(FullStackTest,Generator_Net_Delay_0_0_Plr_0_VP9Profile2)124 TEST(FullStackTest, Generator_Net_Delay_0_0_Plr_0_VP9Profile2) {
125   // Profile 2 might not be available on some platforms until
126   // https://bugs.chromium.org/p/webm/issues/detail?id=1544 is solved.
127   bool profile_2_is_supported = false;
128   for (const auto& codec : SupportedVP9Codecs()) {
129     if (ParseSdpForVP9Profile(codec.parameters)
130             .value_or(VP9Profile::kProfile0) == VP9Profile::kProfile2) {
131       profile_2_is_supported = true;
132     }
133   }
134   if (!profile_2_is_supported)
135     return;
136   auto fixture = CreateVideoQualityTestFixture();
137 
138   SdpVideoFormat::Parameters vp92 = {
139       {kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile2)}};
140   ParamsWithLogging generator;
141   generator.call.send_side_bwe = true;
142   generator.video[0] = {
143       true, 352, 288, 30,    700000, 700000, 700000,          false, "VP9",
144       1,    0,   0,   false, false,  true,   "GeneratorI010", 0,     vp92};
145   generator.analyzer = {"generator_net_delay_0_0_plr_0_VP9Profile2", 0.0, 0.0,
146                         kFullStackTestDurationSecs};
147   fixture->RunWithAnalyzer(generator);
148 }
149 
TEST(FullStackTest,Foreman_Cif_Net_Delay_0_0_Plr_0_Multiplex)150 TEST(FullStackTest, Foreman_Cif_Net_Delay_0_0_Plr_0_Multiplex) {
151   auto fixture = CreateVideoQualityTestFixture();
152   ParamsWithLogging foreman_cif;
153   foreman_cif.call.send_side_bwe = true;
154   foreman_cif.video[0] = {
155       true,        352,    288,    30,
156       700000,      700000, 700000, false,
157       "multiplex", 1,      0,      0,
158       false,       false,  false,  ClipNameToClipPath("foreman_cif")};
159   foreman_cif.analyzer = {"foreman_cif_net_delay_0_0_plr_0_Multiplex", 0.0, 0.0,
160                           kFullStackTestDurationSecs};
161   fixture->RunWithAnalyzer(foreman_cif);
162 }
163 
TEST(FullStackTest,Generator_Net_Delay_0_0_Plr_0_Multiplex)164 TEST(FullStackTest, Generator_Net_Delay_0_0_Plr_0_Multiplex) {
165   auto fixture = CreateVideoQualityTestFixture();
166 
167   ParamsWithLogging generator;
168   generator.call.send_side_bwe = true;
169   generator.video[0] = {
170       true,        352, 288, 30, 700000, 700000, 700000, false,
171       "multiplex", 1,   0,   0,  false,  false,  false,  "GeneratorI420A"};
172   generator.analyzer = {"generator_net_delay_0_0_plr_0_Multiplex", 0.0, 0.0,
173                         kFullStackTestDurationSecs};
174   fixture->RunWithAnalyzer(generator);
175 }
176 
177 #endif  // defined(RTC_ENABLE_VP9)
178 
179 #if defined(WEBRTC_LINUX)
180 // Crashes on the linux trusty perf bot: bugs.webrtc.org/9129.
181 #define MAYBE_Net_Delay_0_0_Plr_0 DISABLED_Net_Delay_0_0_Plr_0
182 #else
183 #define MAYBE_Net_Delay_0_0_Plr_0 Net_Delay_0_0_Plr_0
184 #endif
TEST(FullStackTest,MAYBE_Net_Delay_0_0_Plr_0)185 TEST(FullStackTest, MAYBE_Net_Delay_0_0_Plr_0) {
186   auto fixture = CreateVideoQualityTestFixture();
187   ParamsWithLogging paris_qcif;
188   paris_qcif.call.send_side_bwe = true;
189   paris_qcif.video[0] = {
190       true,   176,    144,    30,
191       300000, 300000, 300000, false,
192       "VP8",  1,      0,      0,
193       false,  false,  true,   ClipNameToClipPath("paris_qcif")};
194   paris_qcif.analyzer = {"net_delay_0_0_plr_0", 36.0, 0.96,
195                          kFullStackTestDurationSecs};
196   fixture->RunWithAnalyzer(paris_qcif);
197 }
198 
TEST(GenericDescriptorTest,Foreman_Cif_Net_Delay_0_0_Plr_0_Generic_Descriptor)199 TEST(GenericDescriptorTest,
200      Foreman_Cif_Net_Delay_0_0_Plr_0_Generic_Descriptor) {
201   auto fixture = CreateVideoQualityTestFixture();
202   // TODO(pbos): Decide on psnr/ssim thresholds for foreman_cif.
203   ParamsWithLogging foreman_cif;
204   foreman_cif.call.send_side_bwe = true;
205   foreman_cif.video[0] = {
206       true,   352,    288,    30,
207       700000, 700000, 700000, false,
208       "VP8",  1,      0,      0,
209       false,  false,  true,   ClipNameToClipPath("foreman_cif")};
210   foreman_cif.analyzer = {"foreman_cif_net_delay_0_0_plr_0_generic_descriptor",
211                           0.0, 0.0, kFullStackTestDurationSecs};
212   foreman_cif.call.generic_descriptor = true;
213   fixture->RunWithAnalyzer(foreman_cif);
214 }
215 
TEST(GenericDescriptorTest,Foreman_Cif_30kbps_Net_Delay_0_0_Plr_0_Generic_Descriptor)216 TEST(GenericDescriptorTest,
217      Foreman_Cif_30kbps_Net_Delay_0_0_Plr_0_Generic_Descriptor) {
218   auto fixture = CreateVideoQualityTestFixture();
219   ParamsWithLogging foreman_cif;
220   foreman_cif.call.send_side_bwe = true;
221   foreman_cif.video[0] = {
222       true,  352,   288,   10,
223       30000, 30000, 30000, false,
224       "VP8", 1,     0,     0,
225       false, false, true,  ClipNameToClipPath("foreman_cif")};
226   foreman_cif.analyzer = {
227       "foreman_cif_30kbps_net_delay_0_0_plr_0_generic_descriptor", 0.0, 0.0,
228       kFullStackTestDurationSecs};
229   foreman_cif.call.generic_descriptor = true;
230   fixture->RunWithAnalyzer(foreman_cif);
231 }
232 
233 // Link capacity below default start rate.
TEST(FullStackTest,Foreman_Cif_Link_150kbps_Net_Delay_0_0_Plr_0)234 TEST(FullStackTest, Foreman_Cif_Link_150kbps_Net_Delay_0_0_Plr_0) {
235   auto fixture = CreateVideoQualityTestFixture();
236   ParamsWithLogging foreman_cif;
237   foreman_cif.call.send_side_bwe = true;
238   foreman_cif.video[0] = {
239       true,  352,    288,     30,
240       30000, 500000, 2000000, false,
241       "VP8", 1,      0,       0,
242       false, false,  true,    ClipNameToClipPath("foreman_cif")};
243   foreman_cif.analyzer = {"foreman_cif_link_150kbps_net_delay_0_0_plr_0", 0.0,
244                           0.0, kFullStackTestDurationSecs};
245   foreman_cif.config->link_capacity_kbps = 150;
246   fixture->RunWithAnalyzer(foreman_cif);
247 }
248 
249 // Restricted network and encoder overproducing by 30%.
TEST(FullStackTest,Foreman_Cif_Link_150kbps_Delay100ms_30pkts_Queue_Overshoot30)250 TEST(FullStackTest,
251      Foreman_Cif_Link_150kbps_Delay100ms_30pkts_Queue_Overshoot30) {
252   auto fixture = CreateVideoQualityTestFixture();
253   ParamsWithLogging foreman_cif;
254   foreman_cif.call.send_side_bwe = true;
255   foreman_cif.video[0] = {
256       true,  352,    288,     30,
257       30000, 500000, 2000000, false,
258       "VP8", 1,      0,       0,
259       false, false,  true,    ClipNameToClipPath("foreman_cif"),
260       0,     {},     1.30};
261   foreman_cif.analyzer = {
262       "foreman_cif_link_150kbps_delay100ms_30pkts_queue_overshoot30", 0.0, 0.0,
263       kFullStackTestDurationSecs};
264   foreman_cif.config->link_capacity_kbps = 150;
265   foreman_cif.config->queue_length_packets = 30;
266   foreman_cif.config->queue_delay_ms = 100;
267   fixture->RunWithAnalyzer(foreman_cif);
268 }
269 
270 // Weak 3G-style link: 250kbps, 1% loss, 100ms delay, 15 packets queue.
271 // Packet rate and loss are low enough that loss will happen with ~3s interval.
272 // This triggers protection overhead to toggle between zero and non-zero.
273 // Link queue is restrictive enough to trigger loss on probes.
TEST(FullStackTest,Foreman_Cif_Link_250kbps_Delay100ms_10pkts_Loss1)274 TEST(FullStackTest, Foreman_Cif_Link_250kbps_Delay100ms_10pkts_Loss1) {
275   auto fixture = CreateVideoQualityTestFixture();
276   ParamsWithLogging foreman_cif;
277   foreman_cif.call.send_side_bwe = true;
278   foreman_cif.video[0] = {
279       true,  352,    288,     30,
280       30000, 500000, 2000000, false,
281       "VP8", 1,      0,       0,
282       false, false,  true,    ClipNameToClipPath("foreman_cif"),
283       0,     {},     1.30};
284   foreman_cif.analyzer = {"foreman_cif_link_250kbps_delay100ms_10pkts_loss1",
285                           0.0, 0.0, kFullStackTestDurationSecs};
286   foreman_cif.config->link_capacity_kbps = 250;
287   foreman_cif.config->queue_length_packets = 10;
288   foreman_cif.config->queue_delay_ms = 100;
289   foreman_cif.config->loss_percent = 1;
290   fixture->RunWithAnalyzer(foreman_cif);
291 }
292 
TEST(GenericDescriptorTest,Foreman_Cif_Delay_50_0_Plr_5_Generic_Descriptor)293 TEST(GenericDescriptorTest, Foreman_Cif_Delay_50_0_Plr_5_Generic_Descriptor) {
294   auto fixture = CreateVideoQualityTestFixture();
295   ParamsWithLogging foreman_cif;
296   foreman_cif.call.send_side_bwe = true;
297   foreman_cif.video[0] = {
298       true,  352,    288,     30,
299       30000, 500000, 2000000, false,
300       "VP8", 1,      0,       0,
301       false, false,  true,    ClipNameToClipPath("foreman_cif")};
302   foreman_cif.analyzer = {"foreman_cif_delay_50_0_plr_5_generic_descriptor",
303                           0.0, 0.0, kFullStackTestDurationSecs};
304   foreman_cif.config->loss_percent = 5;
305   foreman_cif.config->queue_delay_ms = 50;
306   foreman_cif.call.generic_descriptor = true;
307   fixture->RunWithAnalyzer(foreman_cif);
308 }
309 
TEST(GenericDescriptorTest,Foreman_Cif_Delay_50_0_Plr_5_Ulpfec_Generic_Descriptor)310 TEST(GenericDescriptorTest,
311      Foreman_Cif_Delay_50_0_Plr_5_Ulpfec_Generic_Descriptor) {
312   auto fixture = CreateVideoQualityTestFixture();
313   ParamsWithLogging foreman_cif;
314   foreman_cif.call.send_side_bwe = true;
315   foreman_cif.video[0] = {
316       true,  352,    288,     30,
317       30000, 500000, 2000000, false,
318       "VP8", 1,      0,       0,
319       true,  false,  true,    ClipNameToClipPath("foreman_cif")};
320   foreman_cif.analyzer = {
321       "foreman_cif_delay_50_0_plr_5_ulpfec_generic_descriptor", 0.0, 0.0,
322       kFullStackTestDurationSecs};
323   foreman_cif.config->loss_percent = 5;
324   foreman_cif.config->queue_delay_ms = 50;
325   foreman_cif.call.generic_descriptor = true;
326   fixture->RunWithAnalyzer(foreman_cif);
327 }
328 
TEST(FullStackTest,Foreman_Cif_Delay_50_0_Plr_5_Flexfec)329 TEST(FullStackTest, Foreman_Cif_Delay_50_0_Plr_5_Flexfec) {
330   auto fixture = CreateVideoQualityTestFixture();
331   ParamsWithLogging foreman_cif;
332   foreman_cif.call.send_side_bwe = true;
333   foreman_cif.video[0] = {
334       true,  352,    288,     30,
335       30000, 500000, 2000000, false,
336       "VP8", 1,      0,       0,
337       false, true,   true,    ClipNameToClipPath("foreman_cif")};
338   foreman_cif.analyzer = {"foreman_cif_delay_50_0_plr_5_flexfec", 0.0, 0.0,
339                           kFullStackTestDurationSecs};
340   foreman_cif.config->loss_percent = 5;
341   foreman_cif.config->queue_delay_ms = 50;
342   fixture->RunWithAnalyzer(foreman_cif);
343 }
344 
TEST(FullStackTest,Foreman_Cif_500kbps_Delay_50_0_Plr_3_Flexfec)345 TEST(FullStackTest, Foreman_Cif_500kbps_Delay_50_0_Plr_3_Flexfec) {
346   auto fixture = CreateVideoQualityTestFixture();
347   ParamsWithLogging foreman_cif;
348   foreman_cif.call.send_side_bwe = true;
349   foreman_cif.video[0] = {
350       true,  352,    288,     30,
351       30000, 500000, 2000000, false,
352       "VP8", 1,      0,       0,
353       false, true,   true,    ClipNameToClipPath("foreman_cif")};
354   foreman_cif.analyzer = {"foreman_cif_500kbps_delay_50_0_plr_3_flexfec", 0.0,
355                           0.0, kFullStackTestDurationSecs};
356   foreman_cif.config->loss_percent = 3;
357   foreman_cif.config->link_capacity_kbps = 500;
358   foreman_cif.config->queue_delay_ms = 50;
359   fixture->RunWithAnalyzer(foreman_cif);
360 }
361 
TEST(FullStackTest,Foreman_Cif_500kbps_Delay_50_0_Plr_3_Ulpfec)362 TEST(FullStackTest, Foreman_Cif_500kbps_Delay_50_0_Plr_3_Ulpfec) {
363   auto fixture = CreateVideoQualityTestFixture();
364   ParamsWithLogging foreman_cif;
365   foreman_cif.call.send_side_bwe = true;
366   foreman_cif.video[0] = {
367       true,  352,    288,     30,
368       30000, 500000, 2000000, false,
369       "VP8", 1,      0,       0,
370       true,  false,  true,    ClipNameToClipPath("foreman_cif")};
371   foreman_cif.analyzer = {"foreman_cif_500kbps_delay_50_0_plr_3_ulpfec", 0.0,
372                           0.0, kFullStackTestDurationSecs};
373   foreman_cif.config->loss_percent = 3;
374   foreman_cif.config->link_capacity_kbps = 500;
375   foreman_cif.config->queue_delay_ms = 50;
376   fixture->RunWithAnalyzer(foreman_cif);
377 }
378 
379 #if defined(WEBRTC_USE_H264)
TEST(FullStackTest,Foreman_Cif_Net_Delay_0_0_Plr_0_H264)380 TEST(FullStackTest, Foreman_Cif_Net_Delay_0_0_Plr_0_H264) {
381   auto fixture = CreateVideoQualityTestFixture();
382   // TODO(pbos): Decide on psnr/ssim thresholds for foreman_cif.
383   ParamsWithLogging foreman_cif;
384   foreman_cif.call.send_side_bwe = true;
385   foreman_cif.video[0] = {
386       true,   352,    288,    30,
387       700000, 700000, 700000, false,
388       "H264", 1,      0,      0,
389       false,  false,  true,   ClipNameToClipPath("foreman_cif")};
390   foreman_cif.analyzer = {"foreman_cif_net_delay_0_0_plr_0_H264", 0.0, 0.0,
391                           kFullStackTestDurationSecs};
392   fixture->RunWithAnalyzer(foreman_cif);
393 }
394 
TEST(FullStackTest,Foreman_Cif_30kbps_Net_Delay_0_0_Plr_0_H264)395 TEST(FullStackTest, Foreman_Cif_30kbps_Net_Delay_0_0_Plr_0_H264) {
396   auto fixture = CreateVideoQualityTestFixture();
397   ParamsWithLogging foreman_cif;
398   foreman_cif.call.send_side_bwe = true;
399   foreman_cif.video[0] = {
400       true,   352,   288,   10,
401       30000,  30000, 30000, false,
402       "H264", 1,     0,     0,
403       false,  false, true,  ClipNameToClipPath("foreman_cif")};
404   foreman_cif.analyzer = {"foreman_cif_30kbps_net_delay_0_0_plr_0_H264", 0.0,
405                           0.0, kFullStackTestDurationSecs};
406   fixture->RunWithAnalyzer(foreman_cif);
407 }
408 
TEST(GenericDescriptorTest,Foreman_Cif_Delay_50_0_Plr_5_H264_Generic_Descriptor)409 TEST(GenericDescriptorTest,
410      Foreman_Cif_Delay_50_0_Plr_5_H264_Generic_Descriptor) {
411   auto fixture = CreateVideoQualityTestFixture();
412   ParamsWithLogging foreman_cif;
413   foreman_cif.call.send_side_bwe = true;
414   foreman_cif.video[0] = {
415       true,   352,    288,     30,
416       30000,  500000, 2000000, false,
417       "H264", 1,      0,       0,
418       false,  false,  true,    ClipNameToClipPath("foreman_cif")};
419   foreman_cif.analyzer = {
420       "foreman_cif_delay_50_0_plr_5_H264_generic_descriptor", 0.0, 0.0,
421       kFullStackTestDurationSecs};
422   foreman_cif.config->loss_percent = 5;
423   foreman_cif.config->queue_delay_ms = 50;
424   foreman_cif.call.generic_descriptor = true;
425   fixture->RunWithAnalyzer(foreman_cif);
426 }
427 
TEST(FullStackTest,Foreman_Cif_Delay_50_0_Plr_5_H264_Sps_Pps_Idr)428 TEST(FullStackTest, Foreman_Cif_Delay_50_0_Plr_5_H264_Sps_Pps_Idr) {
429   test::ScopedFieldTrials override_field_trials(
430       AppendFieldTrials("WebRTC-SpsPpsIdrIsH264Keyframe/Enabled/"));
431   auto fixture = CreateVideoQualityTestFixture();
432 
433   ParamsWithLogging foreman_cif;
434   foreman_cif.call.send_side_bwe = true;
435   foreman_cif.video[0] = {
436       true,   352,    288,     30,
437       30000,  500000, 2000000, false,
438       "H264", 1,      0,       0,
439       false,  false,  true,    ClipNameToClipPath("foreman_cif")};
440   foreman_cif.analyzer = {"foreman_cif_delay_50_0_plr_5_H264_sps_pps_idr", 0.0,
441                           0.0, kFullStackTestDurationSecs};
442   foreman_cif.config->loss_percent = 5;
443   foreman_cif.config->queue_delay_ms = 50;
444   fixture->RunWithAnalyzer(foreman_cif);
445 }
446 
447 // Verify that this is worth the bot time, before enabling.
TEST(FullStackTest,Foreman_Cif_Delay_50_0_Plr_5_H264_Flexfec)448 TEST(FullStackTest, Foreman_Cif_Delay_50_0_Plr_5_H264_Flexfec) {
449   auto fixture = CreateVideoQualityTestFixture();
450   ParamsWithLogging foreman_cif;
451   foreman_cif.call.send_side_bwe = true;
452   foreman_cif.video[0] = {
453       true,   352,    288,     30,
454       30000,  500000, 2000000, false,
455       "H264", 1,      0,       0,
456       false,  true,   true,    ClipNameToClipPath("foreman_cif")};
457   foreman_cif.analyzer = {"foreman_cif_delay_50_0_plr_5_H264_flexfec", 0.0, 0.0,
458                           kFullStackTestDurationSecs};
459   foreman_cif.config->loss_percent = 5;
460   foreman_cif.config->queue_delay_ms = 50;
461   fixture->RunWithAnalyzer(foreman_cif);
462 }
463 
464 // Ulpfec with H264 is an unsupported combination, so this test is only useful
465 // for debugging. It is therefore disabled by default.
TEST(FullStackTest,DISABLED_Foreman_Cif_Delay_50_0_Plr_5_H264_Ulpfec)466 TEST(FullStackTest, DISABLED_Foreman_Cif_Delay_50_0_Plr_5_H264_Ulpfec) {
467   auto fixture = CreateVideoQualityTestFixture();
468   ParamsWithLogging foreman_cif;
469   foreman_cif.call.send_side_bwe = true;
470   foreman_cif.video[0] = {
471       true,   352,    288,     30,
472       30000,  500000, 2000000, false,
473       "H264", 1,      0,       0,
474       true,   false,  true,    ClipNameToClipPath("foreman_cif")};
475   foreman_cif.analyzer = {"foreman_cif_delay_50_0_plr_5_H264_ulpfec", 0.0, 0.0,
476                           kFullStackTestDurationSecs};
477   foreman_cif.config->loss_percent = 5;
478   foreman_cif.config->queue_delay_ms = 50;
479   fixture->RunWithAnalyzer(foreman_cif);
480 }
481 #endif  // defined(WEBRTC_USE_H264)
482 
TEST(FullStackTest,Foreman_Cif_500kbps)483 TEST(FullStackTest, Foreman_Cif_500kbps) {
484   auto fixture = CreateVideoQualityTestFixture();
485   ParamsWithLogging foreman_cif;
486   foreman_cif.call.send_side_bwe = true;
487   foreman_cif.video[0] = {
488       true,  352,    288,     30,
489       30000, 500000, 2000000, false,
490       "VP8", 1,      0,       0,
491       false, false,  true,    ClipNameToClipPath("foreman_cif")};
492   foreman_cif.analyzer = {"foreman_cif_500kbps", 0.0, 0.0,
493                           kFullStackTestDurationSecs};
494   foreman_cif.config->queue_length_packets = 0;
495   foreman_cif.config->queue_delay_ms = 0;
496   foreman_cif.config->link_capacity_kbps = 500;
497   fixture->RunWithAnalyzer(foreman_cif);
498 }
499 
TEST(FullStackTest,Foreman_Cif_500kbps_32pkts_Queue)500 TEST(FullStackTest, Foreman_Cif_500kbps_32pkts_Queue) {
501   auto fixture = CreateVideoQualityTestFixture();
502   ParamsWithLogging foreman_cif;
503   foreman_cif.call.send_side_bwe = true;
504   foreman_cif.video[0] = {
505       true,  352,    288,     30,
506       30000, 500000, 2000000, false,
507       "VP8", 1,      0,       0,
508       false, false,  true,    ClipNameToClipPath("foreman_cif")};
509   foreman_cif.analyzer = {"foreman_cif_500kbps_32pkts_queue", 0.0, 0.0,
510                           kFullStackTestDurationSecs};
511   foreman_cif.config->queue_length_packets = 32;
512   foreman_cif.config->queue_delay_ms = 0;
513   foreman_cif.config->link_capacity_kbps = 500;
514   fixture->RunWithAnalyzer(foreman_cif);
515 }
516 
TEST(FullStackTest,Foreman_Cif_500kbps_100ms)517 TEST(FullStackTest, Foreman_Cif_500kbps_100ms) {
518   auto fixture = CreateVideoQualityTestFixture();
519   ParamsWithLogging foreman_cif;
520   foreman_cif.call.send_side_bwe = true;
521   foreman_cif.video[0] = {
522       true,  352,    288,     30,
523       30000, 500000, 2000000, false,
524       "VP8", 1,      0,       0,
525       false, false,  true,    ClipNameToClipPath("foreman_cif")};
526   foreman_cif.analyzer = {"foreman_cif_500kbps_100ms", 0.0, 0.0,
527                           kFullStackTestDurationSecs};
528   foreman_cif.config->queue_length_packets = 0;
529   foreman_cif.config->queue_delay_ms = 100;
530   foreman_cif.config->link_capacity_kbps = 500;
531   fixture->RunWithAnalyzer(foreman_cif);
532 }
533 
TEST(GenericDescriptorTest,Foreman_Cif_500kbps_100ms_32pkts_Queue_Generic_Descriptor)534 TEST(GenericDescriptorTest,
535      Foreman_Cif_500kbps_100ms_32pkts_Queue_Generic_Descriptor) {
536   auto fixture = CreateVideoQualityTestFixture();
537   ParamsWithLogging foreman_cif;
538   foreman_cif.call.send_side_bwe = true;
539   foreman_cif.video[0] = {
540       true,  352,    288,     30,
541       30000, 500000, 2000000, false,
542       "VP8", 1,      0,       0,
543       false, false,  true,    ClipNameToClipPath("foreman_cif")};
544   foreman_cif.analyzer = {
545       "foreman_cif_500kbps_100ms_32pkts_queue_generic_descriptor", 0.0, 0.0,
546       kFullStackTestDurationSecs};
547   foreman_cif.config->queue_length_packets = 32;
548   foreman_cif.config->queue_delay_ms = 100;
549   foreman_cif.config->link_capacity_kbps = 500;
550   foreman_cif.call.generic_descriptor = true;
551   fixture->RunWithAnalyzer(foreman_cif);
552 }
553 
TEST(FullStackTest,Foreman_Cif_500kbps_100ms_32pkts_Queue_Recv_Bwe)554 TEST(FullStackTest, Foreman_Cif_500kbps_100ms_32pkts_Queue_Recv_Bwe) {
555   auto fixture = CreateVideoQualityTestFixture();
556   ParamsWithLogging foreman_cif;
557   foreman_cif.call.send_side_bwe = false;
558   foreman_cif.video[0] = {
559       true,  352,    288,     30,
560       30000, 500000, 2000000, false,
561       "VP8", 1,      0,       0,
562       false, false,  true,    ClipNameToClipPath("foreman_cif")};
563   foreman_cif.analyzer = {"foreman_cif_500kbps_100ms_32pkts_queue_recv_bwe",
564                           0.0, 0.0, kFullStackTestDurationSecs};
565   foreman_cif.config->queue_length_packets = 32;
566   foreman_cif.config->queue_delay_ms = 100;
567   foreman_cif.config->link_capacity_kbps = 500;
568   fixture->RunWithAnalyzer(foreman_cif);
569 }
570 
TEST(FullStackTest,Foreman_Cif_1000kbps_100ms_32pkts_Queue)571 TEST(FullStackTest, Foreman_Cif_1000kbps_100ms_32pkts_Queue) {
572   auto fixture = CreateVideoQualityTestFixture();
573   ParamsWithLogging foreman_cif;
574   foreman_cif.call.send_side_bwe = true;
575   foreman_cif.video[0] = {
576       true,  352,     288,     30,
577       30000, 2000000, 2000000, false,
578       "VP8", 1,       0,       0,
579       false, false,   true,    ClipNameToClipPath("foreman_cif")};
580   foreman_cif.analyzer = {"foreman_cif_1000kbps_100ms_32pkts_queue", 0.0, 0.0,
581                           kFullStackTestDurationSecs};
582   foreman_cif.config->queue_length_packets = 32;
583   foreman_cif.config->queue_delay_ms = 100;
584   foreman_cif.config->link_capacity_kbps = 1000;
585   fixture->RunWithAnalyzer(foreman_cif);
586 }
587 
588 // TODO(sprang): Remove this if we have the similar ModerateLimits below?
TEST(FullStackTest,Conference_Motion_Hd_2000kbps_100ms_32pkts_Queue)589 TEST(FullStackTest, Conference_Motion_Hd_2000kbps_100ms_32pkts_Queue) {
590   auto fixture = CreateVideoQualityTestFixture();
591   ParamsWithLogging conf_motion_hd;
592   conf_motion_hd.call.send_side_bwe = true;
593   conf_motion_hd.video[0] = {
594       true,    1280,
595       720,     50,
596       30000,   3000000,
597       3000000, false,
598       "VP8",   1,
599       0,       0,
600       false,   false,
601       false,   ClipNameToClipPath("ConferenceMotion_1280_720_50")};
602   conf_motion_hd.analyzer = {"conference_motion_hd_2000kbps_100ms_32pkts_queue",
603                              0.0, 0.0, kFullStackTestDurationSecs};
604   conf_motion_hd.config->queue_length_packets = 32;
605   conf_motion_hd.config->queue_delay_ms = 100;
606   conf_motion_hd.config->link_capacity_kbps = 2000;
607   fixture->RunWithAnalyzer(conf_motion_hd);
608 }
609 
TEST(GenericDescriptorTest,Conference_Motion_Hd_2tl_Moderate_Limits_Generic_Descriptor)610 TEST(GenericDescriptorTest,
611      Conference_Motion_Hd_2tl_Moderate_Limits_Generic_Descriptor) {
612   auto fixture = CreateVideoQualityTestFixture();
613   ParamsWithLogging conf_motion_hd;
614   conf_motion_hd.call.send_side_bwe = true;
615   conf_motion_hd.video[0] = {
616       true,    1280,
617       720,     50,
618       30000,   3000000,
619       3000000, false,
620       "VP8",   2,
621       -1,      0,
622       false,   false,
623       false,   ClipNameToClipPath("ConferenceMotion_1280_720_50")};
624   conf_motion_hd.analyzer = {
625       "conference_motion_hd_2tl_moderate_limits_generic_descriptor", 0.0, 0.0,
626       kFullStackTestDurationSecs};
627   conf_motion_hd.config->queue_length_packets = 50;
628   conf_motion_hd.config->loss_percent = 3;
629   conf_motion_hd.config->queue_delay_ms = 100;
630   conf_motion_hd.config->link_capacity_kbps = 2000;
631   conf_motion_hd.call.generic_descriptor = true;
632   fixture->RunWithAnalyzer(conf_motion_hd);
633 }
634 
TEST(FullStackTest,Conference_Motion_Hd_3tl_Moderate_Limits)635 TEST(FullStackTest, Conference_Motion_Hd_3tl_Moderate_Limits) {
636   auto fixture = CreateVideoQualityTestFixture();
637   ParamsWithLogging conf_motion_hd;
638   conf_motion_hd.call.send_side_bwe = true;
639   conf_motion_hd.video[0] = {
640       true,    1280,
641       720,     50,
642       30000,   3000000,
643       3000000, false,
644       "VP8",   3,
645       -1,      0,
646       false,   false,
647       false,   ClipNameToClipPath("ConferenceMotion_1280_720_50")};
648   conf_motion_hd.analyzer = {"conference_motion_hd_3tl_moderate_limits", 0.0,
649                              0.0, kFullStackTestDurationSecs};
650   conf_motion_hd.config->queue_length_packets = 50;
651   conf_motion_hd.config->loss_percent = 3;
652   conf_motion_hd.config->queue_delay_ms = 100;
653   conf_motion_hd.config->link_capacity_kbps = 2000;
654   fixture->RunWithAnalyzer(conf_motion_hd);
655 }
656 
TEST(FullStackTest,Conference_Motion_Hd_4tl_Moderate_Limits)657 TEST(FullStackTest, Conference_Motion_Hd_4tl_Moderate_Limits) {
658   auto fixture = CreateVideoQualityTestFixture();
659   ParamsWithLogging conf_motion_hd;
660   conf_motion_hd.call.send_side_bwe = true;
661   conf_motion_hd.video[0] = {
662       true,    1280,
663       720,     50,
664       30000,   3000000,
665       3000000, false,
666       "VP8",   4,
667       -1,      0,
668       false,   false,
669       false,   ClipNameToClipPath("ConferenceMotion_1280_720_50")};
670   conf_motion_hd.analyzer = {"conference_motion_hd_4tl_moderate_limits", 0.0,
671                              0.0, kFullStackTestDurationSecs};
672   conf_motion_hd.config->queue_length_packets = 50;
673   conf_motion_hd.config->loss_percent = 3;
674   conf_motion_hd.config->queue_delay_ms = 100;
675   conf_motion_hd.config->link_capacity_kbps = 2000;
676   fixture->RunWithAnalyzer(conf_motion_hd);
677 }
678 
TEST(FullStackTest,Conference_Motion_Hd_3tl_Alt_Moderate_Limits)679 TEST(FullStackTest, Conference_Motion_Hd_3tl_Alt_Moderate_Limits) {
680   test::ScopedFieldTrials field_trial(
681       AppendFieldTrials("WebRTC-UseShortVP8TL3Pattern/Enabled/"));
682   auto fixture = CreateVideoQualityTestFixture();
683   ParamsWithLogging conf_motion_hd;
684   conf_motion_hd.call.send_side_bwe = true;
685   conf_motion_hd.video[0] = {
686       true,    1280,
687       720,     50,
688       30000,   3000000,
689       3000000, false,
690       "VP8",   3,
691       -1,      0,
692       false,   false,
693       false,   ClipNameToClipPath("ConferenceMotion_1280_720_50")};
694   conf_motion_hd.analyzer = {"conference_motion_hd_3tl_alt_moderate_limits",
695                              0.0, 0.0, kFullStackTestDurationSecs};
696   conf_motion_hd.config->queue_length_packets = 50;
697   conf_motion_hd.config->loss_percent = 3;
698   conf_motion_hd.config->queue_delay_ms = 100;
699   conf_motion_hd.config->link_capacity_kbps = 2000;
700   fixture->RunWithAnalyzer(conf_motion_hd);
701 }
702 
TEST(FullStackTest,Conference_Motion_Hd_3tl_Alt_Heavy_Moderate_Limits)703 TEST(FullStackTest, Conference_Motion_Hd_3tl_Alt_Heavy_Moderate_Limits) {
704   auto fixture = CreateVideoQualityTestFixture();
705   test::ScopedFieldTrials field_trial(
706       AppendFieldTrials("WebRTC-UseShortVP8TL3Pattern/Enabled/"
707                         "WebRTC-UseBaseHeavyVP8TL3RateAllocation/Enabled/"));
708   ParamsWithLogging conf_motion_hd;
709   conf_motion_hd.call.send_side_bwe = true;
710   conf_motion_hd.video[0] = {
711       true,    1280,
712       720,     50,
713       30000,   3000000,
714       3000000, false,
715       "VP8",   3,
716       -1,      0,
717       false,   false,
718       false,   ClipNameToClipPath("ConferenceMotion_1280_720_50")};
719   conf_motion_hd.analyzer = {
720       "conference_motion_hd_3tl_alt_heavy_moderate_limits", 0.0, 0.0,
721       kFullStackTestDurationSecs};
722   conf_motion_hd.config->queue_length_packets = 50;
723   conf_motion_hd.config->loss_percent = 3;
724   conf_motion_hd.config->queue_delay_ms = 100;
725   conf_motion_hd.config->link_capacity_kbps = 2000;
726   fixture->RunWithAnalyzer(conf_motion_hd);
727 }
728 
729 #if defined(RTC_ENABLE_VP9)
TEST(FullStackTest,Conference_Motion_Hd_2000kbps_100ms_32pkts_Queue_Vp9)730 TEST(FullStackTest, Conference_Motion_Hd_2000kbps_100ms_32pkts_Queue_Vp9) {
731   auto fixture = CreateVideoQualityTestFixture();
732   ParamsWithLogging conf_motion_hd;
733   conf_motion_hd.call.send_side_bwe = true;
734   conf_motion_hd.video[0] = {
735       true,    1280,
736       720,     50,
737       30000,   3000000,
738       3000000, false,
739       "VP9",   1,
740       0,       0,
741       false,   false,
742       false,   ClipNameToClipPath("ConferenceMotion_1280_720_50")};
743   conf_motion_hd.analyzer = {
744       "conference_motion_hd_2000kbps_100ms_32pkts_queue_vp9", 0.0, 0.0,
745       kFullStackTestDurationSecs};
746   conf_motion_hd.config->queue_length_packets = 32;
747   conf_motion_hd.config->queue_delay_ms = 100;
748   conf_motion_hd.config->link_capacity_kbps = 2000;
749   fixture->RunWithAnalyzer(conf_motion_hd);
750 }
751 #endif
752 
TEST(FullStackTest,Screenshare_Slides)753 TEST(FullStackTest, Screenshare_Slides) {
754   auto fixture = CreateVideoQualityTestFixture();
755   ParamsWithLogging screenshare;
756   screenshare.call.send_side_bwe = true;
757   screenshare.video[0] = {true,    1850,  1110,  5, 50000, 200000,
758                           1000000, false, "VP8", 2, 1,     400000,
759                           false,   false, false, ""};
760   screenshare.screenshare[0] = {true, false, 10};
761   screenshare.analyzer = {"screenshare_slides", 0.0, 0.0,
762                           kFullStackTestDurationSecs};
763   fixture->RunWithAnalyzer(screenshare);
764 }
765 
766 #if !defined(WEBRTC_MAC) && !defined(WEBRTC_WIN)
767 // TODO(bugs.webrtc.org/9840): Investigate why is this test flaky on Win/Mac.
TEST(FullStackTest,Screenshare_Slides_Simulcast)768 TEST(FullStackTest, Screenshare_Slides_Simulcast) {
769   auto fixture = CreateVideoQualityTestFixture();
770   ParamsWithLogging screenshare;
771   screenshare.call.send_side_bwe = true;
772   screenshare.screenshare[0] = {true, false, 10};
773   screenshare.video[0] = {true,    1850,  1110,  30, 800000, 2500000,
774                           2500000, false, "VP8", 2,  1,      400000,
775                           false,   false, false, ""};
776   screenshare.analyzer = {"screenshare_slides_simulcast", 0.0, 0.0,
777                           kFullStackTestDurationSecs};
778   ParamsWithLogging screenshare_params_high;
779   screenshare_params_high.video[0] = {
780       true,  1850, 1110, 60,     600000, 1250000, 1250000, false,
781       "VP8", 2,    0,    400000, false,  false,   false,   ""};
782   VideoQualityTest::Params screenshare_params_low;
783   screenshare_params_low.video[0] = {true,    1850,  1110,  5, 30000, 200000,
784                                      1000000, false, "VP8", 2, 0,     400000,
785                                      false,   false, false, ""};
786 
787   std::vector<VideoStream> streams = {
788       VideoQualityTest::DefaultVideoStream(screenshare_params_low, 0),
789       VideoQualityTest::DefaultVideoStream(screenshare_params_high, 0)};
790   screenshare.ss[0] = {
791       streams, 1, 1, 0, InterLayerPredMode::kOn, std::vector<SpatialLayer>(),
792       false};
793   fixture->RunWithAnalyzer(screenshare);
794 }
795 
796 #endif  // !defined(WEBRTC_MAC) && !defined(WEBRTC_WIN)
797 
TEST(FullStackTest,Screenshare_Slides_Scrolling)798 TEST(FullStackTest, Screenshare_Slides_Scrolling) {
799   auto fixture = CreateVideoQualityTestFixture();
800   ParamsWithLogging config;
801   config.call.send_side_bwe = true;
802   config.video[0] = {true,    1850,  1110 / 2, 5, 50000, 200000,
803                      1000000, false, "VP8",    2, 1,     400000,
804                      false,   false, false,    ""};
805   config.screenshare[0] = {true, false, 10, 2};
806   config.analyzer = {"screenshare_slides_scrolling", 0.0, 0.0,
807                      kFullStackTestDurationSecs};
808   fixture->RunWithAnalyzer(config);
809 }
810 
TEST(GenericDescriptorTest,Screenshare_Slides_Lossy_Net_Generic_Descriptor)811 TEST(GenericDescriptorTest, Screenshare_Slides_Lossy_Net_Generic_Descriptor) {
812   auto fixture = CreateVideoQualityTestFixture();
813   ParamsWithLogging screenshare;
814   screenshare.call.send_side_bwe = true;
815   screenshare.video[0] = {true,    1850,  1110,  5, 50000, 200000,
816                           1000000, false, "VP8", 2, 1,     400000,
817                           false,   false, false, ""};
818   screenshare.screenshare[0] = {true, false, 10};
819   screenshare.analyzer = {"screenshare_slides_lossy_net_generic_descriptor",
820                           0.0, 0.0, kFullStackTestDurationSecs};
821   screenshare.config->loss_percent = 5;
822   screenshare.config->queue_delay_ms = 200;
823   screenshare.config->link_capacity_kbps = 500;
824   screenshare.call.generic_descriptor = true;
825   fixture->RunWithAnalyzer(screenshare);
826 }
827 
TEST(FullStackTest,Screenshare_Slides_Very_Lossy)828 TEST(FullStackTest, Screenshare_Slides_Very_Lossy) {
829   auto fixture = CreateVideoQualityTestFixture();
830   ParamsWithLogging screenshare;
831   screenshare.call.send_side_bwe = true;
832   screenshare.video[0] = {true,    1850,  1110,  5, 50000, 200000,
833                           1000000, false, "VP8", 2, 1,     400000,
834                           false,   false, false, ""};
835   screenshare.screenshare[0] = {true, false, 10};
836   screenshare.analyzer = {"screenshare_slides_very_lossy", 0.0, 0.0,
837                           kFullStackTestDurationSecs};
838   screenshare.config->loss_percent = 10;
839   screenshare.config->queue_delay_ms = 200;
840   screenshare.config->link_capacity_kbps = 500;
841   fixture->RunWithAnalyzer(screenshare);
842 }
843 
TEST(FullStackTest,Screenshare_Slides_Lossy_Limited)844 TEST(FullStackTest, Screenshare_Slides_Lossy_Limited) {
845   auto fixture = CreateVideoQualityTestFixture();
846   ParamsWithLogging screenshare;
847   screenshare.call.send_side_bwe = true;
848   screenshare.video[0] = {true,    1850,  1110,  5, 50000, 200000,
849                           1000000, false, "VP8", 2, 1,     400000,
850                           false,   false, false, ""};
851   screenshare.screenshare[0] = {true, false, 10};
852   screenshare.analyzer = {"screenshare_slides_lossy_limited", 0.0, 0.0,
853                           kFullStackTestDurationSecs};
854   screenshare.config->loss_percent = 5;
855   screenshare.config->link_capacity_kbps = 200;
856   screenshare.config->queue_length_packets = 30;
857 
858   fixture->RunWithAnalyzer(screenshare);
859 }
860 
TEST(FullStackTest,Screenshare_Slides_Moderately_Restricted)861 TEST(FullStackTest, Screenshare_Slides_Moderately_Restricted) {
862   auto fixture = CreateVideoQualityTestFixture();
863   ParamsWithLogging screenshare;
864   screenshare.call.send_side_bwe = true;
865   screenshare.video[0] = {true,    1850,  1110,  5, 50000, 200000,
866                           1000000, false, "VP8", 2, 1,     400000,
867                           false,   false, false, ""};
868   screenshare.screenshare[0] = {true, false, 10};
869   screenshare.analyzer = {"screenshare_slides_moderately_restricted", 0.0, 0.0,
870                           kFullStackTestDurationSecs};
871   screenshare.config->loss_percent = 1;
872   screenshare.config->link_capacity_kbps = 1200;
873   screenshare.config->queue_length_packets = 30;
874 
875   fixture->RunWithAnalyzer(screenshare);
876 }
877 
878 // Since ParamsWithLogging::Video is not trivially destructible, we can't
879 // store these structs as const globals.
SvcVp9Video()880 ParamsWithLogging::Video SvcVp9Video() {
881   return ParamsWithLogging::Video{
882       true,    1280,
883       720,     30,
884       800000,  2500000,
885       2500000, false,
886       "VP9",   3,
887       2,       400000,
888       false,   false,
889       false,   ClipNameToClipPath("ConferenceMotion_1280_720_50")};
890 }
891 
SimulcastVp8VideoHigh()892 ParamsWithLogging::Video SimulcastVp8VideoHigh() {
893   return ParamsWithLogging::Video{
894       true,    1280,
895       720,     30,
896       800000,  2500000,
897       2500000, false,
898       "VP8",   3,
899       2,       400000,
900       false,   false,
901       false,   ClipNameToClipPath("ConferenceMotion_1280_720_50")};
902 }
903 
SimulcastVp8VideoMedium()904 ParamsWithLogging::Video SimulcastVp8VideoMedium() {
905   return ParamsWithLogging::Video{
906       true,   640,
907       360,    30,
908       150000, 500000,
909       700000, false,
910       "VP8",  3,
911       2,      400000,
912       false,  false,
913       false,  ClipNameToClipPath("ConferenceMotion_1280_720_50")};
914 }
915 
SimulcastVp8VideoLow()916 ParamsWithLogging::Video SimulcastVp8VideoLow() {
917   return ParamsWithLogging::Video{
918       true,   320,
919       180,    30,
920       30000,  150000,
921       200000, false,
922       "VP8",  3,
923       2,      400000,
924       false,  false,
925       false,  ClipNameToClipPath("ConferenceMotion_1280_720_50")};
926 }
927 
928 #if defined(RTC_ENABLE_VP9)
929 
TEST(FullStackTest,Screenshare_Slides_Vp9_3sl_High_Fps)930 TEST(FullStackTest, Screenshare_Slides_Vp9_3sl_High_Fps) {
931   auto fixture = CreateVideoQualityTestFixture();
932   ParamsWithLogging screenshare;
933   screenshare.call.send_side_bwe = true;
934   screenshare.video[0] = {true,    1850,  1110,  30, 50000, 200000,
935                           2000000, false, "VP9", 1,  0,     400000,
936                           false,   false, false, ""};
937   screenshare.screenshare[0] = {true, false, 10};
938   screenshare.analyzer = {"screenshare_slides_vp9_3sl_high_fps", 0.0, 0.0,
939                           kFullStackTestDurationSecs};
940   screenshare.ss[0] = {
941       std::vector<VideoStream>(),  0,   3, 2, InterLayerPredMode::kOn,
942       std::vector<SpatialLayer>(), true};
943   fixture->RunWithAnalyzer(screenshare);
944 }
945 
946 // TODO(http://bugs.webrtc.org/9506): investigate.
947 #if !defined(WEBRTC_MAC)
948 
TEST(FullStackTest,Vp9ksvc_3sl_High)949 TEST(FullStackTest, Vp9ksvc_3sl_High) {
950   webrtc::test::ScopedFieldTrials override_trials(
951       AppendFieldTrials("WebRTC-Vp9IssueKeyFrameOnLayerDeactivation/Enabled/"));
952   auto fixture = CreateVideoQualityTestFixture();
953   ParamsWithLogging simulcast;
954   simulcast.call.send_side_bwe = true;
955   simulcast.video[0] = SvcVp9Video();
956   simulcast.analyzer = {"vp9ksvc_3sl_high", 0.0, 0.0,
957                         kFullStackTestDurationSecs};
958   simulcast.ss[0] = {
959       std::vector<VideoStream>(),  0,    3, 2, InterLayerPredMode::kOnKeyPic,
960       std::vector<SpatialLayer>(), false};
961   fixture->RunWithAnalyzer(simulcast);
962 }
963 
TEST(FullStackTest,Vp9ksvc_3sl_Low)964 TEST(FullStackTest, Vp9ksvc_3sl_Low) {
965   webrtc::test::ScopedFieldTrials override_trials(
966       AppendFieldTrials("WebRTC-Vp9IssueKeyFrameOnLayerDeactivation/Enabled/"));
967   auto fixture = CreateVideoQualityTestFixture();
968   ParamsWithLogging simulcast;
969   simulcast.call.send_side_bwe = true;
970   simulcast.video[0] = SvcVp9Video();
971   simulcast.analyzer = {"vp9ksvc_3sl_low", 0.0, 0.0,
972                         kFullStackTestDurationSecs};
973   simulcast.ss[0] = {
974       std::vector<VideoStream>(),  0,    3, 0, InterLayerPredMode::kOnKeyPic,
975       std::vector<SpatialLayer>(), false};
976   fixture->RunWithAnalyzer(simulcast);
977 }
978 
TEST(FullStackTest,Vp9ksvc_3sl_Low_Bw_Limited)979 TEST(FullStackTest, Vp9ksvc_3sl_Low_Bw_Limited) {
980   webrtc::test::ScopedFieldTrials override_trials(
981       AppendFieldTrials("WebRTC-Vp9IssueKeyFrameOnLayerDeactivation/Enabled/"
982                         "WebRTC-Vp9ExternalRefCtrl/Enabled/"));
983   auto fixture = CreateVideoQualityTestFixture();
984   ParamsWithLogging simulcast;
985   simulcast.config->link_capacity_kbps = 500;
986   simulcast.call.send_side_bwe = true;
987   simulcast.video[0] = SvcVp9Video();
988   simulcast.analyzer = {"vp9ksvc_3sl_low_bw_limited", 0.0, 0.0,
989                         kFullStackTestDurationSecs};
990   simulcast.ss[0] = {
991       std::vector<VideoStream>(),  0,    3, 0, InterLayerPredMode::kOnKeyPic,
992       std::vector<SpatialLayer>(), false};
993   fixture->RunWithAnalyzer(simulcast);
994 }
995 
TEST(FullStackTest,Vp9ksvc_3sl_Medium_Network_Restricted)996 TEST(FullStackTest, Vp9ksvc_3sl_Medium_Network_Restricted) {
997   webrtc::test::ScopedFieldTrials override_trials(
998       AppendFieldTrials("WebRTC-Vp9IssueKeyFrameOnLayerDeactivation/Enabled/"));
999   auto fixture = CreateVideoQualityTestFixture();
1000   ParamsWithLogging simulcast;
1001   simulcast.call.send_side_bwe = true;
1002   simulcast.video[0] = SvcVp9Video();
1003   simulcast.analyzer = {"vp9ksvc_3sl_medium_network_restricted", 0.0, 0.0,
1004                         kFullStackTestDurationSecs};
1005   simulcast.ss[0] = {
1006       std::vector<VideoStream>(),  0,    3, -1, InterLayerPredMode::kOnKeyPic,
1007       std::vector<SpatialLayer>(), false};
1008   simulcast.config->link_capacity_kbps = 1000;
1009   simulcast.config->queue_delay_ms = 100;
1010   fixture->RunWithAnalyzer(simulcast);
1011 }
1012 
1013 // TODO(webrtc:9722): Remove when experiment is cleaned up.
TEST(FullStackTest,Vp9ksvc_3sl_Medium_Network_Restricted_Trusted_Rate)1014 TEST(FullStackTest, Vp9ksvc_3sl_Medium_Network_Restricted_Trusted_Rate) {
1015   webrtc::test::ScopedFieldTrials override_trials(
1016       AppendFieldTrials("WebRTC-Vp9IssueKeyFrameOnLayerDeactivation/Enabled/"));
1017   auto fixture = CreateVideoQualityTestFixture();
1018   ParamsWithLogging simulcast;
1019   simulcast.call.send_side_bwe = true;
1020   simulcast.video[0] = SvcVp9Video();
1021   simulcast.analyzer = {"vp9ksvc_3sl_medium_network_restricted_trusted_rate",
1022                         0.0, 0.0, kFullStackTestDurationSecs};
1023   simulcast.ss[0] = {
1024       std::vector<VideoStream>(),  0,    3, -1, InterLayerPredMode::kOnKeyPic,
1025       std::vector<SpatialLayer>(), false};
1026   simulcast.config->link_capacity_kbps = 1000;
1027   simulcast.config->queue_delay_ms = 100;
1028   fixture->RunWithAnalyzer(simulcast);
1029 }
1030 #endif  // !defined(WEBRTC_MAC)
1031 
1032 #endif  // defined(RTC_ENABLE_VP9)
1033 
1034 // Android bots can't handle FullHD, so disable the test.
1035 // TODO(bugs.webrtc.org/9220): Investigate source of flakiness on Mac.
1036 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_MAC)
1037 #define MAYBE_Simulcast_HD_High DISABLED_Simulcast_HD_High
1038 #else
1039 #define MAYBE_Simulcast_HD_High Simulcast_HD_High
1040 #endif
1041 
TEST(FullStackTest,MAYBE_Simulcast_HD_High)1042 TEST(FullStackTest, MAYBE_Simulcast_HD_High) {
1043   auto fixture = CreateVideoQualityTestFixture();
1044   ParamsWithLogging simulcast;
1045   simulcast.call.send_side_bwe = true;
1046   simulcast.video[0] = {true,    1920,  1080,  30,         800000, 2500000,
1047                         2500000, false, "VP8", 3,          2,      400000,
1048                         false,   false, false, "Generator"};
1049   simulcast.analyzer = {"simulcast_HD_high", 0.0, 0.0,
1050                         kFullStackTestDurationSecs};
1051   simulcast.config->loss_percent = 0;
1052   simulcast.config->queue_delay_ms = 100;
1053   std::vector<VideoStream> streams = {
1054       VideoQualityTest::DefaultVideoStream(simulcast, 0),
1055       VideoQualityTest::DefaultVideoStream(simulcast, 0),
1056       VideoQualityTest::DefaultVideoStream(simulcast, 0)};
1057   simulcast.ss[0] = {
1058       streams, 2, 1, 0, InterLayerPredMode::kOn, std::vector<SpatialLayer>(),
1059       true};
1060   webrtc::test::ScopedFieldTrials override_trials(AppendFieldTrials(
1061       "WebRTC-ForceSimulatedOveruseIntervalMs/1000-50000-300/"));
1062   fixture->RunWithAnalyzer(simulcast);
1063 }
1064 
TEST(FullStackTest,Simulcast_Vp8_3sl_High)1065 TEST(FullStackTest, Simulcast_Vp8_3sl_High) {
1066   auto fixture = CreateVideoQualityTestFixture();
1067   ParamsWithLogging simulcast;
1068   simulcast.call.send_side_bwe = true;
1069   simulcast.video[0] = SimulcastVp8VideoHigh();
1070   simulcast.analyzer = {"simulcast_vp8_3sl_high", 0.0, 0.0,
1071                         kFullStackTestDurationSecs};
1072   simulcast.config->loss_percent = 0;
1073   simulcast.config->queue_delay_ms = 100;
1074   ParamsWithLogging video_params_high;
1075   video_params_high.video[0] = SimulcastVp8VideoHigh();
1076   ParamsWithLogging video_params_medium;
1077   video_params_medium.video[0] = SimulcastVp8VideoMedium();
1078   ParamsWithLogging video_params_low;
1079   video_params_low.video[0] = SimulcastVp8VideoLow();
1080 
1081   std::vector<VideoStream> streams = {
1082       VideoQualityTest::DefaultVideoStream(video_params_low, 0),
1083       VideoQualityTest::DefaultVideoStream(video_params_medium, 0),
1084       VideoQualityTest::DefaultVideoStream(video_params_high, 0)};
1085   simulcast.ss[0] = {
1086       streams, 2, 1, 0, InterLayerPredMode::kOn, std::vector<SpatialLayer>(),
1087       false};
1088   fixture->RunWithAnalyzer(simulcast);
1089 }
1090 
TEST(FullStackTest,Simulcast_Vp8_3sl_Low)1091 TEST(FullStackTest, Simulcast_Vp8_3sl_Low) {
1092   auto fixture = CreateVideoQualityTestFixture();
1093   ParamsWithLogging simulcast;
1094   simulcast.call.send_side_bwe = true;
1095   simulcast.video[0] = SimulcastVp8VideoHigh();
1096   simulcast.analyzer = {"simulcast_vp8_3sl_low", 0.0, 0.0,
1097                         kFullStackTestDurationSecs};
1098   simulcast.config->loss_percent = 0;
1099   simulcast.config->queue_delay_ms = 100;
1100   ParamsWithLogging video_params_high;
1101   video_params_high.video[0] = SimulcastVp8VideoHigh();
1102   ParamsWithLogging video_params_medium;
1103   video_params_medium.video[0] = SimulcastVp8VideoMedium();
1104   ParamsWithLogging video_params_low;
1105   video_params_low.video[0] = SimulcastVp8VideoLow();
1106 
1107   std::vector<VideoStream> streams = {
1108       VideoQualityTest::DefaultVideoStream(video_params_low, 0),
1109       VideoQualityTest::DefaultVideoStream(video_params_medium, 0),
1110       VideoQualityTest::DefaultVideoStream(video_params_high, 0)};
1111   simulcast.ss[0] = {
1112       streams, 0, 1, 0, InterLayerPredMode::kOn, std::vector<SpatialLayer>(),
1113       false};
1114   fixture->RunWithAnalyzer(simulcast);
1115 }
1116 
1117 // This test assumes ideal network conditions with target bandwidth being
1118 // available and exercises WebRTC calls with a high target bitrate(100 Mbps).
1119 // Android32 bots can't handle this high bitrate, so disable test for those.
1120 #if defined(WEBRTC_ANDROID)
1121 #define MAYBE_High_Bitrate_With_Fake_Codec DISABLED_High_Bitrate_With_Fake_Codec
1122 #else
1123 #define MAYBE_High_Bitrate_With_Fake_Codec High_Bitrate_With_Fake_Codec
1124 #endif  // defined(WEBRTC_ANDROID)
TEST(FullStackTest,MAYBE_High_Bitrate_With_Fake_Codec)1125 TEST(FullStackTest, MAYBE_High_Bitrate_With_Fake_Codec) {
1126   auto fixture = CreateVideoQualityTestFixture();
1127   const int target_bitrate = 100000000;
1128   ParamsWithLogging generator;
1129   generator.call.send_side_bwe = true;
1130   generator.call.call_bitrate_config.min_bitrate_bps = target_bitrate;
1131   generator.call.call_bitrate_config.start_bitrate_bps = target_bitrate;
1132   generator.call.call_bitrate_config.max_bitrate_bps = target_bitrate;
1133   generator.video[0] = {true,
1134                         360,
1135                         240,
1136                         30,
1137                         target_bitrate / 2,
1138                         target_bitrate,
1139                         target_bitrate * 2,
1140                         false,
1141                         "FakeCodec",
1142                         1,
1143                         0,
1144                         0,
1145                         false,
1146                         false,
1147                         false,
1148                         "Generator"};
1149   generator.analyzer = {"high_bitrate_with_fake_codec", 0.0, 0.0,
1150                         kFullStackTestDurationSecs};
1151   fixture->RunWithAnalyzer(generator);
1152 }
1153 
1154 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
1155 // Fails on mobile devices:
1156 // https://bugs.chromium.org/p/webrtc/issues/detail?id=7301
1157 #define MAYBE_Largeroom_50thumb DISABLED_Largeroom_50thumb
1158 #else
1159 #define MAYBE_Largeroom_50thumb Largeroom_50thumb
1160 #endif
1161 
TEST(FullStackTest,MAYBE_Largeroom_50thumb)1162 TEST(FullStackTest, MAYBE_Largeroom_50thumb) {
1163   auto fixture = CreateVideoQualityTestFixture();
1164   ParamsWithLogging large_room;
1165   large_room.call.send_side_bwe = true;
1166   large_room.video[0] = SimulcastVp8VideoHigh();
1167   large_room.analyzer = {"largeroom_50thumb", 0.0, 0.0,
1168                          kFullStackTestDurationSecs};
1169   large_room.config->loss_percent = 0;
1170   large_room.config->queue_delay_ms = 100;
1171   ParamsWithLogging video_params_high;
1172   video_params_high.video[0] = SimulcastVp8VideoHigh();
1173   ParamsWithLogging video_params_medium;
1174   video_params_medium.video[0] = SimulcastVp8VideoMedium();
1175   ParamsWithLogging video_params_low;
1176   video_params_low.video[0] = SimulcastVp8VideoLow();
1177 
1178   std::vector<VideoStream> streams = {
1179       VideoQualityTest::DefaultVideoStream(video_params_low, 0),
1180       VideoQualityTest::DefaultVideoStream(video_params_medium, 0),
1181       VideoQualityTest::DefaultVideoStream(video_params_high, 0)};
1182   large_room.call.num_thumbnails = 50;
1183   large_room.ss[0] = {
1184       streams, 2, 1, 0, InterLayerPredMode::kOn, std::vector<SpatialLayer>(),
1185       false};
1186   fixture->RunWithAnalyzer(large_room);
1187 }
1188 
1189 }  // namespace webrtc
1190