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