From 9a7e721f9df03e8e1ad50cabd0d98d9c7c4c7e6e Mon Sep 17 00:00:00 2001 From: Artem Titov Date: Thu, 28 Feb 2019 16:34:17 +0100 Subject: [PATCH] Use default values for video and audio streams generation in PC E2E framework Bug: webrtc:10138 Change-Id: I91591690f4f2202c32f211a492e96f1aa7844473 Reviewed-on: https://webrtc-review.googlesource.com/c/124986 Reviewed-by: Mirko Bonadei Commit-Queue: Artem Titov Cr-Commit-Position: refs/heads/master@{#26908} --- test/pc/e2e/api/peerconnection_quality_test_fixture.h | 8 +++++--- test/pc/e2e/peer_connection_e2e_smoke_test.cc | 8 -------- test/pc/e2e/peer_connection_quality_test.cc | 8 ++++++-- test/pc/e2e/peer_connection_quality_test.h | 8 +++++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/test/pc/e2e/api/peerconnection_quality_test_fixture.h b/test/pc/e2e/api/peerconnection_quality_test_fixture.h index 705c940ab7..0075562122 100644 --- a/test/pc/e2e/api/peerconnection_quality_test_fixture.h +++ b/test/pc/e2e/api/peerconnection_quality_test_fixture.h @@ -121,8 +121,10 @@ class PeerConnectionE2EQualityTestFixture { // Have to be unique among all specified configs for all peers in the call. // Will be auto generated if omitted. absl::optional stream_label; - // Only single from 3 next fields can be specified. - // If specified generator with this name will be used as input. + // Only 1 from |generator|, |input_file_name| and |screen_share_config| can + // be specified. If none of them are specified, then |generator| will be set + // to VideoGeneratorType::kDefault. + // If specified generator of this type will be used to produce input video. absl::optional generator; // If specified this file will be used as input. Input video will be played // in a circle. @@ -163,7 +165,7 @@ class PeerConnectionE2EQualityTestFixture { // Have to be unique among all specified configs for all peers in the call. // Will be auto generated if omitted. absl::optional stream_label; - Mode mode; + Mode mode = kGenerated; // Have to be specified only if mode = kFile absl::optional input_file_name; // If specified the input stream will be also copied to specified file. diff --git a/test/pc/e2e/peer_connection_e2e_smoke_test.cc b/test/pc/e2e/peer_connection_e2e_smoke_test.cc index 129f0c3467..b38ea534d8 100644 --- a/test/pc/e2e/peer_connection_e2e_smoke_test.cc +++ b/test/pc/e2e/peer_connection_e2e_smoke_test.cc @@ -53,8 +53,6 @@ void PrintFrameCounters(const std::string& name, TEST(PeerConnectionE2EQualityTestSmokeTest, RunWithEmulatedNetwork) { using Params = PeerConnectionE2EQualityTestFixture::Params; using RunParams = PeerConnectionE2EQualityTestFixture::RunParams; - using VideoGeneratorType = - PeerConnectionE2EQualityTestFixture::VideoGeneratorType; using VideoConfig = PeerConnectionE2EQualityTestFixture::VideoConfig; using AudioConfig = PeerConnectionE2EQualityTestFixture::AudioConfig; using InjectableComponents = @@ -63,22 +61,16 @@ TEST(PeerConnectionE2EQualityTestSmokeTest, RunWithEmulatedNetwork) { auto alice_params = absl::make_unique(); VideoConfig alice_video_config(1280, 720, 30); alice_video_config.stream_label = "alice-video"; - alice_video_config.generator = VideoGeneratorType::kDefault; alice_params->video_configs.push_back(alice_video_config); alice_params->audio_config = AudioConfig(); - alice_params->audio_config->mode = AudioConfig::Mode::kGenerated, - alice_params->audio_config->audio_options = cricket::AudioOptions(); auto bob_params = absl::make_unique(); VideoConfig bob_video_config(1280, 720, 30); bob_video_config.stream_label = "bob-video"; - bob_video_config.generator = VideoGeneratorType::kDefault; bob_params->video_configs.push_back(bob_video_config); bob_params->audio_config = AudioConfig(); - bob_params->audio_config->mode = AudioConfig::Mode::kGenerated, - bob_params->audio_config->audio_options = cricket::AudioOptions(); // Setup emulated network NetworkEmulationManager network_emulation_manager; diff --git a/test/pc/e2e/peer_connection_quality_test.cc b/test/pc/e2e/peer_connection_quality_test.cc index 5382ac66a8..c9862d7612 100644 --- a/test/pc/e2e/peer_connection_quality_test.cc +++ b/test/pc/e2e/peer_connection_quality_test.cc @@ -133,7 +133,7 @@ void PeerConnectionE2EQualityTest::Run( RTC_CHECK(bob_components); RTC_CHECK(bob_params); - SetMissedVideoStreamLabels({alice_params.get(), bob_params.get()}); + SetDefaultValuesForMissingParams({alice_params.get(), bob_params.get()}); ValidateParams({alice_params.get(), bob_params.get()}); // Print test summary @@ -264,7 +264,7 @@ void PeerConnectionE2EQualityTest::Run( RTC_CHECK(video_writers_.empty()); } -void PeerConnectionE2EQualityTest::SetMissedVideoStreamLabels( +void PeerConnectionE2EQualityTest::SetDefaultValuesForMissingParams( std::vector params) { int video_counter = 0; int audio_counter = 0; @@ -272,6 +272,10 @@ void PeerConnectionE2EQualityTest::SetMissedVideoStreamLabels( std::set audio_labels; for (auto* p : params) { for (auto& video_config : p->video_configs) { + if (!video_config.generator && !video_config.input_file_name && + !video_config.screen_share_config) { + video_config.generator = VideoGeneratorType::kDefault; + } if (!video_config.stream_label) { std::string label; do { diff --git a/test/pc/e2e/peer_connection_quality_test.h b/test/pc/e2e/peer_connection_quality_test.h index 1f635f2944..16d4019e72 100644 --- a/test/pc/e2e/peer_connection_quality_test.h +++ b/test/pc/e2e/peer_connection_quality_test.h @@ -55,9 +55,11 @@ class PeerConnectionE2EQualityTest RunParams run_params) override; private: - // Sets video stream labels that are not specified in VideoConfigs to unique - // generated values. - void SetMissedVideoStreamLabels(std::vector params); + // Set missing params to default values if it is required: + // * Generate video stream labels if some of them missed + // * Generate audio stream labels if some of them missed + // * Set video source generation mode if it is not specified + void SetDefaultValuesForMissingParams(std::vector params); // Validate peer's parameters, also ensure uniqueness of all video stream // labels. void ValidateParams(std::vector params);