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 "api/media_stream_interface.h"
16 #include "api/test/create_network_emulation_manager.h"
17 #include "api/test/create_peer_connection_quality_test_frame_generator.h"
18 #include "api/test/create_peerconnection_quality_test_fixture.h"
19 #include "api/test/frame_generator_interface.h"
20 #include "api/test/network_emulation_manager.h"
21 #include "api/test/peerconnection_quality_test_fixture.h"
22 #include "api/test/simulated_network.h"
23 #include "api/test/time_controller.h"
24 #include "call/simulated_network.h"
25 #include "media/base/vp9_profile.h"
26 #include "modules/video_coding/codecs/vp9/include/vp9.h"
27 #include "system_wrappers/include/field_trial.h"
28 #include "test/field_trial.h"
29 #include "test/gtest.h"
30 #include "test/pc/e2e/network_quality_metrics_reporter.h"
31 #include "test/testsupport/file_utils.h"
32 
33 namespace webrtc {
34 
35 using PeerConfigurer =
36     webrtc_pc_e2e::PeerConnectionE2EQualityTestFixture::PeerConfigurer;
37 using RunParams = webrtc_pc_e2e::PeerConnectionE2EQualityTestFixture::RunParams;
38 using VideoConfig =
39     webrtc_pc_e2e::PeerConnectionE2EQualityTestFixture::VideoConfig;
40 using AudioConfig =
41     webrtc_pc_e2e::PeerConnectionE2EQualityTestFixture::AudioConfig;
42 using ScreenShareConfig =
43     webrtc_pc_e2e::PeerConnectionE2EQualityTestFixture::ScreenShareConfig;
44 using VideoSimulcastConfig =
45     webrtc_pc_e2e::PeerConnectionE2EQualityTestFixture::VideoSimulcastConfig;
46 using VideoCodecConfig =
47     webrtc_pc_e2e::PeerConnectionE2EQualityTestFixture::VideoCodecConfig;
48 
49 namespace {
50 
51 constexpr int kTestDurationSec = 45;
52 constexpr char kVp8TrustedRateControllerFieldTrial[] =
53     "WebRTC-LibvpxVp8TrustedRateController/Enabled/";
54 
CreateEmulatedNodeWithConfig(NetworkEmulationManager * emulation,const BuiltInNetworkBehaviorConfig & config)55 EmulatedNetworkNode* CreateEmulatedNodeWithConfig(
56     NetworkEmulationManager* emulation,
57     const BuiltInNetworkBehaviorConfig& config) {
58   return emulation->CreateEmulatedNode(
59       std::make_unique<SimulatedNetwork>(config));
60 }
61 
62 std::pair<EmulatedNetworkManagerInterface*, EmulatedNetworkManagerInterface*>
CreateTwoNetworkLinks(NetworkEmulationManager * emulation,const BuiltInNetworkBehaviorConfig & config)63 CreateTwoNetworkLinks(NetworkEmulationManager* emulation,
64                       const BuiltInNetworkBehaviorConfig& config) {
65   auto* alice_node = CreateEmulatedNodeWithConfig(emulation, config);
66   auto* bob_node = CreateEmulatedNodeWithConfig(emulation, config);
67 
68   auto* alice_endpoint = emulation->CreateEndpoint(EmulatedEndpointConfig());
69   auto* bob_endpoint = emulation->CreateEndpoint(EmulatedEndpointConfig());
70 
71   emulation->CreateRoute(alice_endpoint, {alice_node}, bob_endpoint);
72   emulation->CreateRoute(bob_endpoint, {bob_node}, alice_endpoint);
73 
74   return {
75       emulation->CreateEmulatedNetworkManagerInterface({alice_endpoint}),
76       emulation->CreateEmulatedNetworkManagerInterface({bob_endpoint}),
77   };
78 }
79 
80 std::unique_ptr<webrtc_pc_e2e::PeerConnectionE2EQualityTestFixture>
CreateTestFixture(const std::string & test_case_name,TimeController & time_controller,std::pair<EmulatedNetworkManagerInterface *,EmulatedNetworkManagerInterface * > network_links,rtc::FunctionView<void (PeerConfigurer *)> alice_configurer,rtc::FunctionView<void (PeerConfigurer *)> bob_configurer)81 CreateTestFixture(const std::string& test_case_name,
82                   TimeController& time_controller,
83                   std::pair<EmulatedNetworkManagerInterface*,
84                             EmulatedNetworkManagerInterface*> network_links,
85                   rtc::FunctionView<void(PeerConfigurer*)> alice_configurer,
86                   rtc::FunctionView<void(PeerConfigurer*)> bob_configurer) {
87   auto fixture = webrtc_pc_e2e::CreatePeerConnectionE2EQualityTestFixture(
88       test_case_name, time_controller, /*audio_quality_analyzer=*/nullptr,
89       /*video_quality_analyzer=*/nullptr);
90   fixture->AddPeer(network_links.first->network_thread(),
91                    network_links.first->network_manager(), alice_configurer);
92   fixture->AddPeer(network_links.second->network_thread(),
93                    network_links.second->network_manager(), bob_configurer);
94   fixture->AddQualityMetricsReporter(
95       std::make_unique<webrtc_pc_e2e::NetworkQualityMetricsReporter>(
96           network_links.first, network_links.second));
97   return fixture;
98 }
99 
100 // Takes the current active field trials set, and appends some new trials.
AppendFieldTrials(std::string new_trial_string)101 std::string AppendFieldTrials(std::string new_trial_string) {
102   return std::string(field_trial::GetFieldTrialString()) + new_trial_string;
103 }
104 
ClipNameToClipPath(const char * clip_name)105 std::string ClipNameToClipPath(const char* clip_name) {
106   return test::ResourcePath(clip_name, "yuv");
107 }
108 
109 }  // namespace
110 
111 #if defined(RTC_ENABLE_VP9)
TEST(PCFullStackTest,Pc_Foreman_Cif_Net_Delay_0_0_Plr_0_VP9)112 TEST(PCFullStackTest, Pc_Foreman_Cif_Net_Delay_0_0_Plr_0_VP9) {
113   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
114       CreateNetworkEmulationManager();
115   auto fixture = CreateTestFixture(
116       "pc_foreman_cif_net_delay_0_0_plr_0_VP9",
117       *network_emulation_manager->time_controller(),
118       CreateTwoNetworkLinks(network_emulation_manager.get(),
119                             BuiltInNetworkBehaviorConfig()),
120       [](PeerConfigurer* alice) {
121         VideoConfig video(352, 288, 30);
122         video.stream_label = "alice-video";
123         auto frame_generator = CreateFromYuvFileFrameGenerator(
124             video, ClipNameToClipPath("foreman_cif"));
125         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
126       },
127       [](PeerConfigurer* bob) {});
128   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
129   run_params.video_codecs = {VideoCodecConfig(
130       /*name=*/cricket::kVp9CodecName, /*required_params=*/{
131           {kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}})};
132   run_params.use_flex_fec = false;
133   run_params.use_ulp_fec = false;
134   fixture->Run(std::move(run_params));
135 }
136 
TEST(PCGenericDescriptorTest,Pc_Foreman_Cif_Delay_50_0_Plr_5_VP9_Generic_Descriptor)137 TEST(PCGenericDescriptorTest,
138      Pc_Foreman_Cif_Delay_50_0_Plr_5_VP9_Generic_Descriptor) {
139   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
140       CreateNetworkEmulationManager();
141   BuiltInNetworkBehaviorConfig config;
142   config.loss_percent = 5;
143   config.queue_delay_ms = 50;
144   auto fixture = CreateTestFixture(
145       "pc_foreman_cif_delay_50_0_plr_5_VP9_generic_descriptor",
146       *network_emulation_manager->time_controller(),
147       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
148       [](PeerConfigurer* alice) {
149         VideoConfig video(352, 288, 30);
150         video.stream_label = "alice-video";
151         auto frame_generator = CreateFromYuvFileFrameGenerator(
152             video, ClipNameToClipPath("foreman_cif"));
153         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
154       },
155       [](PeerConfigurer* bob) {});
156   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
157   run_params.video_codecs = {VideoCodecConfig(
158       /*name=*/cricket::kVp9CodecName, /*required_params=*/{
159           {kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}})};
160   run_params.use_flex_fec = false;
161   run_params.use_ulp_fec = false;
162   fixture->Run(std::move(run_params));
163 }
164 
165 // VP9 2nd profile isn't supported on android arm and arm 64.
166 #if (defined(WEBRTC_ANDROID) &&                                   \
167      (defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM))) || \
168     (defined(WEBRTC_IOS) && defined(WEBRTC_ARCH_ARM64))
169 #define MAYBE_Pc_Generator_Net_Delay_0_0_Plr_0_VP9Profile2 \
170   DISABLED_Pc_Generator_Net_Delay_0_0_Plr_0_VP9Profile2
171 #else
172 #define MAYBE_Pc_Generator_Net_Delay_0_0_Plr_0_VP9Profile2 \
173   Pc_Generator_Net_Delay_0_0_Plr_0_VP9Profile2
174 #endif
TEST(PCFullStackTest,MAYBE_Pc_Generator_Net_Delay_0_0_Plr_0_VP9Profile2)175 TEST(PCFullStackTest, MAYBE_Pc_Generator_Net_Delay_0_0_Plr_0_VP9Profile2) {
176   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
177       CreateNetworkEmulationManager();
178   auto fixture = CreateTestFixture(
179       "pc_generator_net_delay_0_0_plr_0_VP9Profile2",
180       *network_emulation_manager->time_controller(),
181       CreateTwoNetworkLinks(network_emulation_manager.get(),
182                             BuiltInNetworkBehaviorConfig()),
183       [](PeerConfigurer* alice) {
184         VideoConfig video(352, 288, 30);
185         video.stream_label = "alice-video";
186         auto frame_generator = CreateSquareFrameGenerator(
187             video, test::FrameGeneratorInterface::OutputType::kI010);
188         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
189       },
190       [](PeerConfigurer* bob) {});
191   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
192   run_params.video_codecs = {VideoCodecConfig(
193       /*name=*/cricket::kVp9CodecName, /*required_params=*/{
194           {kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile2)}})};
195   run_params.use_flex_fec = false;
196   run_params.use_ulp_fec = false;
197   fixture->Run(std::move(run_params));
198 }
199 
200 /*
201 // TODO(bugs.webrtc.org/10639) migrate commented out test, when required
202 // functionality will be supported in PeerConnection level framework.
203 TEST(PCFullStackTest, ForemanCifWithoutPacketLossMultiplexI420Frame) {
204   auto fixture = CreateVideoQualityTestFixture();
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       "multiplex", 1,      0,      0,
211       false,       false,  false,  ClipNameToClipPath("foreman_cif")};
212   foreman_cif.analyzer = {"foreman_cif_net_delay_0_0_plr_0_Multiplex", 0.0, 0.0,
213                           kTestDurationSec};
214   fixture->RunWithAnalyzer(foreman_cif);
215 }
216 
217 TEST(PCFullStackTest, GeneratorWithoutPacketLossMultiplexI420AFrame) {
218   auto fixture = CreateVideoQualityTestFixture();
219 
220   ParamsWithLogging generator;
221   generator.call.send_side_bwe = true;
222   generator.video[0] = {
223       true,        352, 288, 30, 700000, 700000, 700000, false,
224       "multiplex", 1,   0,   0,  false,  false,  false,  "GeneratorI420A"};
225   generator.analyzer = {"generator_net_delay_0_0_plr_0_Multiplex", 0.0, 0.0,
226                         kTestDurationSec};
227   fixture->RunWithAnalyzer(generator);
228 }
229 */
230 #endif  // defined(RTC_ENABLE_VP9)
231 
TEST(PCFullStackTest,Pc_Net_Delay_0_0_Plr_0)232 TEST(PCFullStackTest, Pc_Net_Delay_0_0_Plr_0) {
233   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
234       CreateNetworkEmulationManager();
235   auto fixture = CreateTestFixture(
236       "pc_net_delay_0_0_plr_0", *network_emulation_manager->time_controller(),
237       CreateTwoNetworkLinks(network_emulation_manager.get(),
238                             BuiltInNetworkBehaviorConfig()),
239       [](PeerConfigurer* alice) {
240         VideoConfig video(176, 144, 30);
241         video.stream_label = "alice-video";
242         auto frame_generator = CreateFromYuvFileFrameGenerator(
243             video, ClipNameToClipPath("paris_qcif"));
244         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
245       },
246       [](PeerConfigurer* bob) {});
247   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
248   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
249   run_params.use_flex_fec = false;
250   run_params.use_ulp_fec = false;
251   fixture->Run(std::move(run_params));
252 }
253 
TEST(PCGenericDescriptorTest,Pc_Foreman_Cif_Net_Delay_0_0_Plr_0_Generic_Descriptor)254 TEST(PCGenericDescriptorTest,
255      Pc_Foreman_Cif_Net_Delay_0_0_Plr_0_Generic_Descriptor) {
256   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
257       CreateNetworkEmulationManager();
258   auto fixture = CreateTestFixture(
259       "pc_foreman_cif_net_delay_0_0_plr_0_generic_descriptor",
260       *network_emulation_manager->time_controller(),
261       CreateTwoNetworkLinks(network_emulation_manager.get(),
262                             BuiltInNetworkBehaviorConfig()),
263       [](PeerConfigurer* alice) {
264         VideoConfig video(352, 288, 30);
265         video.stream_label = "alice-video";
266         auto frame_generator = CreateFromYuvFileFrameGenerator(
267             video, ClipNameToClipPath("foreman_cif"));
268         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
269       },
270       [](PeerConfigurer* bob) {});
271   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
272   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
273   run_params.use_flex_fec = false;
274   run_params.use_ulp_fec = false;
275   fixture->Run(std::move(run_params));
276 }
277 
TEST(PCGenericDescriptorTest,Pc_Foreman_Cif_30kbps_Net_Delay_0_0_Plr_0_Generic_Descriptor)278 TEST(PCGenericDescriptorTest,
279      Pc_Foreman_Cif_30kbps_Net_Delay_0_0_Plr_0_Generic_Descriptor) {
280   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
281       CreateNetworkEmulationManager();
282   BuiltInNetworkBehaviorConfig config;
283   auto fixture = CreateTestFixture(
284       "pc_foreman_cif_30kbps_net_delay_0_0_plr_0_generic_descriptor",
285       *network_emulation_manager->time_controller(),
286       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
287       [](PeerConfigurer* alice) {
288         VideoConfig video(352, 288, 10);
289         video.stream_label = "alice-video";
290         auto frame_generator = CreateFromYuvFileFrameGenerator(
291             video, ClipNameToClipPath("foreman_cif"));
292         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
293 
294         BitrateSettings bitrate_settings;
295         bitrate_settings.min_bitrate_bps = 30000;
296         bitrate_settings.start_bitrate_bps = 30000;
297         bitrate_settings.max_bitrate_bps = 30000;
298         alice->SetBitrateSettings(bitrate_settings);
299       },
300       [](PeerConfigurer* bob) {});
301   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
302   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
303   run_params.use_flex_fec = false;
304   run_params.use_ulp_fec = false;
305   fixture->Run(std::move(run_params));
306 }
307 
308 // TODO(webrtc:9722): Remove when experiment is cleaned up.
TEST(PCGenericDescriptorTest,Pc_Foreman_Cif_30kbps_Net_Delay_0_0_Plr_0_Trusted_Rate_Ctrl)309 TEST(PCGenericDescriptorTest,
310      Pc_Foreman_Cif_30kbps_Net_Delay_0_0_Plr_0_Trusted_Rate_Ctrl) {
311   test::ScopedFieldTrials override_field_trials(
312       AppendFieldTrials(kVp8TrustedRateControllerFieldTrial));
313   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
314       CreateNetworkEmulationManager();
315   BuiltInNetworkBehaviorConfig config;
316   auto fixture = CreateTestFixture(
317       "pc_foreman_cif_30kbps_net_delay_0_0_plr_0_trusted_rate_ctrl_generic_"
318       "descriptor",
319       *network_emulation_manager->time_controller(),
320       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
321       [](PeerConfigurer* alice) {
322         VideoConfig video(352, 288, 10);
323         video.stream_label = "alice-video";
324         auto frame_generator = CreateFromYuvFileFrameGenerator(
325             video, ClipNameToClipPath("foreman_cif"));
326         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
327 
328         BitrateSettings bitrate_settings;
329         bitrate_settings.min_bitrate_bps = 30000;
330         bitrate_settings.start_bitrate_bps = 30000;
331         bitrate_settings.max_bitrate_bps = 30000;
332         alice->SetBitrateSettings(bitrate_settings);
333       },
334       [](PeerConfigurer* bob) {});
335   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
336   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
337   run_params.use_flex_fec = false;
338   run_params.use_ulp_fec = false;
339   fixture->Run(std::move(run_params));
340 }
341 
342 // Link capacity below default start rate.
TEST(PCFullStackTest,Pc_Foreman_Cif_Link_150kbps_Net_Delay_0_0_Plr_0)343 TEST(PCFullStackTest, Pc_Foreman_Cif_Link_150kbps_Net_Delay_0_0_Plr_0) {
344   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
345       CreateNetworkEmulationManager();
346   BuiltInNetworkBehaviorConfig config;
347   config.link_capacity_kbps = 150;
348   auto fixture = CreateTestFixture(
349       "pc_foreman_cif_link_150kbps_net_delay_0_0_plr_0",
350       *network_emulation_manager->time_controller(),
351       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
352       [](PeerConfigurer* alice) {
353         VideoConfig video(352, 288, 30);
354         video.stream_label = "alice-video";
355         auto frame_generator = CreateFromYuvFileFrameGenerator(
356             video, ClipNameToClipPath("foreman_cif"));
357         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
358       },
359       [](PeerConfigurer* bob) {});
360   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
361   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
362   run_params.use_flex_fec = false;
363   run_params.use_ulp_fec = false;
364   fixture->Run(std::move(run_params));
365 }
366 
TEST(PCFullStackTest,Pc_Foreman_Cif_Link_130kbps_Delay100ms_Loss1_Ulpfec)367 TEST(PCFullStackTest, Pc_Foreman_Cif_Link_130kbps_Delay100ms_Loss1_Ulpfec) {
368   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
369       CreateNetworkEmulationManager();
370   BuiltInNetworkBehaviorConfig config;
371   config.link_capacity_kbps = 130;
372   config.queue_delay_ms = 100;
373   config.loss_percent = 1;
374   auto fixture = CreateTestFixture(
375       "pc_foreman_cif_link_130kbps_delay100ms_loss1_ulpfec",
376       *network_emulation_manager->time_controller(),
377       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
378       [](PeerConfigurer* alice) {
379         VideoConfig video(352, 288, 30);
380         video.stream_label = "alice-video";
381         auto frame_generator = CreateFromYuvFileFrameGenerator(
382             video, ClipNameToClipPath("foreman_cif"));
383         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
384       },
385       [](PeerConfigurer* bob) {});
386   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
387   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
388   run_params.use_flex_fec = false;
389   run_params.use_ulp_fec = true;
390   fixture->Run(std::move(run_params));
391 }
392 
TEST(PCFullStackTest,Pc_Foreman_Cif_Link_50kbps_Delay100ms_Loss1_Ulpfec)393 TEST(PCFullStackTest, Pc_Foreman_Cif_Link_50kbps_Delay100ms_Loss1_Ulpfec) {
394   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
395       CreateNetworkEmulationManager();
396   BuiltInNetworkBehaviorConfig config;
397   config.link_capacity_kbps = 50;
398   config.queue_delay_ms = 100;
399   config.loss_percent = 1;
400   auto fixture = CreateTestFixture(
401       "pc_foreman_cif_link_50kbps_delay100ms_loss1_ulpfec",
402       *network_emulation_manager->time_controller(),
403       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
404       [](PeerConfigurer* alice) {
405         VideoConfig video(352, 288, 30);
406         video.stream_label = "alice-video";
407         auto frame_generator = CreateFromYuvFileFrameGenerator(
408             video, ClipNameToClipPath("foreman_cif"));
409         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
410       },
411       [](PeerConfigurer* bob) {});
412   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
413   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
414   run_params.use_flex_fec = false;
415   run_params.use_ulp_fec = true;
416   fixture->Run(std::move(run_params));
417 }
418 
419 // Restricted network and encoder overproducing by 30%.
TEST(PCFullStackTest,Pc_Foreman_Cif_Link_150kbps_Delay100ms_30pkts_Queue_Overshoot30)420 TEST(PCFullStackTest,
421      Pc_Foreman_Cif_Link_150kbps_Delay100ms_30pkts_Queue_Overshoot30) {
422   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
423       CreateNetworkEmulationManager();
424   BuiltInNetworkBehaviorConfig config;
425   config.link_capacity_kbps = 150;
426   config.queue_length_packets = 30;
427   config.queue_delay_ms = 100;
428   auto fixture = CreateTestFixture(
429       "pc_foreman_cif_link_150kbps_delay100ms_30pkts_queue_overshoot30",
430       *network_emulation_manager->time_controller(),
431       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
432       [](PeerConfigurer* alice) {
433         VideoConfig video(352, 288, 30);
434         video.stream_label = "alice-video";
435         auto frame_generator = CreateFromYuvFileFrameGenerator(
436             video, ClipNameToClipPath("foreman_cif"));
437         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
438       },
439       [](PeerConfigurer* bob) {});
440   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
441   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
442   run_params.use_flex_fec = false;
443   run_params.use_ulp_fec = false;
444   run_params.video_encoder_bitrate_multiplier = 1.30;
445   fixture->Run(std::move(run_params));
446 }
447 
448 // Weak 3G-style link: 250kbps, 1% loss, 100ms delay, 15 packets queue.
449 // Packet rate and loss are low enough that loss will happen with ~3s interval.
450 // This triggers protection overhead to toggle between zero and non-zero.
451 // Link queue is restrictive enough to trigger loss on probes.
TEST(PCFullStackTest,Pc_Foreman_Cif_Link_250kbps_Delay100ms_10pkts_Loss1)452 TEST(PCFullStackTest, Pc_Foreman_Cif_Link_250kbps_Delay100ms_10pkts_Loss1) {
453   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
454       CreateNetworkEmulationManager();
455   BuiltInNetworkBehaviorConfig config;
456   config.link_capacity_kbps = 250;
457   config.queue_length_packets = 10;
458   config.queue_delay_ms = 100;
459   config.loss_percent = 1;
460   auto fixture = CreateTestFixture(
461       "pc_foreman_cif_link_250kbps_delay100ms_10pkts_loss1",
462       *network_emulation_manager->time_controller(),
463       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
464       [](PeerConfigurer* alice) {
465         VideoConfig video(352, 288, 30);
466         video.stream_label = "alice-video";
467         auto frame_generator = CreateFromYuvFileFrameGenerator(
468             video, ClipNameToClipPath("foreman_cif"));
469         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
470       },
471       [](PeerConfigurer* bob) {});
472   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
473   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
474   run_params.use_flex_fec = false;
475   run_params.use_ulp_fec = false;
476   run_params.video_encoder_bitrate_multiplier = 1.30;
477   fixture->Run(std::move(run_params));
478 }
479 
TEST(PCGenericDescriptorTest,Pc_Foreman_Cif_Delay_50_0_Plr_5_Generic_Descriptor)480 TEST(PCGenericDescriptorTest,
481      Pc_Foreman_Cif_Delay_50_0_Plr_5_Generic_Descriptor) {
482   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
483       CreateNetworkEmulationManager();
484   BuiltInNetworkBehaviorConfig config;
485   config.loss_percent = 5;
486   config.queue_delay_ms = 50;
487   auto fixture = CreateTestFixture(
488       "pc_foreman_cif_delay_50_0_plr_5_generic_descriptor",
489       *network_emulation_manager->time_controller(),
490       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
491       [](PeerConfigurer* alice) {
492         VideoConfig video(352, 288, 30);
493         video.stream_label = "alice-video";
494         auto frame_generator = CreateFromYuvFileFrameGenerator(
495             video, ClipNameToClipPath("foreman_cif"));
496         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
497       },
498       [](PeerConfigurer* bob) {});
499   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
500   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
501   run_params.use_flex_fec = false;
502   run_params.use_ulp_fec = false;
503   fixture->Run(std::move(run_params));
504 }
505 
TEST(PCGenericDescriptorTest,Pc_Foreman_Cif_Delay_50_0_Plr_5_Ulpfec_Generic_Descriptor)506 TEST(PCGenericDescriptorTest,
507      Pc_Foreman_Cif_Delay_50_0_Plr_5_Ulpfec_Generic_Descriptor) {
508   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
509       CreateNetworkEmulationManager();
510   BuiltInNetworkBehaviorConfig config;
511   config.loss_percent = 5;
512   config.queue_delay_ms = 50;
513   auto fixture = CreateTestFixture(
514       "pc_foreman_cif_delay_50_0_plr_5_ulpfec_generic_descriptor",
515       *network_emulation_manager->time_controller(),
516       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
517       [](PeerConfigurer* alice) {
518         VideoConfig video(352, 288, 30);
519         video.stream_label = "alice-video";
520         auto frame_generator = CreateFromYuvFileFrameGenerator(
521             video, ClipNameToClipPath("foreman_cif"));
522         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
523       },
524       [](PeerConfigurer* bob) {});
525   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
526   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
527   run_params.use_flex_fec = false;
528   run_params.use_ulp_fec = true;
529   fixture->Run(std::move(run_params));
530 }
531 
TEST(PCFullStackTest,Pc_Foreman_Cif_Delay_50_0_Plr_5_Flexfec)532 TEST(PCFullStackTest, Pc_Foreman_Cif_Delay_50_0_Plr_5_Flexfec) {
533   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
534       CreateNetworkEmulationManager();
535   BuiltInNetworkBehaviorConfig config;
536   config.loss_percent = 5;
537   config.queue_delay_ms = 50;
538   auto fixture = CreateTestFixture(
539       "pc_foreman_cif_delay_50_0_plr_5_flexfec",
540       *network_emulation_manager->time_controller(),
541       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
542       [](PeerConfigurer* alice) {
543         VideoConfig video(352, 288, 30);
544         video.stream_label = "alice-video";
545         auto frame_generator = CreateFromYuvFileFrameGenerator(
546             video, ClipNameToClipPath("foreman_cif"));
547         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
548       },
549       [](PeerConfigurer* bob) {});
550   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
551   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
552   run_params.use_flex_fec = true;
553   run_params.use_ulp_fec = false;
554   fixture->Run(std::move(run_params));
555 }
556 
TEST(PCFullStackTest,Pc_Foreman_Cif_500kbps_Delay_50_0_Plr_3_Flexfec)557 TEST(PCFullStackTest, Pc_Foreman_Cif_500kbps_Delay_50_0_Plr_3_Flexfec) {
558   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
559       CreateNetworkEmulationManager();
560   BuiltInNetworkBehaviorConfig config;
561   config.loss_percent = 3;
562   config.link_capacity_kbps = 500;
563   config.queue_delay_ms = 50;
564   auto fixture = CreateTestFixture(
565       "pc_foreman_cif_500kbps_delay_50_0_plr_3_flexfec",
566       *network_emulation_manager->time_controller(),
567       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
568       [](PeerConfigurer* alice) {
569         VideoConfig video(352, 288, 30);
570         video.stream_label = "alice-video";
571         auto frame_generator = CreateFromYuvFileFrameGenerator(
572             video, ClipNameToClipPath("foreman_cif"));
573         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
574       },
575       [](PeerConfigurer* bob) {});
576   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
577   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
578   run_params.use_flex_fec = true;
579   run_params.use_ulp_fec = false;
580   fixture->Run(std::move(run_params));
581 }
582 
TEST(PCFullStackTest,Pc_Foreman_Cif_500kbps_Delay_50_0_Plr_3_Ulpfec)583 TEST(PCFullStackTest, Pc_Foreman_Cif_500kbps_Delay_50_0_Plr_3_Ulpfec) {
584   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
585       CreateNetworkEmulationManager();
586   BuiltInNetworkBehaviorConfig config;
587   config.loss_percent = 3;
588   config.link_capacity_kbps = 500;
589   config.queue_delay_ms = 50;
590   auto fixture = CreateTestFixture(
591       "pc_foreman_cif_500kbps_delay_50_0_plr_3_ulpfec",
592       *network_emulation_manager->time_controller(),
593       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
594       [](PeerConfigurer* alice) {
595         VideoConfig video(352, 288, 30);
596         video.stream_label = "alice-video";
597         auto frame_generator = CreateFromYuvFileFrameGenerator(
598             video, ClipNameToClipPath("foreman_cif"));
599         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
600       },
601       [](PeerConfigurer* bob) {});
602   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
603   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
604   run_params.use_flex_fec = false;
605   run_params.use_ulp_fec = true;
606   fixture->Run(std::move(run_params));
607 }
608 
609 #if defined(WEBRTC_USE_H264)
TEST(PCFullStackTest,Pc_Foreman_Cif_Net_Delay_0_0_Plr_0_H264)610 TEST(PCFullStackTest, Pc_Foreman_Cif_Net_Delay_0_0_Plr_0_H264) {
611   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
612       CreateNetworkEmulationManager();
613   auto fixture = CreateTestFixture(
614       "pc_foreman_cif_net_delay_0_0_plr_0_H264",
615       *network_emulation_manager->time_controller(),
616       CreateTwoNetworkLinks(network_emulation_manager.get(),
617                             BuiltInNetworkBehaviorConfig()),
618       [](PeerConfigurer* alice) {
619         VideoConfig video(352, 288, 30);
620         video.stream_label = "alice-video";
621         auto frame_generator = CreateFromYuvFileFrameGenerator(
622             video, ClipNameToClipPath("foreman_cif"));
623         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
624       },
625       [](PeerConfigurer* bob) {});
626   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
627   run_params.video_codecs = {VideoCodecConfig(cricket::kH264CodecName)};
628   run_params.use_flex_fec = false;
629   run_params.use_ulp_fec = false;
630   fixture->Run(std::move(run_params));
631 }
632 
TEST(PCFullStackTest,Pc_Foreman_Cif_30kbps_Net_Delay_0_0_Plr_0_H264)633 TEST(PCFullStackTest, Pc_Foreman_Cif_30kbps_Net_Delay_0_0_Plr_0_H264) {
634   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
635       CreateNetworkEmulationManager();
636   BuiltInNetworkBehaviorConfig config;
637   auto fixture = CreateTestFixture(
638       "pc_foreman_cif_30kbps_net_delay_0_0_plr_0_H264",
639       *network_emulation_manager->time_controller(),
640       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
641       [](PeerConfigurer* alice) {
642         VideoConfig video(352, 288, 10);
643         video.stream_label = "alice-video";
644         auto frame_generator = CreateFromYuvFileFrameGenerator(
645             video, ClipNameToClipPath("foreman_cif"));
646         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
647 
648         BitrateSettings bitrate_settings;
649         bitrate_settings.min_bitrate_bps = 30000;
650         bitrate_settings.start_bitrate_bps = 30000;
651         bitrate_settings.max_bitrate_bps = 30000;
652         alice->SetBitrateSettings(bitrate_settings);
653       },
654       [](PeerConfigurer* bob) {});
655   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
656   run_params.video_codecs = {VideoCodecConfig(cricket::kH264CodecName)};
657   run_params.use_flex_fec = false;
658   run_params.use_ulp_fec = false;
659   fixture->Run(std::move(run_params));
660 }
661 
TEST(PCGenericDescriptorTest,Pc_Foreman_Cif_Delay_50_0_Plr_5_H264_Generic_Descriptor)662 TEST(PCGenericDescriptorTest,
663      Pc_Foreman_Cif_Delay_50_0_Plr_5_H264_Generic_Descriptor) {
664   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
665       CreateNetworkEmulationManager();
666   BuiltInNetworkBehaviorConfig config;
667   config.loss_percent = 5;
668   config.queue_delay_ms = 50;
669   auto fixture = CreateTestFixture(
670       "pc_foreman_cif_delay_50_0_plr_5_H264_generic_descriptor",
671       *network_emulation_manager->time_controller(),
672       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
673       [](PeerConfigurer* alice) {
674         VideoConfig video(352, 288, 30);
675         video.stream_label = "alice-video";
676         auto frame_generator = CreateFromYuvFileFrameGenerator(
677             video, ClipNameToClipPath("foreman_cif"));
678         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
679       },
680       [](PeerConfigurer* bob) {});
681   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
682   run_params.video_codecs = {VideoCodecConfig(cricket::kH264CodecName)};
683   run_params.use_flex_fec = false;
684   run_params.use_ulp_fec = false;
685   fixture->Run(std::move(run_params));
686 }
687 
TEST(PCFullStackTest,Pc_Foreman_Cif_Delay_50_0_Plr_5_H264_Sps_Pps_Idr)688 TEST(PCFullStackTest, Pc_Foreman_Cif_Delay_50_0_Plr_5_H264_Sps_Pps_Idr) {
689   test::ScopedFieldTrials override_field_trials(
690       AppendFieldTrials("WebRTC-SpsPpsIdrIsH264Keyframe/Enabled/"));
691 
692   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
693       CreateNetworkEmulationManager();
694   BuiltInNetworkBehaviorConfig config;
695   config.loss_percent = 5;
696   config.queue_delay_ms = 50;
697   auto fixture = CreateTestFixture(
698       "pc_foreman_cif_delay_50_0_plr_5_H264_sps_pps_idr",
699       *network_emulation_manager->time_controller(),
700       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
701       [](PeerConfigurer* alice) {
702         VideoConfig video(352, 288, 30);
703         video.stream_label = "alice-video";
704         auto frame_generator = CreateFromYuvFileFrameGenerator(
705             video, ClipNameToClipPath("foreman_cif"));
706         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
707       },
708       [](PeerConfigurer* bob) {});
709   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
710   run_params.video_codecs = {VideoCodecConfig(cricket::kH264CodecName)};
711   run_params.use_flex_fec = false;
712   run_params.use_ulp_fec = false;
713   fixture->Run(std::move(run_params));
714 }
715 
TEST(PCFullStackTest,Pc_Foreman_Cif_Delay_50_0_Plr_5_H264_Flexfec)716 TEST(PCFullStackTest, Pc_Foreman_Cif_Delay_50_0_Plr_5_H264_Flexfec) {
717   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
718       CreateNetworkEmulationManager();
719   BuiltInNetworkBehaviorConfig config;
720   config.loss_percent = 5;
721   config.queue_delay_ms = 50;
722   auto fixture = CreateTestFixture(
723       "pc_foreman_cif_delay_50_0_plr_5_H264_flexfec",
724       *network_emulation_manager->time_controller(),
725       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
726       [](PeerConfigurer* alice) {
727         VideoConfig video(352, 288, 30);
728         video.stream_label = "alice-video";
729         auto frame_generator = CreateFromYuvFileFrameGenerator(
730             video, ClipNameToClipPath("foreman_cif"));
731         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
732       },
733       [](PeerConfigurer* bob) {});
734   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
735   run_params.video_codecs = {VideoCodecConfig(cricket::kH264CodecName)};
736   run_params.use_flex_fec = true;
737   run_params.use_ulp_fec = false;
738   fixture->Run(std::move(run_params));
739 }
740 
741 // Ulpfec with H264 is an unsupported combination, so this test is only useful
742 // for debugging. It is therefore disabled by default.
TEST(PCFullStackTest,DISABLED_Pc_Foreman_Cif_Delay_50_0_Plr_5_H264_Ulpfec)743 TEST(PCFullStackTest, DISABLED_Pc_Foreman_Cif_Delay_50_0_Plr_5_H264_Ulpfec) {
744   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
745       CreateNetworkEmulationManager();
746   BuiltInNetworkBehaviorConfig config;
747   config.loss_percent = 5;
748   config.queue_delay_ms = 50;
749   auto fixture = CreateTestFixture(
750       "pc_foreman_cif_delay_50_0_plr_5_H264_ulpfec",
751       *network_emulation_manager->time_controller(),
752       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
753       [](PeerConfigurer* alice) {
754         VideoConfig video(352, 288, 30);
755         video.stream_label = "alice-video";
756         auto frame_generator = CreateFromYuvFileFrameGenerator(
757             video, ClipNameToClipPath("foreman_cif"));
758         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
759       },
760       [](PeerConfigurer* bob) {});
761   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
762   run_params.video_codecs = {VideoCodecConfig(cricket::kH264CodecName)};
763   run_params.use_flex_fec = false;
764   run_params.use_ulp_fec = true;
765   fixture->Run(std::move(run_params));
766 }
767 #endif  // defined(WEBRTC_USE_H264)
768 
TEST(PCFullStackTest,Pc_Foreman_Cif_500kbps)769 TEST(PCFullStackTest, Pc_Foreman_Cif_500kbps) {
770   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
771       CreateNetworkEmulationManager();
772   BuiltInNetworkBehaviorConfig config;
773   config.queue_length_packets = 0;
774   config.queue_delay_ms = 0;
775   config.link_capacity_kbps = 500;
776   auto fixture = CreateTestFixture(
777       "pc_foreman_cif_500kbps", *network_emulation_manager->time_controller(),
778       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
779       [](PeerConfigurer* alice) {
780         VideoConfig video(352, 288, 30);
781         video.stream_label = "alice-video";
782         auto frame_generator = CreateFromYuvFileFrameGenerator(
783             video, ClipNameToClipPath("foreman_cif"));
784         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
785       },
786       [](PeerConfigurer* bob) {});
787   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
788   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
789   run_params.use_flex_fec = false;
790   run_params.use_ulp_fec = false;
791   fixture->Run(std::move(run_params));
792 }
793 
TEST(PCFullStackTest,Pc_Foreman_Cif_500kbps_32pkts_Queue)794 TEST(PCFullStackTest, Pc_Foreman_Cif_500kbps_32pkts_Queue) {
795   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
796       CreateNetworkEmulationManager();
797   BuiltInNetworkBehaviorConfig config;
798   config.queue_length_packets = 32;
799   config.queue_delay_ms = 0;
800   config.link_capacity_kbps = 500;
801   auto fixture = CreateTestFixture(
802       "pc_foreman_cif_500kbps_32pkts_queue",
803       *network_emulation_manager->time_controller(),
804       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
805       [](PeerConfigurer* alice) {
806         VideoConfig video(352, 288, 30);
807         video.stream_label = "alice-video";
808         auto frame_generator = CreateFromYuvFileFrameGenerator(
809             video, ClipNameToClipPath("foreman_cif"));
810         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
811       },
812       [](PeerConfigurer* bob) {});
813   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
814   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
815   run_params.use_flex_fec = false;
816   run_params.use_ulp_fec = false;
817   fixture->Run(std::move(run_params));
818 }
819 
TEST(PCFullStackTest,Pc_Foreman_Cif_500kbps_100ms)820 TEST(PCFullStackTest, Pc_Foreman_Cif_500kbps_100ms) {
821   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
822       CreateNetworkEmulationManager();
823   BuiltInNetworkBehaviorConfig config;
824   config.queue_length_packets = 0;
825   config.queue_delay_ms = 100;
826   config.link_capacity_kbps = 500;
827   auto fixture = CreateTestFixture(
828       "pc_foreman_cif_500kbps_100ms",
829       *network_emulation_manager->time_controller(),
830       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
831       [](PeerConfigurer* alice) {
832         VideoConfig video(352, 288, 30);
833         video.stream_label = "alice-video";
834         auto frame_generator = CreateFromYuvFileFrameGenerator(
835             video, ClipNameToClipPath("foreman_cif"));
836         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
837       },
838       [](PeerConfigurer* bob) {});
839   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
840   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
841   run_params.use_flex_fec = false;
842   run_params.use_ulp_fec = false;
843   fixture->Run(std::move(run_params));
844 }
845 
TEST(PCGenericDescriptorTest,Pc_Foreman_Cif_500kbps_100ms_32pkts_Queue_Generic_Descriptor)846 TEST(PCGenericDescriptorTest,
847      Pc_Foreman_Cif_500kbps_100ms_32pkts_Queue_Generic_Descriptor) {
848   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
849       CreateNetworkEmulationManager();
850   BuiltInNetworkBehaviorConfig config;
851   config.queue_length_packets = 32;
852   config.queue_delay_ms = 100;
853   config.link_capacity_kbps = 500;
854   auto fixture = CreateTestFixture(
855       "pc_foreman_cif_500kbps_100ms_32pkts_queue_generic_descriptor",
856       *network_emulation_manager->time_controller(),
857       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
858       [](PeerConfigurer* alice) {
859         VideoConfig video(352, 288, 30);
860         video.stream_label = "alice-video";
861         auto frame_generator = CreateFromYuvFileFrameGenerator(
862             video, ClipNameToClipPath("foreman_cif"));
863         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
864       },
865       [](PeerConfigurer* bob) {});
866   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
867   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
868   run_params.use_flex_fec = false;
869   run_params.use_ulp_fec = false;
870   fixture->Run(std::move(run_params));
871 }
872 
873 /*
874 // TODO(bugs.webrtc.org/10639) we need to disable send side bwe, but it isn't
875 // supported in PC level framework.
876 TEST(PCFullStackTest, ForemanCif500kbps100msLimitedQueueRecvBwe) {
877   auto fixture = CreateVideoQualityTestFixture();
878   ParamsWithLogging foreman_cif;
879   foreman_cif.call.send_side_bwe = false;
880   foreman_cif.video[0] = {
881       true,  352,    288,     30,
882       30000, 500000, 2000000, false,
883       "VP8", 1,      0,       0,
884       false, false,  true,    ClipNameToClipPath("foreman_cif")};
885   foreman_cif.analyzer = {"foreman_cif_500kbps_100ms_32pkts_queue_recv_bwe",
886                           0.0, 0.0, kTestDurationSec};
887   foreman_cif.config->queue_length_packets = 32;
888   foreman_cif.config->queue_delay_ms = 100;
889   foreman_cif.config->link_capacity_kbps = 500;
890   fixture->RunWithAnalyzer(foreman_cif);
891 }
892 */
893 
TEST(PCFullStackTest,Pc_Foreman_Cif_1000kbps_100ms_32pkts_Queue)894 TEST(PCFullStackTest, Pc_Foreman_Cif_1000kbps_100ms_32pkts_Queue) {
895   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
896       CreateNetworkEmulationManager();
897   BuiltInNetworkBehaviorConfig config;
898   config.queue_length_packets = 32;
899   config.queue_delay_ms = 100;
900   config.link_capacity_kbps = 1000;
901   auto fixture = CreateTestFixture(
902       "pc_foreman_cif_1000kbps_100ms_32pkts_queue",
903       *network_emulation_manager->time_controller(),
904       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
905       [](PeerConfigurer* alice) {
906         VideoConfig video(352, 288, 30);
907         video.stream_label = "alice-video";
908         auto frame_generator = CreateFromYuvFileFrameGenerator(
909             video, ClipNameToClipPath("foreman_cif"));
910         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
911       },
912       [](PeerConfigurer* bob) {});
913   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
914   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
915   run_params.use_flex_fec = false;
916   run_params.use_ulp_fec = false;
917   fixture->Run(std::move(run_params));
918 }
919 
920 // TODO(sprang): Remove this if we have the similar ModerateLimits below?
TEST(PCFullStackTest,Pc_Conference_Motion_Hd_2000kbps_100ms_32pkts_Queue)921 TEST(PCFullStackTest, Pc_Conference_Motion_Hd_2000kbps_100ms_32pkts_Queue) {
922   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
923       CreateNetworkEmulationManager();
924   BuiltInNetworkBehaviorConfig config;
925   config.queue_length_packets = 32;
926   config.queue_delay_ms = 100;
927   config.link_capacity_kbps = 2000;
928   auto fixture = CreateTestFixture(
929       "pc_conference_motion_hd_2000kbps_100ms_32pkts_queue",
930       *network_emulation_manager->time_controller(),
931       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
932       [](PeerConfigurer* alice) {
933         VideoConfig video(1280, 720, 50);
934         video.stream_label = "alice-video";
935         auto frame_generator = CreateFromYuvFileFrameGenerator(
936             video, ClipNameToClipPath("ConferenceMotion_1280_720_50"));
937         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
938       },
939       [](PeerConfigurer* bob) {});
940   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
941   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
942   run_params.use_flex_fec = false;
943   run_params.use_ulp_fec = false;
944   fixture->Run(std::move(run_params));
945 }
946 
947 // TODO(webrtc:9722): Remove when experiment is cleaned up.
TEST(PCFullStackTest,Pc_Conference_Motion_Hd_1tl_Moderate_Limits_Trusted_Rate_Ctrl)948 TEST(PCFullStackTest,
949      Pc_Conference_Motion_Hd_1tl_Moderate_Limits_Trusted_Rate_Ctrl) {
950   test::ScopedFieldTrials override_field_trials(
951       AppendFieldTrials(kVp8TrustedRateControllerFieldTrial));
952   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
953       CreateNetworkEmulationManager();
954   BuiltInNetworkBehaviorConfig config;
955   config.queue_length_packets = 50;
956   config.loss_percent = 3;
957   config.queue_delay_ms = 100;
958   config.link_capacity_kbps = 2000;
959   auto fixture = CreateTestFixture(
960       "pc_conference_motion_hd_1tl_moderate_limits_trusted_rate_ctrl",
961       *network_emulation_manager->time_controller(),
962       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
963       [](PeerConfigurer* alice) {
964         VideoConfig video(1280, 720, 50);
965         video.stream_label = "alice-video";
966         auto frame_generator = CreateFromYuvFileFrameGenerator(
967             video, ClipNameToClipPath("ConferenceMotion_1280_720_50"));
968         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
969       },
970       [](PeerConfigurer* bob) {});
971   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
972   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
973   run_params.use_flex_fec = false;
974   run_params.use_ulp_fec = false;
975   fixture->Run(std::move(run_params));
976 }
977 
978 /*
979 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
980 TEST(PCGenericDescriptorTest, ConferenceMotionHd2TLModerateLimits) {
981   auto fixture = CreateVideoQualityTestFixture();
982   ParamsWithLogging conf_motion_hd;
983   conf_motion_hd.call.send_side_bwe = true;
984   conf_motion_hd.video[0] = {
985       true,    1280,
986       720,     50,
987       30000,   3000000,
988       3000000, false,
989       "VP8",   2,
990       -1,      0,
991       false,   false,
992       false,   ClipNameToClipPath("ConferenceMotion_1280_720_50")};
993   conf_motion_hd.analyzer = {
994       "conference_motion_hd_2tl_moderate_limits_generic_descriptor", 0.0, 0.0,
995       kTestDurationSec};
996   conf_motion_hd.config->queue_length_packets = 50;
997   conf_motion_hd.config->loss_percent = 3;
998   conf_motion_hd.config->queue_delay_ms = 100;
999   conf_motion_hd.config->link_capacity_kbps = 2000;
1000   conf_motion_hd.call.generic_descriptor = GenericDescriptorEnabled();
1001   fixture->RunWithAnalyzer(conf_motion_hd);
1002 }
1003 
1004 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1005 TEST(PCFullStackTest, ConferenceMotionHd3TLModerateLimits) {
1006   auto fixture = CreateVideoQualityTestFixture();
1007   ParamsWithLogging conf_motion_hd;
1008   conf_motion_hd.call.send_side_bwe = true;
1009   conf_motion_hd.video[0] = {
1010       true,    1280,
1011       720,     50,
1012       30000,   3000000,
1013       3000000, false,
1014       "VP8",   3,
1015       -1,      0,
1016       false,   false,
1017       false,   ClipNameToClipPath("ConferenceMotion_1280_720_50")};
1018   conf_motion_hd.analyzer = {"conference_motion_hd_3tl_moderate_limits", 0.0,
1019                              0.0, kTestDurationSec};
1020   conf_motion_hd.config->queue_length_packets = 50;
1021   conf_motion_hd.config->loss_percent = 3;
1022   conf_motion_hd.config->queue_delay_ms = 100;
1023   conf_motion_hd.config->link_capacity_kbps = 2000;
1024   fixture->RunWithAnalyzer(conf_motion_hd);
1025 }
1026 
1027 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1028 TEST(PCFullStackTest, ConferenceMotionHd4TLModerateLimits) {
1029   auto fixture = CreateVideoQualityTestFixture();
1030   ParamsWithLogging conf_motion_hd;
1031   conf_motion_hd.call.send_side_bwe = true;
1032   conf_motion_hd.video[0] = {
1033       true,    1280,
1034       720,     50,
1035       30000,   3000000,
1036       3000000, false,
1037       "VP8",   4,
1038       -1,      0,
1039       false,   false,
1040       false,   ClipNameToClipPath("ConferenceMotion_1280_720_50")};
1041   conf_motion_hd.analyzer = {"conference_motion_hd_4tl_moderate_limits", 0.0,
1042                              0.0, kTestDurationSec};
1043   conf_motion_hd.config->queue_length_packets = 50;
1044   conf_motion_hd.config->loss_percent = 3;
1045   conf_motion_hd.config->queue_delay_ms = 100;
1046   conf_motion_hd.config->link_capacity_kbps = 2000;
1047   fixture->RunWithAnalyzer(conf_motion_hd);
1048 }
1049 
1050 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1051 TEST(PCFullStackTest, ConferenceMotionHd3TLModerateLimitsAltTLPattern) {
1052   test::ScopedFieldTrials field_trial(
1053       AppendFieldTrials("WebRTC-UseShortVP8TL3Pattern/Enabled/"));
1054   auto fixture = CreateVideoQualityTestFixture();
1055   ParamsWithLogging conf_motion_hd;
1056   conf_motion_hd.call.send_side_bwe = true;
1057   conf_motion_hd.video[0] = {
1058       true,    1280,
1059       720,     50,
1060       30000,   3000000,
1061       3000000, false,
1062       "VP8",   3,
1063       -1,      0,
1064       false,   false,
1065       false,   ClipNameToClipPath("ConferenceMotion_1280_720_50")};
1066   conf_motion_hd.analyzer = {"conference_motion_hd_3tl_alt_moderate_limits",
1067                              0.0, 0.0, kTestDurationSec};
1068   conf_motion_hd.config->queue_length_packets = 50;
1069   conf_motion_hd.config->loss_percent = 3;
1070   conf_motion_hd.config->queue_delay_ms = 100;
1071   conf_motion_hd.config->link_capacity_kbps = 2000;
1072   fixture->RunWithAnalyzer(conf_motion_hd);
1073 }
1074 
1075 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1076 TEST(PCFullStackTest,
1077      ConferenceMotionHd3TLModerateLimitsAltTLPatternAndBaseHeavyTLAllocation) {
1078   auto fixture = CreateVideoQualityTestFixture();
1079   test::ScopedFieldTrials field_trial(
1080       AppendFieldTrials("WebRTC-UseShortVP8TL3Pattern/Enabled/"
1081                         "WebRTC-UseBaseHeavyVP8TL3RateAllocation/Enabled/"));
1082   ParamsWithLogging conf_motion_hd;
1083   conf_motion_hd.call.send_side_bwe = true;
1084   conf_motion_hd.video[0] = {
1085       true,    1280,
1086       720,     50,
1087       30000,   3000000,
1088       3000000, false,
1089       "VP8",   3,
1090       -1,      0,
1091       false,   false,
1092       false,   ClipNameToClipPath("ConferenceMotion_1280_720_50")};
1093   conf_motion_hd.analyzer = {
1094       "conference_motion_hd_3tl_alt_heavy_moderate_limits", 0.0, 0.0,
1095       kTestDurationSec};
1096   conf_motion_hd.config->queue_length_packets = 50;
1097   conf_motion_hd.config->loss_percent = 3;
1098   conf_motion_hd.config->queue_delay_ms = 100;
1099   conf_motion_hd.config->link_capacity_kbps = 2000;
1100   fixture->RunWithAnalyzer(conf_motion_hd);
1101 }
1102 */
1103 
1104 #if defined(RTC_ENABLE_VP9)
TEST(PCFullStackTest,Pc_Conference_Motion_Hd_2000kbps_100ms_32pkts_Queue_Vp9)1105 TEST(PCFullStackTest, Pc_Conference_Motion_Hd_2000kbps_100ms_32pkts_Queue_Vp9) {
1106   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
1107       CreateNetworkEmulationManager();
1108   BuiltInNetworkBehaviorConfig config;
1109   config.queue_length_packets = 32;
1110   config.queue_delay_ms = 100;
1111   config.link_capacity_kbps = 2000;
1112   auto fixture = CreateTestFixture(
1113       "pc_conference_motion_hd_2000kbps_100ms_32pkts_queue_vp9",
1114       *network_emulation_manager->time_controller(),
1115       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
1116       [](PeerConfigurer* alice) {
1117         VideoConfig video(1280, 720, 50);
1118         video.stream_label = "alice-video";
1119         auto frame_generator = CreateFromYuvFileFrameGenerator(
1120             video, ClipNameToClipPath("ConferenceMotion_1280_720_50"));
1121         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
1122       },
1123       [](PeerConfigurer* bob) {});
1124   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
1125   run_params.video_codecs = {VideoCodecConfig(
1126       /*name=*/cricket::kVp9CodecName, /*required_params=*/{
1127           {kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}})};
1128   run_params.use_flex_fec = false;
1129   run_params.use_ulp_fec = false;
1130   fixture->Run(std::move(run_params));
1131 }
1132 #endif
1133 
TEST(PCFullStackTest,Pc_Screenshare_Slides_No_Conference_Mode)1134 TEST(PCFullStackTest, Pc_Screenshare_Slides_No_Conference_Mode) {
1135   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
1136       CreateNetworkEmulationManager();
1137   auto fixture = CreateTestFixture(
1138       "pc_screenshare_slides_no_conference_mode",
1139       *network_emulation_manager->time_controller(),
1140       CreateTwoNetworkLinks(network_emulation_manager.get(),
1141                             BuiltInNetworkBehaviorConfig()),
1142       [](PeerConfigurer* alice) {
1143         VideoConfig video(1850, 1110, 5);
1144         video.stream_label = "alice-video";
1145         video.content_hint = VideoTrackInterface::ContentHint::kText;
1146         auto frame_generator = CreateScreenShareFrameGenerator(
1147             video, ScreenShareConfig(TimeDelta::Seconds(10)));
1148         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
1149       },
1150       [](PeerConfigurer* bob) {});
1151   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
1152   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
1153   run_params.use_flex_fec = false;
1154   run_params.use_ulp_fec = false;
1155   fixture->Run(std::move(run_params));
1156 }
1157 
TEST(PCFullStackTest,Pc_Screenshare_Slides)1158 TEST(PCFullStackTest, Pc_Screenshare_Slides) {
1159   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
1160       CreateNetworkEmulationManager();
1161   auto fixture = CreateTestFixture(
1162       "pc_screenshare_slides", *network_emulation_manager->time_controller(),
1163       CreateTwoNetworkLinks(network_emulation_manager.get(),
1164                             BuiltInNetworkBehaviorConfig()),
1165       [](PeerConfigurer* alice) {
1166         VideoConfig video(1850, 1110, 5);
1167         video.stream_label = "alice-video";
1168         video.content_hint = VideoTrackInterface::ContentHint::kText;
1169         auto frame_generator = CreateScreenShareFrameGenerator(
1170             video, ScreenShareConfig(TimeDelta::Seconds(10)));
1171         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
1172       },
1173       [](PeerConfigurer* bob) {});
1174   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
1175   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
1176   run_params.use_flex_fec = false;
1177   run_params.use_ulp_fec = false;
1178   run_params.use_conference_mode = true;
1179   fixture->Run(std::move(run_params));
1180 }
1181 
1182 // TODO(bugs.webrtc.org/9840): Investigate why is this test flaky on Win/Mac.
1183 #if !defined(WEBRTC_MAC) && !defined(WEBRTC_WIN)
TEST(PCFullStackTest,Pc_Screenshare_Slides_Simulcast_No_Conference_Mode)1184 TEST(PCFullStackTest, Pc_Screenshare_Slides_Simulcast_No_Conference_Mode) {
1185   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
1186       CreateNetworkEmulationManager();
1187   auto fixture = CreateTestFixture(
1188       "pc_screenshare_slides_simulcast_no_conference_mode",
1189       *network_emulation_manager->time_controller(),
1190       CreateTwoNetworkLinks(network_emulation_manager.get(),
1191                             BuiltInNetworkBehaviorConfig()),
1192       [](PeerConfigurer* alice) {
1193         VideoConfig video(1850, 1110, 30);
1194         video.simulcast_config = VideoSimulcastConfig(2, 1);
1195         video.temporal_layers_count = 2;
1196         video.stream_label = "alice-video";
1197         video.content_hint = VideoTrackInterface::ContentHint::kText;
1198         auto frame_generator = CreateScreenShareFrameGenerator(
1199             video, ScreenShareConfig(TimeDelta::Seconds(10)));
1200         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
1201       },
1202       [](PeerConfigurer* bob) {});
1203   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
1204   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
1205   run_params.use_flex_fec = false;
1206   run_params.use_ulp_fec = false;
1207   fixture->Run(std::move(run_params));
1208 }
1209 
TEST(PCFullStackTest,Pc_Screenshare_Slides_Simulcast)1210 TEST(PCFullStackTest, Pc_Screenshare_Slides_Simulcast) {
1211   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
1212       CreateNetworkEmulationManager();
1213   auto fixture = CreateTestFixture(
1214       "pc_screenshare_slides_simulcast",
1215       *network_emulation_manager->time_controller(),
1216       CreateTwoNetworkLinks(network_emulation_manager.get(),
1217                             BuiltInNetworkBehaviorConfig()),
1218       [](PeerConfigurer* alice) {
1219         VideoConfig video(1850, 1110, 30);
1220         video.simulcast_config = VideoSimulcastConfig(2, 1);
1221         video.temporal_layers_count = 2;
1222         video.stream_label = "alice-video";
1223         video.content_hint = VideoTrackInterface::ContentHint::kText;
1224         auto frame_generator = CreateScreenShareFrameGenerator(
1225             video, ScreenShareConfig(TimeDelta::Seconds(10)));
1226         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
1227       },
1228       [](PeerConfigurer* bob) {});
1229   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
1230   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
1231   run_params.use_flex_fec = false;
1232   run_params.use_ulp_fec = false;
1233   run_params.use_conference_mode = true;
1234   fixture->Run(std::move(run_params));
1235 }
1236 #endif  // !defined(WEBRTC_MAC) && !defined(WEBRTC_WIN)
1237 
1238 /*
1239 #if !defined(WEBRTC_MAC)
1240 // TODO(bugs.webrtc.org/9840): Investigate why is this test flaky on Win/Mac.
1241 #if !defined(WEBRTC_WIN)
1242 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1243 TEST(PCFullStackTest, ScreenshareSlidesVP8_2TL_Simulcast_low) {
1244   auto fixture = CreateVideoQualityTestFixture();
1245   ParamsWithLogging screenshare;
1246   screenshare.call.send_side_bwe = true;
1247   screenshare.screenshare[0] = {true, false, 10};
1248   screenshare.video[0] = {true,    1850,  1110,  30, 800000, 2500000,
1249                           2500000, false, "VP8", 2,  1,      400000,
1250                           false,   false, false, ""};
1251   screenshare.analyzer = {"screenshare_slides_simulcast_low", 0.0, 0.0,
1252                           kTestDurationSec};
1253   VideoQualityTest::Params screenshare_params_high;
1254   screenshare_params_high.video[0] = {
1255       true,  1850, 1110, 60,     600000, 1250000, 1250000, false,
1256       "VP8", 2,    0,    400000, false,  false,   false,   ""};
1257   VideoQualityTest::Params screenshare_params_low;
1258   screenshare_params_low.video[0] = {true,    1850,  1110,  5, 30000, 200000,
1259                                      1000000, false, "VP8", 2, 0,     400000,
1260                                      false,   false, false, ""};
1261 
1262   std::vector<VideoStream> streams = {
1263       VideoQualityTest::DefaultVideoStream(screenshare_params_low, 0),
1264       VideoQualityTest::DefaultVideoStream(screenshare_params_high, 0)};
1265   screenshare.ss[0] = {
1266       streams, 0, 1, 0, InterLayerPredMode::kOn, std::vector<SpatialLayer>(),
1267       false};
1268   fixture->RunWithAnalyzer(screenshare);
1269 }
1270 
1271 #endif  // !defined(WEBRTC_WIN)
1272 #endif  // !defined(WEBRTC_MAC)
1273 
1274 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1275 TEST(PCFullStackTest, ScreenshareSlidesVP8_2TL_Scroll) {
1276   auto fixture = CreateVideoQualityTestFixture();
1277   ParamsWithLogging config;
1278   config.call.send_side_bwe = true;
1279   config.video[0] = {true,    1850,  1110 / 2, 5, 50000, 200000,
1280                      1000000, false, "VP8",    2, 1,     400000,
1281                      false,   false, false,    ""};
1282   config.screenshare[0] = {true, false, 10, 2};
1283   config.analyzer = {"screenshare_slides_scrolling", 0.0, 0.0,
1284                      kTestDurationSec};
1285   fixture->RunWithAnalyzer(config);
1286 }
1287 
1288 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1289 TEST(PCGenericDescriptorTest, Screenshare_Slides_Lossy_Net_Generic_Descriptor) {
1290   auto fixture = CreateVideoQualityTestFixture();
1291   ParamsWithLogging screenshare;
1292   screenshare.call.send_side_bwe = true;
1293   screenshare.video[0] = {true,    1850,  1110,  5, 50000, 200000,
1294                           1000000, false, "VP8", 2, 1,     400000,
1295                           false,   false, false, ""};
1296   screenshare.screenshare[0] = {true, false, 10};
1297   screenshare.analyzer = {"screenshare_slides_lossy_net_generic_descriptor",
1298                           0.0, 0.0, kTestDurationSec};
1299   screenshare.config->loss_percent = 5;
1300   screenshare.config->queue_delay_ms = 200;
1301   screenshare.config->link_capacity_kbps = 500;
1302   screenshare.call.generic_descriptor = true;
1303   fixture->RunWithAnalyzer(screenshare);
1304 }
1305 
1306 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1307 TEST(PCFullStackTest, ScreenshareSlidesVP8_2TL_VeryLossyNet) {
1308   auto fixture = CreateVideoQualityTestFixture();
1309   ParamsWithLogging screenshare;
1310   screenshare.call.send_side_bwe = true;
1311   screenshare.video[0] = {true,    1850,  1110,  5, 50000, 200000,
1312                           1000000, false, "VP8", 2, 1,     400000,
1313                           false,   false, false, ""};
1314   screenshare.screenshare[0] = {true, false, 10};
1315   screenshare.analyzer = {"screenshare_slides_very_lossy", 0.0, 0.0,
1316                           kTestDurationSec};
1317   screenshare.config->loss_percent = 10;
1318   screenshare.config->queue_delay_ms = 200;
1319   screenshare.config->link_capacity_kbps = 500;
1320   fixture->RunWithAnalyzer(screenshare);
1321 }
1322 
1323 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1324 TEST(PCFullStackTest, ScreenshareSlidesVP8_2TL_LossyNetRestrictedQueue) {
1325   auto fixture = CreateVideoQualityTestFixture();
1326   ParamsWithLogging screenshare;
1327   screenshare.call.send_side_bwe = true;
1328   screenshare.video[0] = {true,    1850,  1110,  5, 50000, 200000,
1329                           1000000, false, "VP8", 2, 1,     400000,
1330                           false,   false, false, ""};
1331   screenshare.screenshare[0] = {true, false, 10};
1332   screenshare.analyzer = {"screenshare_slides_lossy_limited", 0.0, 0.0,
1333                           kTestDurationSec};
1334   screenshare.config->loss_percent = 5;
1335   screenshare.config->link_capacity_kbps = 200;
1336   screenshare.config->queue_length_packets = 30;
1337 
1338   fixture->RunWithAnalyzer(screenshare);
1339 }
1340 
1341 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1342 TEST(PCFullStackTest, ScreenshareSlidesVP8_2TL_ModeratelyRestricted) {
1343   auto fixture = CreateVideoQualityTestFixture();
1344   ParamsWithLogging screenshare;
1345   screenshare.call.send_side_bwe = true;
1346   screenshare.video[0] = {true,    1850,  1110,  5, 50000, 200000,
1347                           1000000, false, "VP8", 2, 1,     400000,
1348                           false,   false, false, ""};
1349   screenshare.screenshare[0] = {true, false, 10};
1350   screenshare.analyzer = {"screenshare_slides_moderately_restricted", 0.0, 0.0,
1351                           kTestDurationSec};
1352   screenshare.config->loss_percent = 1;
1353   screenshare.config->link_capacity_kbps = 1200;
1354   screenshare.config->queue_length_packets = 30;
1355 
1356   fixture->RunWithAnalyzer(screenshare);
1357 }
1358 
1359 namespace {
1360 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1361 // Since ParamsWithLogging::Video is not trivially destructible, we can't
1362 // store these structs as const globals.
1363 ParamsWithLogging::Video SvcVp9Video() {
1364   return ParamsWithLogging::Video{
1365       true,    1280,
1366       720,     30,
1367       800000,  2500000,
1368       2500000, false,
1369       "VP9",   3,
1370       2,       400000,
1371       false,   false,
1372       false,   ClipNameToClipPath("ConferenceMotion_1280_720_50")};
1373 }
1374 
1375 ParamsWithLogging::Video SimulcastVp8VideoHigh() {
1376   return ParamsWithLogging::Video{
1377       true,    1280,
1378       720,     30,
1379       800000,  2500000,
1380       2500000, false,
1381       "VP8",   3,
1382       2,       400000,
1383       false,   false,
1384       false,   ClipNameToClipPath("ConferenceMotion_1280_720_50")};
1385 }
1386 
1387 ParamsWithLogging::Video SimulcastVp8VideoMedium() {
1388   return ParamsWithLogging::Video{
1389       true,   640,
1390       360,    30,
1391       150000, 500000,
1392       700000, false,
1393       "VP8",  3,
1394       2,      400000,
1395       false,  false,
1396       false,  ClipNameToClipPath("ConferenceMotion_1280_720_50")};
1397 }
1398 
1399 ParamsWithLogging::Video SimulcastVp8VideoLow() {
1400   return ParamsWithLogging::Video{
1401       true,   320,
1402       180,    30,
1403       30000,  150000,
1404       200000, false,
1405       "VP8",  3,
1406       2,      400000,
1407       false,  false,
1408       false,  ClipNameToClipPath("ConferenceMotion_1280_720_50")};
1409 }
1410 }  // namespace
1411 */
1412 
1413 #if defined(RTC_ENABLE_VP9)
1414 
TEST(PCFullStackTest,Pc_Screenshare_Slides_Vp9_3sl_High_Fps)1415 TEST(PCFullStackTest, Pc_Screenshare_Slides_Vp9_3sl_High_Fps) {
1416   webrtc::test::ScopedFieldTrials override_trials(
1417       AppendFieldTrials("WebRTC-Vp9InterLayerPred/"
1418                         "Enabled,inter_layer_pred_mode:on/"));
1419   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
1420       CreateNetworkEmulationManager();
1421   auto fixture = CreateTestFixture(
1422       "pc_screenshare_slides_vp9_3sl_high_fps",
1423       *network_emulation_manager->time_controller(),
1424       CreateTwoNetworkLinks(network_emulation_manager.get(),
1425                             BuiltInNetworkBehaviorConfig()),
1426       [](PeerConfigurer* alice) {
1427         VideoConfig video(1850, 1110, 30);
1428         video.stream_label = "alice-video";
1429         video.simulcast_config = VideoSimulcastConfig(3, 2);
1430         video.content_hint = VideoTrackInterface::ContentHint::kText;
1431         auto frame_generator = CreateScreenShareFrameGenerator(
1432             video, ScreenShareConfig(TimeDelta::Seconds(10)));
1433         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
1434       },
1435       [](PeerConfigurer* bob) {});
1436   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
1437   run_params.video_codecs = {VideoCodecConfig(
1438       /*name=*/cricket::kVp9CodecName, /*required_params=*/{
1439           {kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}})};
1440   run_params.use_flex_fec = false;
1441   run_params.use_ulp_fec = false;
1442   fixture->Run(std::move(run_params));
1443 }
1444 
TEST(PCFullStackTest,Pc_Vp9svc_3sl_High)1445 TEST(PCFullStackTest, Pc_Vp9svc_3sl_High) {
1446   webrtc::test::ScopedFieldTrials override_trials(
1447       AppendFieldTrials("WebRTC-Vp9InterLayerPred/"
1448                         "Enabled,inter_layer_pred_mode:on/"));
1449   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
1450       CreateNetworkEmulationManager();
1451   auto fixture = CreateTestFixture(
1452       "pc_vp9svc_3sl_high", *network_emulation_manager->time_controller(),
1453       CreateTwoNetworkLinks(network_emulation_manager.get(),
1454                             BuiltInNetworkBehaviorConfig()),
1455       [](PeerConfigurer* alice) {
1456         VideoConfig video(1280, 720, 30);
1457         video.stream_label = "alice-video";
1458         video.simulcast_config = VideoSimulcastConfig(3, 2);
1459         video.temporal_layers_count = 3;
1460         auto frame_generator = CreateFromYuvFileFrameGenerator(
1461             video, ClipNameToClipPath("ConferenceMotion_1280_720_50"));
1462         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
1463       },
1464       [](PeerConfigurer* bob) {});
1465   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
1466   run_params.video_codecs = {VideoCodecConfig(
1467       /*name=*/cricket::kVp9CodecName, /*required_params=*/{
1468           {kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}})};
1469   run_params.use_flex_fec = false;
1470   run_params.use_ulp_fec = false;
1471   fixture->Run(std::move(run_params));
1472 }
1473 
TEST(PCFullStackTest,Pc_Vp9svc_3sl_Low)1474 TEST(PCFullStackTest, Pc_Vp9svc_3sl_Low) {
1475   webrtc::test::ScopedFieldTrials override_trials(
1476       AppendFieldTrials("WebRTC-Vp9InterLayerPred/"
1477                         "Enabled,inter_layer_pred_mode:on/"));
1478   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
1479       CreateNetworkEmulationManager();
1480   auto fixture = CreateTestFixture(
1481       "pc_vp9svc_3sl_low", *network_emulation_manager->time_controller(),
1482       CreateTwoNetworkLinks(network_emulation_manager.get(),
1483                             BuiltInNetworkBehaviorConfig()),
1484       [](PeerConfigurer* alice) {
1485         VideoConfig video(1280, 720, 30);
1486         video.stream_label = "alice-video";
1487         video.simulcast_config = VideoSimulcastConfig(3, 0);
1488         video.temporal_layers_count = 3;
1489         auto frame_generator = CreateFromYuvFileFrameGenerator(
1490             video, ClipNameToClipPath("ConferenceMotion_1280_720_50"));
1491         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
1492       },
1493       [](PeerConfigurer* bob) {});
1494   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
1495   run_params.video_codecs = {VideoCodecConfig(
1496       /*name=*/cricket::kVp9CodecName, /*required_params=*/{
1497           {kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}})};
1498   run_params.use_flex_fec = false;
1499   run_params.use_ulp_fec = false;
1500   fixture->Run(std::move(run_params));
1501 }
1502 
1503 #endif  // defined(RTC_ENABLE_VP9)
1504 
1505 /*
1506 // bugs.webrtc.org/9506
1507 #if !defined(WEBRTC_MAC)
1508 
1509 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1510 TEST(PCFullStackTest, VP9KSVC_3SL_High) {
1511   webrtc::test::ScopedFieldTrials override_trials(
1512       AppendFieldTrials("WebRTC-Vp9IssueKeyFrameOnLayerDeactivation/Enabled/"));
1513   auto fixture = CreateVideoQualityTestFixture();
1514   ParamsWithLogging simulcast;
1515   simulcast.call.send_side_bwe = true;
1516   simulcast.video[0] = SvcVp9Video();
1517   simulcast.analyzer = {"vp9ksvc_3sl_high", 0.0, 0.0, kTestDurationSec};
1518   simulcast.ss[0] = {
1519       std::vector<VideoStream>(),  0,    3, 2, InterLayerPredMode::kOnKeyPic,
1520       std::vector<SpatialLayer>(), false};
1521   fixture->RunWithAnalyzer(simulcast);
1522 }
1523 
1524 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1525 TEST(PCFullStackTest, VP9KSVC_3SL_Medium) {
1526   webrtc::test::ScopedFieldTrials override_trials(
1527       AppendFieldTrials("WebRTC-Vp9IssueKeyFrameOnLayerDeactivation/Enabled/"));
1528   auto fixture = CreateVideoQualityTestFixture();
1529   ParamsWithLogging simulcast;
1530   simulcast.call.send_side_bwe = true;
1531   simulcast.video[0] = SvcVp9Video();
1532   simulcast.analyzer = {"vp9ksvc_3sl_medium", 0.0, 0.0, kTestDurationSec};
1533   simulcast.ss[0] = {
1534       std::vector<VideoStream>(),  0,    3, 1, InterLayerPredMode::kOnKeyPic,
1535       std::vector<SpatialLayer>(), false};
1536   fixture->RunWithAnalyzer(simulcast);
1537 }
1538 
1539 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1540 TEST(PCFullStackTest, VP9KSVC_3SL_Low) {
1541   webrtc::test::ScopedFieldTrials override_trials(
1542       AppendFieldTrials("WebRTC-Vp9IssueKeyFrameOnLayerDeactivation/Enabled/"));
1543   auto fixture = CreateVideoQualityTestFixture();
1544   ParamsWithLogging simulcast;
1545   simulcast.call.send_side_bwe = true;
1546   simulcast.video[0] = SvcVp9Video();
1547   simulcast.analyzer = {"vp9ksvc_3sl_low", 0.0, 0.0, kTestDurationSec};
1548   simulcast.ss[0] = {
1549       std::vector<VideoStream>(),  0,    3, 0, InterLayerPredMode::kOnKeyPic,
1550       std::vector<SpatialLayer>(), false};
1551   fixture->RunWithAnalyzer(simulcast);
1552 }
1553 
1554 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1555 TEST(PCFullStackTest, VP9KSVC_3SL_Medium_Network_Restricted) {
1556   webrtc::test::ScopedFieldTrials override_trials(
1557       AppendFieldTrials("WebRTC-Vp9IssueKeyFrameOnLayerDeactivation/Enabled/"));
1558   auto fixture = CreateVideoQualityTestFixture();
1559   ParamsWithLogging simulcast;
1560   simulcast.call.send_side_bwe = true;
1561   simulcast.video[0] = SvcVp9Video();
1562   simulcast.analyzer = {"vp9ksvc_3sl_medium_network_restricted", 0.0, 0.0,
1563                         kTestDurationSec};
1564   simulcast.ss[0] = {
1565       std::vector<VideoStream>(),  0,    3, -1, InterLayerPredMode::kOnKeyPic,
1566       std::vector<SpatialLayer>(), false};
1567   simulcast.config->link_capacity_kbps = 1000;
1568   simulcast.config->queue_delay_ms = 100;
1569   fixture->RunWithAnalyzer(simulcast);
1570 }
1571 
1572 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1573 // TODO(webrtc:9722): Remove when experiment is cleaned up.
1574 TEST(PCFullStackTest, VP9KSVC_3SL_Medium_Network_Restricted_Trusted_Rate) {
1575   webrtc::test::ScopedFieldTrials override_trials(
1576       AppendFieldTrials("WebRTC-Vp9IssueKeyFrameOnLayerDeactivation/Enabled/"
1577                         "WebRTC-LibvpxVp9TrustedRateController/Enabled/"));
1578   auto fixture = CreateVideoQualityTestFixture();
1579   ParamsWithLogging simulcast;
1580   simulcast.call.send_side_bwe = true;
1581   simulcast.video[0] = SvcVp9Video();
1582   simulcast.analyzer = {"vp9ksvc_3sl_medium_network_restricted_trusted_rate",
1583                         0.0, 0.0, kTestDurationSec};
1584   simulcast.ss[0] = {
1585       std::vector<VideoStream>(),  0,    3, -1, InterLayerPredMode::kOnKeyPic,
1586       std::vector<SpatialLayer>(), false};
1587   simulcast.config->link_capacity_kbps = 1000;
1588   simulcast.config->queue_delay_ms = 100;
1589   fixture->RunWithAnalyzer(simulcast);
1590 }
1591 #endif  // !defined(WEBRTC_MAC)
1592 
1593 #endif  // defined(RTC_ENABLE_VP9)
1594 */
1595 
1596 // Android bots can't handle FullHD, so disable the test.
1597 // TODO(bugs.webrtc.org/9220): Investigate source of flakiness on Mac.
1598 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_MAC)
1599 #define MAYBE_Pc_Simulcast_HD_High DISABLED_Pc_Simulcast_HD_High
1600 #else
1601 #define MAYBE_Pc_Simulcast_HD_High Pc_Simulcast_HD_High
1602 #endif
TEST(PCFullStackTest,MAYBE_Pc_Simulcast_HD_High)1603 TEST(PCFullStackTest, MAYBE_Pc_Simulcast_HD_High) {
1604   webrtc::test::ScopedFieldTrials override_trials(AppendFieldTrials(
1605       "WebRTC-ForceSimulatedOveruseIntervalMs/1000-50000-300/"));
1606   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
1607       CreateNetworkEmulationManager();
1608   BuiltInNetworkBehaviorConfig config;
1609   config.loss_percent = 0;
1610   config.queue_delay_ms = 100;
1611   auto fixture = CreateTestFixture(
1612       "pc_simulcast_HD_high", *network_emulation_manager->time_controller(),
1613       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
1614       [](PeerConfigurer* alice) {
1615         VideoConfig video(1920, 1080, 30);
1616         video.simulcast_config = VideoSimulcastConfig(3, 2);
1617         video.temporal_layers_count = 3;
1618         video.stream_label = "alice-video";
1619         alice->AddVideoConfig(std::move(video));
1620       },
1621       [](PeerConfigurer* bob) {});
1622   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
1623   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
1624   run_params.use_flex_fec = false;
1625   run_params.use_ulp_fec = false;
1626   fixture->Run(std::move(run_params));
1627 }
1628 
TEST(PCFullStackTest,Pc_Simulcast_Vp8_3sl_High)1629 TEST(PCFullStackTest, Pc_Simulcast_Vp8_3sl_High) {
1630   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
1631       CreateNetworkEmulationManager();
1632   BuiltInNetworkBehaviorConfig config;
1633   config.loss_percent = 0;
1634   config.queue_delay_ms = 100;
1635   auto fixture = CreateTestFixture(
1636       "pc_simulcast_vp8_3sl_high",
1637       *network_emulation_manager->time_controller(),
1638       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
1639       [](PeerConfigurer* alice) {
1640         VideoConfig video(1280, 720, 30);
1641         video.simulcast_config = VideoSimulcastConfig(3, 2);
1642         video.stream_label = "alice-video";
1643         auto frame_generator = CreateFromYuvFileFrameGenerator(
1644             video, ClipNameToClipPath("ConferenceMotion_1280_720_50"));
1645         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
1646       },
1647       [](PeerConfigurer* bob) {});
1648   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
1649   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
1650   run_params.use_flex_fec = false;
1651   run_params.use_ulp_fec = false;
1652   fixture->Run(std::move(run_params));
1653 }
1654 
TEST(PCFullStackTest,Pc_Simulcast_Vp8_3sl_Low)1655 TEST(PCFullStackTest, Pc_Simulcast_Vp8_3sl_Low) {
1656   std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
1657       CreateNetworkEmulationManager();
1658   BuiltInNetworkBehaviorConfig config;
1659   config.loss_percent = 0;
1660   config.queue_delay_ms = 100;
1661   auto fixture = CreateTestFixture(
1662       "pc_simulcast_vp8_3sl_low", *network_emulation_manager->time_controller(),
1663       CreateTwoNetworkLinks(network_emulation_manager.get(), config),
1664       [](PeerConfigurer* alice) {
1665         VideoConfig video(1280, 720, 30);
1666         video.simulcast_config = VideoSimulcastConfig(3, 0);
1667         video.stream_label = "alice-video";
1668         auto frame_generator = CreateFromYuvFileFrameGenerator(
1669             video, ClipNameToClipPath("ConferenceMotion_1280_720_50"));
1670         alice->AddVideoConfig(std::move(video), std::move(frame_generator));
1671       },
1672       [](PeerConfigurer* bob) {});
1673   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));
1674   run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)};
1675   run_params.use_flex_fec = false;
1676   run_params.use_ulp_fec = false;
1677   fixture->Run(std::move(run_params));
1678 }
1679 
1680 /*
1681 // This test assumes ideal network conditions with target bandwidth being
1682 // available and exercises WebRTC calls with a high target bitrate(100 Mbps).
1683 // Android32 bots can't handle this high bitrate, so disable test for those.
1684 #if defined(WEBRTC_ANDROID)
1685 #define MAYBE_HighBitrateWithFakeCodec DISABLED_HighBitrateWithFakeCodec
1686 #else
1687 #define MAYBE_HighBitrateWithFakeCodec HighBitrateWithFakeCodec
1688 #endif  // defined(WEBRTC_ANDROID)
1689 // TODO(bugs.webrtc.org/10639) Disabled because target bitrate can't be
1690 configured yet. TEST(PCFullStackTest, MAYBE_HighBitrateWithFakeCodec) { auto
1691 fixture = CreateVideoQualityTestFixture(); const int target_bitrate = 100000000;
1692   ParamsWithLogging generator;
1693   generator.call.send_side_bwe = true;
1694   generator.call.call_bitrate_config.min_bitrate_bps = target_bitrate;
1695   generator.call.call_bitrate_config.start_bitrate_bps = target_bitrate;
1696   generator.call.call_bitrate_config.max_bitrate_bps = target_bitrate;
1697   generator.video[0] = {true,
1698                         360,
1699                         240,
1700                         30,
1701                         target_bitrate / 2,
1702                         target_bitrate,
1703                         target_bitrate * 2,
1704                         false,
1705                         "FakeCodec",
1706                         1,
1707                         0,
1708                         0,
1709                         false,
1710                         false,
1711                         false,
1712                         "Generator"};
1713   generator.analyzer = {"high_bitrate_with_fake_codec", 0.0, 0.0,
1714                         kTestDurationSec};
1715   fixture->RunWithAnalyzer(generator);
1716 }
1717 
1718 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1719 TEST(PCFullStackTest, LargeRoomVP8_5thumb) {
1720   auto fixture = CreateVideoQualityTestFixture();
1721   ParamsWithLogging large_room;
1722   large_room.call.send_side_bwe = true;
1723   large_room.video[0] = SimulcastVp8VideoHigh();
1724   large_room.analyzer = {"largeroom_5thumb", 0.0, 0.0, kTestDurationSec};
1725   large_room.config->loss_percent = 0;
1726   large_room.config->queue_delay_ms = 100;
1727   ParamsWithLogging video_params_high;
1728   video_params_high.video[0] = SimulcastVp8VideoHigh();
1729   ParamsWithLogging video_params_medium;
1730   video_params_medium.video[0] = SimulcastVp8VideoMedium();
1731   ParamsWithLogging video_params_low;
1732   video_params_low.video[0] = SimulcastVp8VideoLow();
1733 
1734   std::vector<VideoStream> streams = {
1735       VideoQualityTest::DefaultVideoStream(video_params_low, 0),
1736       VideoQualityTest::DefaultVideoStream(video_params_medium, 0),
1737       VideoQualityTest::DefaultVideoStream(video_params_high, 0)};
1738   large_room.call.num_thumbnails = 5;
1739   large_room.ss[0] = {
1740       streams, 2, 1, 0, InterLayerPredMode::kOn, std::vector<SpatialLayer>(),
1741       false};
1742   fixture->RunWithAnalyzer(large_room);
1743 }
1744 
1745 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
1746 // Fails on mobile devices:
1747 // https://bugs.chromium.org/p/webrtc/issues/detail?id=7301
1748 #define MAYBE_LargeRoomVP8_50thumb DISABLED_LargeRoomVP8_50thumb
1749 #define MAYBE_LargeRoomVP8_15thumb DISABLED_LargeRoomVP8_15thumb
1750 #else
1751 #define MAYBE_LargeRoomVP8_50thumb LargeRoomVP8_50thumb
1752 #define MAYBE_LargeRoomVP8_15thumb LargeRoomVP8_15thumb
1753 #endif
1754 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1755 TEST(PCFullStackTest, MAYBE_LargeRoomVP8_15thumb) {
1756   auto fixture = CreateVideoQualityTestFixture();
1757   ParamsWithLogging large_room;
1758   large_room.call.send_side_bwe = true;
1759   large_room.video[0] = SimulcastVp8VideoHigh();
1760   large_room.analyzer = {"largeroom_15thumb", 0.0, 0.0, kTestDurationSec};
1761   large_room.config->loss_percent = 0;
1762   large_room.config->queue_delay_ms = 100;
1763   ParamsWithLogging video_params_high;
1764   video_params_high.video[0] = SimulcastVp8VideoHigh();
1765   ParamsWithLogging video_params_medium;
1766   video_params_medium.video[0] = SimulcastVp8VideoMedium();
1767   ParamsWithLogging video_params_low;
1768   video_params_low.video[0] = SimulcastVp8VideoLow();
1769 
1770   std::vector<VideoStream> streams = {
1771       VideoQualityTest::DefaultVideoStream(video_params_low, 0),
1772       VideoQualityTest::DefaultVideoStream(video_params_medium, 0),
1773       VideoQualityTest::DefaultVideoStream(video_params_high, 0)};
1774   large_room.call.num_thumbnails = 15;
1775   large_room.ss[0] = {
1776       streams, 2, 1, 0, InterLayerPredMode::kOn, std::vector<SpatialLayer>(),
1777       false};
1778   fixture->RunWithAnalyzer(large_room);
1779 }
1780 
1781 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1782 TEST(PCFullStackTest, MAYBE_LargeRoomVP8_50thumb) {
1783   auto fixture = CreateVideoQualityTestFixture();
1784   ParamsWithLogging large_room;
1785   large_room.call.send_side_bwe = true;
1786   large_room.video[0] = SimulcastVp8VideoHigh();
1787   large_room.analyzer = {"largeroom_50thumb", 0.0, 0.0, kTestDurationSec};
1788   large_room.config->loss_percent = 0;
1789   large_room.config->queue_delay_ms = 100;
1790   ParamsWithLogging video_params_high;
1791   video_params_high.video[0] = SimulcastVp8VideoHigh();
1792   ParamsWithLogging video_params_medium;
1793   video_params_medium.video[0] = SimulcastVp8VideoMedium();
1794   ParamsWithLogging video_params_low;
1795   video_params_low.video[0] = SimulcastVp8VideoLow();
1796 
1797   std::vector<VideoStream> streams = {
1798       VideoQualityTest::DefaultVideoStream(video_params_low, 0),
1799       VideoQualityTest::DefaultVideoStream(video_params_medium, 0),
1800       VideoQualityTest::DefaultVideoStream(video_params_high, 0)};
1801   large_room.call.num_thumbnails = 50;
1802   large_room.ss[0] = {
1803       streams, 2, 1, 0, InterLayerPredMode::kOn, std::vector<SpatialLayer>(),
1804       false};
1805   fixture->RunWithAnalyzer(large_room);
1806 }
1807 */
1808 
1809 class PCDualStreamsTest : public ::testing::TestWithParam<int> {};
1810 
1811 /*
1812 // Disable dual video test on mobile device becuase it's too heavy.
1813 // TODO(bugs.webrtc.org/9840): Investigate why is this test flaky on MAC.
1814 #if !defined(WEBRTC_ANDROID) && !defined(WEBRTC_IOS) && !defined(WEBRTC_MAC)
1815 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1816 TEST_P(PCDualStreamsTest,
1817        ModeratelyRestricted_SlidesVp8_2TL_Simulcast_Video_Simulcast_High) {
1818   const int first_stream = GetParam();
1819   ParamsWithLogging dual_streams;
1820 
1821   // Screenshare Settings.
1822   dual_streams.screenshare[first_stream] = {true, false, 10};
1823   dual_streams.video[first_stream] = {true,    1850,  1110,  5, 800000, 2500000,
1824                                       2500000, false, "VP8", 2, 1,      400000,
1825                                       false,   false, false, ""};
1826 
1827   ParamsWithLogging screenshare_params_high;
1828   screenshare_params_high.video[0] = {
1829       true,  1850, 1110, 60,     600000, 1250000, 1250000, false,
1830       "VP8", 2,    0,    400000, false,  false,   false,   ""};
1831   VideoQualityTest::Params screenshare_params_low;
1832   screenshare_params_low.video[0] = {true,    1850,  1110,  5, 30000, 200000,
1833                                      1000000, false, "VP8", 2, 0,     400000,
1834                                      false,   false, false, ""};
1835   std::vector<VideoStream> screenhsare_streams = {
1836       VideoQualityTest::DefaultVideoStream(screenshare_params_low, 0),
1837       VideoQualityTest::DefaultVideoStream(screenshare_params_high, 0)};
1838 
1839   dual_streams.ss[first_stream] = {
1840       screenhsare_streams,         1,    1, 0, InterLayerPredMode::kOn,
1841       std::vector<SpatialLayer>(), false};
1842 
1843   // Video settings.
1844   dual_streams.video[1 - first_stream] = SimulcastVp8VideoHigh();
1845 
1846   ParamsWithLogging video_params_high;
1847   video_params_high.video[0] = SimulcastVp8VideoHigh();
1848   ParamsWithLogging video_params_medium;
1849   video_params_medium.video[0] = SimulcastVp8VideoMedium();
1850   ParamsWithLogging video_params_low;
1851   video_params_low.video[0] = SimulcastVp8VideoLow();
1852   std::vector<VideoStream> streams = {
1853       VideoQualityTest::DefaultVideoStream(video_params_low, 0),
1854       VideoQualityTest::DefaultVideoStream(video_params_medium, 0),
1855       VideoQualityTest::DefaultVideoStream(video_params_high, 0)};
1856 
1857   dual_streams.ss[1 - first_stream] = {
1858       streams, 2, 1, 0, InterLayerPredMode::kOn, std::vector<SpatialLayer>(),
1859       false};
1860 
1861   // Call settings.
1862   dual_streams.call.send_side_bwe = true;
1863   dual_streams.call.dual_video = true;
1864   std::string test_label = "dualstreams_moderately_restricted_screenshare_" +
1865                            std::to_string(first_stream);
1866   dual_streams.analyzer = {test_label, 0.0, 0.0, kTestDurationSec};
1867   dual_streams.config->loss_percent = 1;
1868   dual_streams.config->link_capacity_kbps = 7500;
1869   dual_streams.config->queue_length_packets = 30;
1870   dual_streams.config->queue_delay_ms = 100;
1871 
1872   auto fixture = CreateVideoQualityTestFixture();
1873   fixture->RunWithAnalyzer(dual_streams);
1874 }
1875 #endif  // !defined(WEBRTC_ANDROID) && !defined(WEBRTC_IOS) &&
1876         // !defined(WEBRTC_MAC)
1877 
1878 // TODO(bugs.webrtc.org/10639) requires simulcast/SVC support in PC framework
1879 TEST_P(PCDualStreamsTest, Conference_Restricted) {
1880   const int first_stream = GetParam();
1881   ParamsWithLogging dual_streams;
1882 
1883   // Screenshare Settings.
1884   dual_streams.screenshare[first_stream] = {true, false, 10};
1885   dual_streams.video[first_stream] = {true,    1850,  1110,  5, 800000, 2500000,
1886                                       2500000, false, "VP8", 3, 2,      400000,
1887                                       false,   false, false, ""};
1888   // Video settings.
1889   dual_streams.video[1 - first_stream] = {
1890       true,   1280,
1891       720,    30,
1892       150000, 500000,
1893       700000, false,
1894       "VP8",  3,
1895       2,      400000,
1896       false,  false,
1897       false,  ClipNameToClipPath("ConferenceMotion_1280_720_50")};
1898 
1899   // Call settings.
1900   dual_streams.call.send_side_bwe = true;
1901   dual_streams.call.dual_video = true;
1902   std::string test_label = "dualstreams_conference_restricted_screenshare_" +
1903                            std::to_string(first_stream);
1904   dual_streams.analyzer = {test_label, 0.0, 0.0, kTestDurationSec};
1905   dual_streams.config->loss_percent = 1;
1906   dual_streams.config->link_capacity_kbps = 5000;
1907   dual_streams.config->queue_length_packets = 30;
1908   dual_streams.config->queue_delay_ms = 100;
1909 
1910   auto fixture = CreateVideoQualityTestFixture();
1911   fixture->RunWithAnalyzer(dual_streams);
1912 }
1913 */
1914 
1915 INSTANTIATE_TEST_SUITE_P(PCFullStackTest,
1916                          PCDualStreamsTest,
1917                          ::testing::Values(0, 1));
1918 
1919 }  // namespace webrtc
1920