Remove Analyzers struct.

Bug: webrtc:10138
Change-Id: I85d60a0e82c48cf537b9c36d726389edaaa9f060
Reviewed-on: https://webrtc-review.googlesource.com/c/123520
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26781}
diff --git a/test/pc/e2e/api/BUILD.gn b/test/pc/e2e/api/BUILD.gn
index 8d8c822..6b7a112 100644
--- a/test/pc/e2e/api/BUILD.gn
+++ b/test/pc/e2e/api/BUILD.gn
@@ -64,7 +64,9 @@
     ]
 
     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 3732dab..36bfb77 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 @@
 
 std::unique_ptr<PeerConnectionE2EQualityTestFixture>
 CreatePeerConnectionE2EQualityTestFixture(
-    std::unique_ptr<PeerConnectionE2EQualityTestFixture::Analyzers> analyzers) {
+    std::unique_ptr<AudioQualityAnalyzerInterface> audio_quality_analyzer,
+    std::unique_ptr<VideoQualityAnalyzerInterface> video_quality_analyzer) {
   return absl::make_unique<webrtc::test::PeerConnectionE2EQualityTest>(
-      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 09b71d5..85434df 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 <memory>
 
+#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 @@
 // During the test Alice will be caller and Bob will answer the call.
 std::unique_ptr<PeerConnectionE2EQualityTestFixture>
 CreatePeerConnectionE2EQualityTestFixture(
-    std::unique_ptr<PeerConnectionE2EQualityTestFixture::Analyzers> analyzers);
+    std::unique_ptr<AudioQualityAnalyzerInterface> audio_quality_analyzer,
+    std::unique_ptr<VideoQualityAnalyzerInterface> 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 57bff9b..79354a2 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 @@
     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<AudioQualityAnalyzerInterface> audio_quality_analyzer;
-    std::unique_ptr<VideoQualityAnalyzerInterface> 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 0cfe3d9..e20ba52 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 @@
   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 @@
       CreateFakeNetworkManager({bob_endpoint});
 
   // Create analyzers.
-  auto analyzers = absl::make_unique<Analyzers>();
-  analyzers->video_quality_analyzer =
+  std::unique_ptr<VideoQualityAnalyzerInterface> video_quality_analyzer =
       absl::make_unique<DefaultVideoQualityAnalyzer>("smoke_test");
-  auto* video_analyzer = static_cast<DefaultVideoQualityAnalyzer*>(
-      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<DefaultVideoQualityAnalyzer*>(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<Params>(),
                RunParams{TimeDelta::seconds(5)});
@@ -115,12 +115,12 @@
   // 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 8b36062..d2d8551 100644
--- a/test/pc/e2e/peer_connection_quality_test.cc
+++ b/test/pc/e2e/peer_connection_quality_test.cc
@@ -91,23 +91,20 @@
 }  // namespace
 
 PeerConnectionE2EQualityTest::PeerConnectionE2EQualityTest(
-    std::unique_ptr<Analyzers> analyzers)
+    std::unique_ptr<AudioQualityAnalyzerInterface> audio_quality_analyzer,
+    std::unique_ptr<VideoQualityAnalyzerInterface> 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<ExampleVideoQualityAnalyzer>();
+  if (video_quality_analyzer == nullptr) {
+    video_quality_analyzer = absl::make_unique<ExampleVideoQualityAnalyzer>();
   }
   encoded_image_id_controller_ =
       absl::make_unique<SingleProcessEncodedImageIdInjector>();
   video_quality_analyzer_injection_helper_ =
       absl::make_unique<VideoQualityAnalyzerInjectionHelper>(
-          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 23099a7..f401b63 100644
--- a/test/pc/e2e/peer_connection_quality_test.h
+++ b/test/pc/e2e/peer_connection_quality_test.h
@@ -31,7 +31,6 @@
     : public PeerConnectionE2EQualityTestFixture {
  public:
   using Params = PeerConnectionE2EQualityTestFixture::Params;
-  using Analyzers = PeerConnectionE2EQualityTestFixture::Analyzers;
   using InjectableComponents =
       PeerConnectionE2EQualityTestFixture::InjectableComponents;
   using VideoGeneratorType =
@@ -39,7 +38,9 @@
   using RunParams = PeerConnectionE2EQualityTestFixture::RunParams;
   using VideoConfig = PeerConnectionE2EQualityTestFixture::VideoConfig;
 
-  PeerConnectionE2EQualityTest(std::unique_ptr<Analyzers> analyzers);
+  PeerConnectionE2EQualityTest(
+      std::unique_ptr<AudioQualityAnalyzerInterface> audio_quality_analyzer,
+      std::unique_ptr<VideoQualityAnalyzerInterface> video_quality_analyzer);
 
   ~PeerConnectionE2EQualityTest() override = default;