1 /*
2 * Copyright (c) 2019 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
11 #include <cstdint>
12 #include <memory>
13 #include <string>
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/metrics/global_metrics_logger_and_exporter.h"
20 #include "api/test/network_emulation_manager.h"
21 #include "api/test/pclf/media_configuration.h"
22 #include "api/test/pclf/media_quality_test_params.h"
23 #include "api/test/pclf/peer_configurer.h"
24 #include "api/test/peerconnection_quality_test_fixture.h"
25 #include "call/simulated_network.h"
26 #include "system_wrappers/include/field_trial.h"
27 #include "test/field_trial.h"
28 #include "test/gtest.h"
29 #include "test/pc/e2e/analyzer/audio/default_audio_quality_analyzer.h"
30 #include "test/pc/e2e/analyzer/video/default_video_quality_analyzer.h"
31 #include "test/pc/e2e/analyzer/video/default_video_quality_analyzer_shared_objects.h"
32 #include "test/pc/e2e/stats_based_network_quality_metrics_reporter.h"
33 #include "test/testsupport/file_utils.h"
34
35 #if defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
36 #include "modules/video_coding/codecs/test/objc_codec_factory_helper.h" // nogncheck
37 #endif
38
39 namespace webrtc {
40 namespace webrtc_pc_e2e {
41 namespace {
42
43 class PeerConnectionE2EQualityTestSmokeTest : public ::testing::Test {
44 public:
SetUp()45 void SetUp() override {
46 network_emulation_ = CreateNetworkEmulationManager();
47 auto video_quality_analyzer = std::make_unique<DefaultVideoQualityAnalyzer>(
48 network_emulation_->time_controller()->GetClock(),
49 test::GetGlobalMetricsLogger());
50 video_quality_analyzer_ = video_quality_analyzer.get();
51 fixture_ = CreatePeerConnectionE2EQualityTestFixture(
52 testing::UnitTest::GetInstance()->current_test_info()->name(),
53 *network_emulation_->time_controller(),
54 /*audio_quality_analyzer=*/nullptr, std::move(video_quality_analyzer));
55 }
56
57 std::pair<EmulatedNetworkManagerInterface*, EmulatedNetworkManagerInterface*>
CreateNetwork()58 CreateNetwork() {
59 EmulatedNetworkNode* alice_node = network_emulation_->CreateEmulatedNode(
60 std::make_unique<SimulatedNetwork>(BuiltInNetworkBehaviorConfig()));
61 EmulatedNetworkNode* bob_node = network_emulation_->CreateEmulatedNode(
62 std::make_unique<SimulatedNetwork>(BuiltInNetworkBehaviorConfig()));
63
64 EmulatedEndpoint* alice_endpoint =
65 network_emulation_->CreateEndpoint(EmulatedEndpointConfig());
66 EmulatedEndpoint* bob_endpoint =
67 network_emulation_->CreateEndpoint(EmulatedEndpointConfig());
68
69 network_emulation_->CreateRoute(alice_endpoint, {alice_node}, bob_endpoint);
70 network_emulation_->CreateRoute(bob_endpoint, {bob_node}, alice_endpoint);
71
72 EmulatedNetworkManagerInterface* alice_network =
73 network_emulation_->CreateEmulatedNetworkManagerInterface(
74 {alice_endpoint});
75 EmulatedNetworkManagerInterface* bob_network =
76 network_emulation_->CreateEmulatedNetworkManagerInterface(
77 {bob_endpoint});
78
79 return std::make_pair(alice_network, bob_network);
80 }
81
AddPeer(EmulatedNetworkManagerInterface * network,rtc::FunctionView<void (PeerConfigurer *)> update_configurer)82 void AddPeer(EmulatedNetworkManagerInterface* network,
83 rtc::FunctionView<void(PeerConfigurer*)> update_configurer) {
84 auto configurer =
85 std::make_unique<PeerConfigurer>(network->network_dependencies());
86 update_configurer(configurer.get());
87 fixture_->AddPeer(std::move(configurer));
88 }
89
RunAndCheckEachVideoStreamReceivedFrames(const RunParams & run_params)90 void RunAndCheckEachVideoStreamReceivedFrames(const RunParams& run_params) {
91 fixture_->Run(run_params);
92
93 EXPECT_GE(fixture_->GetRealTestDuration(), run_params.run_duration);
94 VideoStreamsInfo known_streams = video_quality_analyzer_->GetKnownStreams();
95 for (const StatsKey& stream_key : known_streams.GetStatsKeys()) {
96 FrameCounters stream_conters =
97 video_quality_analyzer_->GetPerStreamCounters().at(stream_key);
98 // On some devices the pipeline can be too slow, so we actually can't
99 // force real constraints here. Lets just check, that at least 1
100 // frame passed whole pipeline.
101 int64_t expected_min_fps = run_params.run_duration.seconds() * 15;
102 EXPECT_GE(stream_conters.captured, expected_min_fps)
103 << stream_key.ToString();
104 EXPECT_GE(stream_conters.pre_encoded, 1) << stream_key.ToString();
105 EXPECT_GE(stream_conters.encoded, 1) << stream_key.ToString();
106 EXPECT_GE(stream_conters.received, 1) << stream_key.ToString();
107 EXPECT_GE(stream_conters.decoded, 1) << stream_key.ToString();
108 EXPECT_GE(stream_conters.rendered, 1) << stream_key.ToString();
109 }
110 }
111
network_emulation()112 NetworkEmulationManager* network_emulation() {
113 return network_emulation_.get();
114 }
115
fixture()116 PeerConnectionE2EQualityTestFixture* fixture() { return fixture_.get(); }
117
118 private:
119 std::unique_ptr<NetworkEmulationManager> network_emulation_;
120 DefaultVideoQualityAnalyzer* video_quality_analyzer_;
121 std::unique_ptr<PeerConnectionE2EQualityTestFixture> fixture_;
122 };
123
124 // IOS debug builds can be quite slow, disabling to avoid issues with timeouts.
125 #if defined(WEBRTC_IOS) && defined(WEBRTC_ARCH_ARM64) && !defined(NDEBUG)
126 #define MAYBE_Smoke DISABLED_Smoke
127 #else
128 #define MAYBE_Smoke Smoke
129 #endif
TEST_F(PeerConnectionE2EQualityTestSmokeTest,MAYBE_Smoke)130 TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_Smoke) {
131 std::pair<EmulatedNetworkManagerInterface*, EmulatedNetworkManagerInterface*>
132 network_links = CreateNetwork();
133 AddPeer(network_links.first, [](PeerConfigurer* alice) {
134 VideoConfig video(160, 120, 15);
135 video.stream_label = "alice-video";
136 video.sync_group = "alice-media";
137 alice->AddVideoConfig(std::move(video));
138
139 AudioConfig audio;
140 audio.stream_label = "alice-audio";
141 audio.mode = AudioConfig::Mode::kFile;
142 audio.input_file_name =
143 test::ResourcePath("pc_quality_smoke_test_alice_source", "wav");
144 audio.sampling_frequency_in_hz = 48000;
145 audio.sync_group = "alice-media";
146 alice->SetAudioConfig(std::move(audio));
147 alice->SetVideoCodecs(
148 {VideoCodecConfig(cricket::kVp9CodecName, {{"profile-id", "0"}})});
149
150 alice->SetUseFlexFEC(true);
151 alice->SetUseUlpFEC(true);
152 alice->SetVideoEncoderBitrateMultiplier(1.1);
153 });
154 AddPeer(network_links.second, [](PeerConfigurer* charlie) {
155 charlie->SetName("charlie");
156 VideoConfig video(160, 120, 15);
157 video.stream_label = "charlie-video";
158 video.temporal_layers_count = 2;
159 charlie->AddVideoConfig(std::move(video));
160
161 AudioConfig audio;
162 audio.stream_label = "charlie-audio";
163 audio.mode = AudioConfig::Mode::kFile;
164 audio.input_file_name =
165 test::ResourcePath("pc_quality_smoke_test_bob_source", "wav");
166 charlie->SetAudioConfig(std::move(audio));
167 charlie->SetVideoCodecs(
168 {VideoCodecConfig(cricket::kVp9CodecName, {{"profile-id", "0"}})});
169
170 charlie->SetUseFlexFEC(true);
171 charlie->SetUseUlpFEC(true);
172 charlie->SetVideoEncoderBitrateMultiplier(1.1);
173 });
174 fixture()->AddQualityMetricsReporter(
175 std::make_unique<StatsBasedNetworkQualityMetricsReporter>(
176 std::map<std::string, std::vector<EmulatedEndpoint*>>(
177 {{"alice", network_links.first->endpoints()},
178 {"charlie", network_links.second->endpoints()}}),
179 network_emulation(), test::GetGlobalMetricsLogger()));
180 RunParams run_params(TimeDelta::Seconds(2));
181 run_params.enable_flex_fec_support = true;
182 RunAndCheckEachVideoStreamReceivedFrames(run_params);
183 }
184
185 // IOS debug builds can be quite slow, disabling to avoid issues with timeouts.
186 #if defined(WEBRTC_IOS) && defined(WEBRTC_ARCH_ARM64) && !defined(NDEBUG)
187 #define MAYBE_Smoke DISABLED_Smoke
188 #else
189 #define MAYBE_SendAndReceivePacketsOnOneThread \
190 SmokeSendAndReceivePacketsOnOneThread
191 #endif
192 // Only use the network thread for sending and receiving packets.
193 // The one and only network thread is used as a worker thread in all
194 // PeerConnections. Pacing when sending packets is done on the worker thread.
195 // See bugs.webrtc.org/14502.
TEST_F(PeerConnectionE2EQualityTestSmokeTest,MAYBE_SendAndReceivePacketsOnOneThread)196 TEST_F(PeerConnectionE2EQualityTestSmokeTest,
197 MAYBE_SendAndReceivePacketsOnOneThread) {
198 test::ScopedFieldTrials trials(
199 std::string(field_trial::GetFieldTrialString()) +
200 "WebRTC-SendPacketsOnWorkerThread/Enabled/");
201
202 std::pair<EmulatedNetworkManagerInterface*, EmulatedNetworkManagerInterface*>
203 network_links = CreateNetwork();
204 AddPeer(network_links.first, [](PeerConfigurer* alice) {
205 // Peerconnection use the network thread as the worker thread.
206 alice->SetUseNetworkThreadAsWorkerThread();
207 VideoConfig video(160, 120, 15);
208 video.stream_label = "alice-video";
209 video.sync_group = "alice-media";
210 alice->AddVideoConfig(std::move(video));
211
212 AudioConfig audio;
213 audio.stream_label = "alice-audio";
214 audio.mode = AudioConfig::Mode::kFile;
215 audio.input_file_name =
216 test::ResourcePath("pc_quality_smoke_test_alice_source", "wav");
217 audio.sampling_frequency_in_hz = 48000;
218 audio.sync_group = "alice-media";
219 alice->SetAudioConfig(std::move(audio));
220 alice->SetVideoCodecs(
221 {VideoCodecConfig(cricket::kVp9CodecName, {{"profile-id", "0"}})});
222 });
223 AddPeer(network_links.second, [](PeerConfigurer* charlie) {
224 // Peerconnection use the network thread as the worker thread.
225 charlie->SetUseNetworkThreadAsWorkerThread();
226 charlie->SetName("charlie");
227 VideoConfig video(160, 120, 15);
228 video.stream_label = "charlie-video";
229 video.temporal_layers_count = 2;
230 charlie->AddVideoConfig(std::move(video));
231
232 AudioConfig audio;
233 audio.stream_label = "charlie-audio";
234 audio.mode = AudioConfig::Mode::kFile;
235 audio.input_file_name =
236 test::ResourcePath("pc_quality_smoke_test_bob_source", "wav");
237 charlie->SetAudioConfig(std::move(audio));
238 charlie->SetVideoCodecs(
239 {VideoCodecConfig(cricket::kVp9CodecName, {{"profile-id", "0"}})});
240 charlie->SetVideoEncoderBitrateMultiplier(1.1);
241 });
242 fixture()->AddQualityMetricsReporter(
243 std::make_unique<StatsBasedNetworkQualityMetricsReporter>(
244 std::map<std::string, std::vector<EmulatedEndpoint*>>(
245 {{"alice", network_links.first->endpoints()},
246 {"charlie", network_links.second->endpoints()}}),
247 network_emulation(), test::GetGlobalMetricsLogger()));
248 RunParams run_params(TimeDelta::Seconds(2));
249 RunAndCheckEachVideoStreamReceivedFrames(run_params);
250 }
251
252 #if defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
TEST_F(PeerConnectionE2EQualityTestSmokeTest,SmokeH264)253 TEST_F(PeerConnectionE2EQualityTestSmokeTest, SmokeH264) {
254 std::pair<EmulatedNetworkManagerInterface*, EmulatedNetworkManagerInterface*>
255 network_links = CreateNetwork();
256
257 AddPeer(network_links.first, [](PeerConfigurer* alice) {
258 VideoConfig video(160, 120, 15);
259 video.stream_label = "alice-video";
260 video.sync_group = "alice-media";
261 alice->AddVideoConfig(std::move(video));
262
263 AudioConfig audio;
264 audio.stream_label = "alice-audio";
265 audio.mode = AudioConfig::Mode::kFile;
266 audio.input_file_name =
267 test::ResourcePath("pc_quality_smoke_test_alice_source", "wav");
268 audio.sampling_frequency_in_hz = 48000;
269 audio.sync_group = "alice-media";
270 alice->SetAudioConfig(std::move(audio));
271 alice->SetVideoCodecs({VideoCodecConfig(cricket::kH264CodecName)});
272 alice->SetVideoEncoderFactory(webrtc::test::CreateObjCEncoderFactory());
273 alice->SetVideoDecoderFactory(webrtc::test::CreateObjCDecoderFactory());
274 });
275 AddPeer(network_links.second, [](PeerConfigurer* charlie) {
276 charlie->SetName("charlie");
277 VideoConfig video(160, 120, 15);
278 video.stream_label = "charlie-video";
279 video.temporal_layers_count = 2;
280 charlie->AddVideoConfig(std::move(video));
281
282 AudioConfig audio;
283 audio.stream_label = "charlie-audio";
284 audio.mode = AudioConfig::Mode::kFile;
285 audio.input_file_name =
286 test::ResourcePath("pc_quality_smoke_test_bob_source", "wav");
287 charlie->SetAudioConfig(std::move(audio));
288 charlie->SetVideoCodecs({VideoCodecConfig(cricket::kH264CodecName)});
289 charlie->SetVideoEncoderFactory(webrtc::test::CreateObjCEncoderFactory());
290 charlie->SetVideoDecoderFactory(webrtc::test::CreateObjCDecoderFactory());
291 });
292
293 fixture()->AddQualityMetricsReporter(
294 std::make_unique<StatsBasedNetworkQualityMetricsReporter>(
295 std::map<std::string, std::vector<EmulatedEndpoint*>>(
296 {{"alice", network_links.first->endpoints()},
297 {"charlie", network_links.second->endpoints()}}),
298 network_emulation(), test::GetGlobalMetricsLogger()));
299 RunParams run_params(TimeDelta::Seconds(2));
300 run_params.enable_flex_fec_support = true;
301 RunAndCheckEachVideoStreamReceivedFrames(run_params);
302 }
303 #endif
304
305 // IOS debug builds can be quite slow, disabling to avoid issues with timeouts.
306 #if defined(WEBRTC_IOS) && defined(WEBRTC_ARCH_ARM64) && !defined(NDEBUG)
307 #define MAYBE_ChangeNetworkConditions DISABLED_ChangeNetworkConditions
308 #else
309 #define MAYBE_ChangeNetworkConditions ChangeNetworkConditions
310 #endif
TEST_F(PeerConnectionE2EQualityTestSmokeTest,MAYBE_ChangeNetworkConditions)311 TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_ChangeNetworkConditions) {
312 NetworkEmulationManager::SimulatedNetworkNode alice_node =
313 network_emulation()
314 ->NodeBuilder()
315 .config(BuiltInNetworkBehaviorConfig())
316 .Build();
317 NetworkEmulationManager::SimulatedNetworkNode bob_node =
318 network_emulation()
319 ->NodeBuilder()
320 .config(BuiltInNetworkBehaviorConfig())
321 .Build();
322
323 EmulatedEndpoint* alice_endpoint =
324 network_emulation()->CreateEndpoint(EmulatedEndpointConfig());
325 EmulatedEndpoint* bob_endpoint =
326 network_emulation()->CreateEndpoint(EmulatedEndpointConfig());
327
328 network_emulation()->CreateRoute(alice_endpoint, {alice_node.node},
329 bob_endpoint);
330 network_emulation()->CreateRoute(bob_endpoint, {bob_node.node},
331 alice_endpoint);
332
333 EmulatedNetworkManagerInterface* alice_network =
334 network_emulation()->CreateEmulatedNetworkManagerInterface(
335 {alice_endpoint});
336 EmulatedNetworkManagerInterface* bob_network =
337 network_emulation()->CreateEmulatedNetworkManagerInterface(
338 {bob_endpoint});
339
340 AddPeer(alice_network, [](PeerConfigurer* alice) {
341 VideoConfig video(160, 120, 15);
342 video.stream_label = "alice-video";
343 video.sync_group = "alice-media";
344 alice->AddVideoConfig(std::move(video));
345 alice->SetVideoCodecs(
346 {VideoCodecConfig(cricket::kVp9CodecName, {{"profile-id", "0"}})});
347
348 alice->SetUseFlexFEC(true);
349 alice->SetUseUlpFEC(true);
350 alice->SetVideoEncoderBitrateMultiplier(1.1);
351 });
352 AddPeer(bob_network, [](PeerConfigurer* bob) {
353 bob->SetVideoCodecs(
354 {VideoCodecConfig(cricket::kVp9CodecName, {{"profile-id", "0"}})});
355
356 bob->SetUseFlexFEC(true);
357 bob->SetUseUlpFEC(true);
358 bob->SetVideoEncoderBitrateMultiplier(1.1);
359 });
360 fixture()->AddQualityMetricsReporter(
361 std::make_unique<StatsBasedNetworkQualityMetricsReporter>(
362 std::map<std::string, std::vector<EmulatedEndpoint*>>(
363 {{"alice", alice_network->endpoints()},
364 {"bob", bob_network->endpoints()}}),
365 network_emulation(), test::GetGlobalMetricsLogger()));
366
367 fixture()->ExecuteAt(TimeDelta::Seconds(1), [alice_node](TimeDelta) {
368 BuiltInNetworkBehaviorConfig config;
369 config.loss_percent = 5;
370 alice_node.simulation->SetConfig(config);
371 });
372
373 RunParams run_params(TimeDelta::Seconds(2));
374 run_params.enable_flex_fec_support = true;
375 RunAndCheckEachVideoStreamReceivedFrames(run_params);
376 }
377
378 // IOS debug builds can be quite slow, disabling to avoid issues with timeouts.
379 #if defined(WEBRTC_IOS) && defined(WEBRTC_ARCH_ARM64) && !defined(NDEBUG)
380 #define MAYBE_Screenshare DISABLED_Screenshare
381 #else
382 #define MAYBE_Screenshare Screenshare
383 #endif
TEST_F(PeerConnectionE2EQualityTestSmokeTest,MAYBE_Screenshare)384 TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_Screenshare) {
385 std::pair<EmulatedNetworkManagerInterface*, EmulatedNetworkManagerInterface*>
386 network_links = CreateNetwork();
387 AddPeer(network_links.first, [](PeerConfigurer* alice) {
388 VideoConfig screenshare(320, 180, 30);
389 screenshare.stream_label = "alice-screenshare";
390 screenshare.content_hint = VideoTrackInterface::ContentHint::kText;
391 ScreenShareConfig screen_share_config =
392 ScreenShareConfig(TimeDelta::Seconds(2));
393 screen_share_config.scrolling_params =
394 ScrollingParams{.duration = TimeDelta::Millis(1800)};
395 auto screen_share_frame_generator =
396 CreateScreenShareFrameGenerator(screenshare, screen_share_config);
397 alice->AddVideoConfig(std::move(screenshare),
398 std::move(screen_share_frame_generator));
399 });
400 AddPeer(network_links.second, [](PeerConfigurer* bob) {});
401 RunAndCheckEachVideoStreamReceivedFrames(RunParams(TimeDelta::Seconds(2)));
402 }
403
404 // IOS debug builds can be quite slow, disabling to avoid issues with timeouts.
405 #if defined(WEBRTC_IOS) && defined(WEBRTC_ARCH_ARM64) && !defined(NDEBUG)
406 #define MAYBE_Echo DISABLED_Echo
407 #else
408 #define MAYBE_Echo Echo
409 #endif
TEST_F(PeerConnectionE2EQualityTestSmokeTest,MAYBE_Echo)410 TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_Echo) {
411 std::pair<EmulatedNetworkManagerInterface*, EmulatedNetworkManagerInterface*>
412 network_links = CreateNetwork();
413 AddPeer(network_links.first, [](PeerConfigurer* alice) {
414 AudioConfig audio;
415 audio.stream_label = "alice-audio";
416 audio.mode = AudioConfig::Mode::kFile;
417 audio.input_file_name =
418 test::ResourcePath("pc_quality_smoke_test_alice_source", "wav");
419 audio.sampling_frequency_in_hz = 48000;
420 alice->SetAudioConfig(std::move(audio));
421 });
422 AddPeer(network_links.second, [](PeerConfigurer* bob) {
423 AudioConfig audio;
424 audio.stream_label = "bob-audio";
425 audio.mode = AudioConfig::Mode::kFile;
426 audio.input_file_name =
427 test::ResourcePath("pc_quality_smoke_test_bob_source", "wav");
428 bob->SetAudioConfig(std::move(audio));
429 });
430 RunParams run_params(TimeDelta::Seconds(2));
431 run_params.echo_emulation_config = EchoEmulationConfig();
432 RunAndCheckEachVideoStreamReceivedFrames(run_params);
433 }
434
435 // IOS debug builds can be quite slow, disabling to avoid issues with timeouts.
436 #if defined(WEBRTC_IOS) && defined(WEBRTC_ARCH_ARM64) && !defined(NDEBUG)
437 #define MAYBE_Simulcast DISABLED_Simulcast
438 #else
439 #define MAYBE_Simulcast Simulcast
440 #endif
TEST_F(PeerConnectionE2EQualityTestSmokeTest,MAYBE_Simulcast)441 TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_Simulcast) {
442 std::pair<EmulatedNetworkManagerInterface*, EmulatedNetworkManagerInterface*>
443 network_links = CreateNetwork();
444 AddPeer(network_links.first, [](PeerConfigurer* alice) {
445 VideoConfig simulcast(1280, 720, 15);
446 simulcast.stream_label = "alice-simulcast";
447 simulcast.simulcast_config = VideoSimulcastConfig(2);
448 simulcast.emulated_sfu_config = EmulatedSFUConfig(0);
449 alice->AddVideoConfig(std::move(simulcast));
450
451 AudioConfig audio;
452 audio.stream_label = "alice-audio";
453 audio.mode = AudioConfig::Mode::kFile;
454 audio.input_file_name =
455 test::ResourcePath("pc_quality_smoke_test_alice_source", "wav");
456 alice->SetAudioConfig(std::move(audio));
457 });
458 AddPeer(network_links.second, [](PeerConfigurer* bob) {});
459 RunParams run_params(TimeDelta::Seconds(2));
460 RunAndCheckEachVideoStreamReceivedFrames(run_params);
461 }
462
463 // IOS debug builds can be quite slow, disabling to avoid issues with timeouts.
464 #if defined(WEBRTC_IOS) && defined(WEBRTC_ARCH_ARM64) && !defined(NDEBUG)
465 #define MAYBE_Svc DISABLED_Svc
466 #else
467 #define MAYBE_Svc Svc
468 #endif
TEST_F(PeerConnectionE2EQualityTestSmokeTest,MAYBE_Svc)469 TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_Svc) {
470 std::pair<EmulatedNetworkManagerInterface*, EmulatedNetworkManagerInterface*>
471 network_links = CreateNetwork();
472 AddPeer(network_links.first, [](PeerConfigurer* alice) {
473 VideoConfig simulcast("alice-svc", 1280, 720, 15);
474 // Because we have network with packets loss we can analyze only the
475 // highest spatial layer in SVC mode.
476 simulcast.simulcast_config = VideoSimulcastConfig(2);
477 simulcast.emulated_sfu_config = EmulatedSFUConfig(1);
478 alice->AddVideoConfig(std::move(simulcast));
479
480 AudioConfig audio("alice-audio");
481 audio.mode = AudioConfig::Mode::kFile;
482 audio.input_file_name =
483 test::ResourcePath("pc_quality_smoke_test_alice_source", "wav");
484 alice->SetAudioConfig(std::move(audio));
485 alice->SetVideoCodecs({VideoCodecConfig(cricket::kVp9CodecName)});
486 });
487 AddPeer(network_links.second, [](PeerConfigurer* bob) {
488 bob->SetVideoCodecs({VideoCodecConfig(cricket::kVp9CodecName)});
489 });
490 RunParams run_params(TimeDelta::Seconds(2));
491 RunAndCheckEachVideoStreamReceivedFrames(run_params);
492 }
493
494 // IOS debug builds can be quite slow, disabling to avoid issues with timeouts.
495 #if defined(WEBRTC_IOS) && defined(WEBRTC_ARCH_ARM64) && !defined(NDEBUG)
496 #define MAYBE_HighBitrate DISABLED_HighBitrate
497 #else
498 #define MAYBE_HighBitrate HighBitrate
499 #endif
TEST_F(PeerConnectionE2EQualityTestSmokeTest,MAYBE_HighBitrate)500 TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_HighBitrate) {
501 std::pair<EmulatedNetworkManagerInterface*, EmulatedNetworkManagerInterface*>
502 network_links = CreateNetwork();
503 AddPeer(network_links.first, [](PeerConfigurer* alice) {
504 BitrateSettings bitrate_settings;
505 bitrate_settings.start_bitrate_bps = 3'000'000;
506 bitrate_settings.max_bitrate_bps = 3'000'000;
507 alice->SetBitrateSettings(bitrate_settings);
508 VideoConfig video(800, 600, 15);
509 video.stream_label = "alice-video";
510 RtpEncodingParameters encoding_parameters;
511 encoding_parameters.min_bitrate_bps = 500'000;
512 encoding_parameters.max_bitrate_bps = 3'000'000;
513 video.encoding_params.push_back(std::move(encoding_parameters));
514 alice->AddVideoConfig(std::move(video));
515
516 AudioConfig audio;
517 audio.stream_label = "alice-audio";
518 audio.mode = AudioConfig::Mode::kFile;
519 audio.input_file_name =
520 test::ResourcePath("pc_quality_smoke_test_alice_source", "wav");
521 audio.sampling_frequency_in_hz = 48000;
522 alice->SetAudioConfig(std::move(audio));
523 alice->SetVideoCodecs(
524 {VideoCodecConfig(cricket::kVp9CodecName, {{"profile-id", "0"}})});
525 });
526 AddPeer(network_links.second, [](PeerConfigurer* bob) {
527 bob->SetVideoCodecs(
528 {VideoCodecConfig(cricket::kVp9CodecName, {{"profile-id", "0"}})});
529 });
530 RunParams run_params(TimeDelta::Seconds(2));
531 RunAndCheckEachVideoStreamReceivedFrames(run_params);
532 }
533
534 } // namespace
535 } // namespace webrtc_pc_e2e
536 } // namespace webrtc
537