diff --git a/test/pc/e2e/api/BUILD.gn b/test/pc/e2e/api/BUILD.gn index 8d8c8220d6..6b7a11280b 100644 --- a/test/pc/e2e/api/BUILD.gn +++ b/test/pc/e2e/api/BUILD.gn @@ -64,7 +64,9 @@ if (rtc_include_tests) { ] deps = [ + ":audio_quality_analyzer_api", ":peer_connection_quality_test_fixture_api", + ":video_quality_analyzer_api", "../:peerconnection_quality_test", "//third_party/abseil-cpp/absl/memory:memory", ] diff --git a/test/pc/e2e/api/create_peerconnection_quality_test_fixture.cc b/test/pc/e2e/api/create_peerconnection_quality_test_fixture.cc index 3732dab93b..36bfb7739a 100644 --- a/test/pc/e2e/api/create_peerconnection_quality_test_fixture.cc +++ b/test/pc/e2e/api/create_peerconnection_quality_test_fixture.cc @@ -19,9 +19,10 @@ namespace webrtc { std::unique_ptr CreatePeerConnectionE2EQualityTestFixture( - std::unique_ptr analyzers) { + std::unique_ptr audio_quality_analyzer, + std::unique_ptr video_quality_analyzer) { return absl::make_unique( - std::move(analyzers)); + std::move(audio_quality_analyzer), std::move(video_quality_analyzer)); } } // namespace webrtc diff --git a/test/pc/e2e/api/create_peerconnection_quality_test_fixture.h b/test/pc/e2e/api/create_peerconnection_quality_test_fixture.h index 09b71d53b1..85434df162 100644 --- a/test/pc/e2e/api/create_peerconnection_quality_test_fixture.h +++ b/test/pc/e2e/api/create_peerconnection_quality_test_fixture.h @@ -12,7 +12,9 @@ #include +#include "test/pc/e2e/api/audio_quality_analyzer_interface.h" #include "test/pc/e2e/api/peerconnection_quality_test_fixture.h" +#include "test/pc/e2e/api/video_quality_analyzer_interface.h" namespace webrtc { @@ -21,7 +23,8 @@ namespace webrtc { // During the test Alice will be caller and Bob will answer the call. std::unique_ptr CreatePeerConnectionE2EQualityTestFixture( - std::unique_ptr analyzers); + std::unique_ptr audio_quality_analyzer, + std::unique_ptr video_quality_analyzer); } // namespace webrtc diff --git a/test/pc/e2e/api/peerconnection_quality_test_fixture.h b/test/pc/e2e/api/peerconnection_quality_test_fixture.h index 57bff9bd46..79354a283c 100644 --- a/test/pc/e2e/api/peerconnection_quality_test_fixture.h +++ b/test/pc/e2e/api/peerconnection_quality_test_fixture.h @@ -166,13 +166,6 @@ class PeerConnectionE2EQualityTestFixture { PeerConnectionInterface::RTCConfiguration rtc_configuration; }; - // Contains analyzers for audio and video stream. Both of them are optional - // and default implementations will be provided, if any will be omitted. - struct Analyzers { - std::unique_ptr audio_quality_analyzer; - std::unique_ptr video_quality_analyzer; - }; - // Contains parameters, that describe how long framework should run quality // test. struct RunParams { diff --git a/test/pc/e2e/peer_connection_e2e_smoke_test.cc b/test/pc/e2e/peer_connection_e2e_smoke_test.cc index 0cfe3d98d1..e20ba52e05 100644 --- a/test/pc/e2e/peer_connection_e2e_smoke_test.cc +++ b/test/pc/e2e/peer_connection_e2e_smoke_test.cc @@ -44,7 +44,6 @@ TEST(PeerConnectionE2EQualityTestSmokeTest, RunWithEmulatedNetwork) { using RunParams = PeerConnectionE2EQualityTestFixture::RunParams; using VideoGeneratorType = PeerConnectionE2EQualityTestFixture::VideoGeneratorType; - using Analyzers = PeerConnectionE2EQualityTestFixture::Analyzers; using VideoConfig = PeerConnectionE2EQualityTestFixture::VideoConfig; using AudioConfig = PeerConnectionE2EQualityTestFixture::AudioConfig; using InjectableComponents = @@ -99,14 +98,15 @@ TEST(PeerConnectionE2EQualityTestSmokeTest, RunWithEmulatedNetwork) { CreateFakeNetworkManager({bob_endpoint}); // Create analyzers. - auto analyzers = absl::make_unique(); - analyzers->video_quality_analyzer = + std::unique_ptr video_quality_analyzer = absl::make_unique("smoke_test"); - auto* video_analyzer = static_cast( - analyzers->video_quality_analyzer.get()); + // This is only done for the sake of smoke testing. In general there should + // be no need to explicitly pull data from analyzers after the run. + auto* video_analyzer_ptr = + static_cast(video_quality_analyzer.get()); - auto fixture = - CreatePeerConnectionE2EQualityTestFixture(std::move(analyzers)); + auto fixture = CreatePeerConnectionE2EQualityTestFixture( + nullptr, std::move(video_quality_analyzer)); fixture->Run(std::move(alice_components), std::move(alice_params), std::move(bob_components), absl::make_unique(), RunParams{TimeDelta::seconds(5)}); @@ -115,12 +115,12 @@ TEST(PeerConnectionE2EQualityTestSmokeTest, RunWithEmulatedNetwork) { // happen, that frames will stuck in the middle, so we actually can't force // real constraints here, so lets just check, that at least 1 frame passed // whole pipeline. - EXPECT_GE(video_analyzer->GetGlobalCounters().captured, 150); - EXPECT_GE(video_analyzer->GetGlobalCounters().pre_encoded, 1); - EXPECT_GE(video_analyzer->GetGlobalCounters().encoded, 1); - EXPECT_GE(video_analyzer->GetGlobalCounters().received, 1); - EXPECT_GE(video_analyzer->GetGlobalCounters().decoded, 1); - EXPECT_GE(video_analyzer->GetGlobalCounters().rendered, 1); + EXPECT_GE(video_analyzer_ptr->GetGlobalCounters().captured, 150); + EXPECT_GE(video_analyzer_ptr->GetGlobalCounters().pre_encoded, 1); + EXPECT_GE(video_analyzer_ptr->GetGlobalCounters().encoded, 1); + EXPECT_GE(video_analyzer_ptr->GetGlobalCounters().received, 1); + EXPECT_GE(video_analyzer_ptr->GetGlobalCounters().decoded, 1); + EXPECT_GE(video_analyzer_ptr->GetGlobalCounters().rendered, 1); } } // namespace test diff --git a/test/pc/e2e/peer_connection_quality_test.cc b/test/pc/e2e/peer_connection_quality_test.cc index 8b360626a0..d2d8551b4c 100644 --- a/test/pc/e2e/peer_connection_quality_test.cc +++ b/test/pc/e2e/peer_connection_quality_test.cc @@ -91,23 +91,20 @@ class FixturePeerConnectionObserver : public MockPeerConnectionObserver { } // namespace PeerConnectionE2EQualityTest::PeerConnectionE2EQualityTest( - std::unique_ptr analyzers) + std::unique_ptr audio_quality_analyzer, + std::unique_ptr video_quality_analyzer) : clock_(Clock::GetRealTimeClock()), task_queue_("pc_e2e_quality_test") { - RTC_CHECK(analyzers); - // Create default video quality analyzer. We will always create an analyzer, // even if there are no video streams, because it will be installed into video // encoder/decoder factories. - if (analyzers->video_quality_analyzer == nullptr) { - analyzers->video_quality_analyzer = - absl::make_unique(); + if (video_quality_analyzer == nullptr) { + video_quality_analyzer = absl::make_unique(); } encoded_image_id_controller_ = absl::make_unique(); video_quality_analyzer_injection_helper_ = absl::make_unique( - std::move(analyzers->video_quality_analyzer), - encoded_image_id_controller_.get(), + std::move(video_quality_analyzer), encoded_image_id_controller_.get(), encoded_image_id_controller_.get()); } diff --git a/test/pc/e2e/peer_connection_quality_test.h b/test/pc/e2e/peer_connection_quality_test.h index 23099a73be..f401b639cc 100644 --- a/test/pc/e2e/peer_connection_quality_test.h +++ b/test/pc/e2e/peer_connection_quality_test.h @@ -31,7 +31,6 @@ class PeerConnectionE2EQualityTest : public PeerConnectionE2EQualityTestFixture { public: using Params = PeerConnectionE2EQualityTestFixture::Params; - using Analyzers = PeerConnectionE2EQualityTestFixture::Analyzers; using InjectableComponents = PeerConnectionE2EQualityTestFixture::InjectableComponents; using VideoGeneratorType = @@ -39,7 +38,9 @@ class PeerConnectionE2EQualityTest using RunParams = PeerConnectionE2EQualityTestFixture::RunParams; using VideoConfig = PeerConnectionE2EQualityTestFixture::VideoConfig; - PeerConnectionE2EQualityTest(std::unique_ptr analyzers); + PeerConnectionE2EQualityTest( + std::unique_ptr audio_quality_analyzer, + std::unique_ptr video_quality_analyzer); ~PeerConnectionE2EQualityTest() override = default;