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