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}
This commit is contained in:
Mirko Bonadei
2019-02-20 16:16:54 +01:00
committed by Commit Bot
parent 22f9925b3e
commit f5d8808d93
7 changed files with 30 additions and 33 deletions

View File

@ -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",
]

View File

@ -19,9 +19,10 @@ namespace webrtc {
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

View File

@ -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 @@ namespace webrtc {
// 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

View File

@ -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<AudioQualityAnalyzerInterface> audio_quality_analyzer;
std::unique_ptr<VideoQualityAnalyzerInterface> video_quality_analyzer;
};
// Contains parameters, that describe how long framework should run quality
// test.
struct RunParams {

View File

@ -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>();
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 @@ 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

View File

@ -91,23 +91,20 @@ class FixturePeerConnectionObserver : public MockPeerConnectionObserver {
} // 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());
}

View File

@ -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> analyzers);
PeerConnectionE2EQualityTest(
std::unique_ptr<AudioQualityAnalyzerInterface> audio_quality_analyzer,
std::unique_ptr<VideoQualityAnalyzerInterface> video_quality_analyzer);
~PeerConnectionE2EQualityTest() override = default;