Add list of participants to the start method of video analyzer.

To support multiple participants video quality analyzer may need to know
peer names in advance to simplify internal structures and metrics
reporting.

Bug: webrtc:11631
Change-Id: I4ffb1554ab7f0e015b8e937b7ffddd55aba9826f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176364
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Andrey Logvin <landrey@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31415}
This commit is contained in:
Artem Titov
2020-06-02 17:18:17 +02:00
committed by Commit Bot
parent 43ccfecdb7
commit 3b641675de
11 changed files with 54 additions and 19 deletions

View File

@ -285,6 +285,7 @@ rtc_source_set("video_quality_analyzer_api") {
sources = [ "test/video_quality_analyzer_interface.h" ]
deps = [
":array_view",
":stats_observer_interface",
"video:encoded_image",
"video:video_frame",

View File

@ -16,6 +16,7 @@
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/test/stats_observer_interface.h"
#include "api/video/encoded_image.h"
#include "api/video/video_frame.h"
@ -77,7 +78,9 @@ class VideoQualityAnalyzerInterface : public StatsObserverInterface {
// calculations. Analyzer can perform simple calculations on the calling
// thread in each method, but should remember, that it is the same thread,
// that is used in video pipeline.
virtual void Start(std::string test_case_name, int max_threads_count) {}
virtual void Start(std::string test_case_name,
rtc::ArrayView<const std::string> peer_names,
int max_threads_count) {}
// Will be called when frame was generated from the input stream.
// |peer_name| is name of the peer on which side frame was captured.

View File

@ -189,6 +189,7 @@ if (rtc_include_tests) {
":quality_analyzing_video_encoder",
":simulcast_dummy_buffer_helper",
"../..:test_renderer",
"../../../api:array_view",
"../../../api:peer_connection_quality_test_fixture_api",
"../../../api:stats_observer_interface",
"../../../api:video_quality_analyzer_api",
@ -546,6 +547,7 @@ rtc_library("example_video_quality_analyzer") {
]
deps = [
"../../../api:array_view",
"../../../api:video_quality_analyzer_api",
"../../../api/video:encoded_image",
"../../../api/video:video_frame",
@ -582,6 +584,7 @@ rtc_library("default_video_quality_analyzer") {
deps = [
"../..:perf_test",
"../../../api:array_view",
"../../../api:video_quality_analyzer_api",
"../../../api/units:time_delta",
"../../../api/units:timestamp",

View File

@ -14,6 +14,7 @@
#include <memory>
#include <utility>
#include "api/array_view.h"
#include "api/units/time_delta.h"
#include "api/video/i420_buffer.h"
#include "common_video/libyuv/include/webrtc_libyuv.h"
@ -76,8 +77,10 @@ DefaultVideoQualityAnalyzer::~DefaultVideoQualityAnalyzer() {
Stop();
}
void DefaultVideoQualityAnalyzer::Start(std::string test_case_name,
int max_threads_count) {
void DefaultVideoQualityAnalyzer::Start(
std::string test_case_name,
rtc::ArrayView<const std::string> peer_names,
int max_threads_count) {
test_label_ = std::move(test_case_name);
for (int i = 0; i < max_threads_count; i++) {
auto thread = std::make_unique<rtc::PlatformThread>(

View File

@ -19,6 +19,7 @@
#include <string>
#include <vector>
#include "api/array_view.h"
#include "api/test/video_quality_analyzer_interface.h"
#include "api/units/timestamp.h"
#include "api/video/encoded_image.h"
@ -134,7 +135,9 @@ class DefaultVideoQualityAnalyzer : public VideoQualityAnalyzerInterface {
kDefaultMaxFramesInFlightPerStream);
~DefaultVideoQualityAnalyzer() override;
void Start(std::string test_case_name, int max_threads_count) override;
void Start(std::string test_case_name,
rtc::ArrayView<const std::string> peer_names,
int max_threads_count) override;
uint16_t OnFrameCaptured(absl::string_view peer_name,
const std::string& stream_label,
const VideoFrame& frame) override;

View File

@ -75,7 +75,9 @@ TEST(DefaultVideoQualityAnalyzerTest,
DefaultVideoQualityAnalyzer analyzer(
/*heavy_metrics_computation_enabled=*/false, kMaxFramesInFlightPerStream);
analyzer.Start("test_case", kAnalyzerMaxThreadsCount);
analyzer.Start("test_case",
std::vector<std::string>{kSenderPeerName, kReceiverPeerName},
kAnalyzerMaxThreadsCount);
std::map<uint16_t, VideoFrame> captured_frames;
std::vector<uint16_t> frames_order;
@ -124,7 +126,9 @@ TEST(DefaultVideoQualityAnalyzerTest,
DefaultVideoQualityAnalyzer analyzer(
/*heavy_metrics_computation_enabled=*/false, kMaxFramesInFlightPerStream);
analyzer.Start("test_case", kAnalyzerMaxThreadsCount);
analyzer.Start("test_case",
std::vector<std::string>{kSenderPeerName, kReceiverPeerName},
kAnalyzerMaxThreadsCount);
std::map<uint16_t, VideoFrame> captured_frames;
std::vector<uint16_t> frames_order;
@ -172,7 +176,9 @@ TEST(DefaultVideoQualityAnalyzerTest, NormalScenario) {
DefaultVideoQualityAnalyzer analyzer(
/*heavy_metrics_computation_enabled=*/false, kMaxFramesInFlightPerStream);
analyzer.Start("test_case", kAnalyzerMaxThreadsCount);
analyzer.Start("test_case",
std::vector<std::string>{kSenderPeerName, kReceiverPeerName},
kAnalyzerMaxThreadsCount);
std::map<uint16_t, VideoFrame> captured_frames;
std::vector<uint16_t> frames_order;

View File

@ -10,6 +10,7 @@
#include "test/pc/e2e/analyzer/video/example_video_quality_analyzer.h"
#include "api/array_view.h"
#include "rtc_base/logging.h"
namespace webrtc {
@ -18,8 +19,10 @@ namespace webrtc_pc_e2e {
ExampleVideoQualityAnalyzer::ExampleVideoQualityAnalyzer() = default;
ExampleVideoQualityAnalyzer::~ExampleVideoQualityAnalyzer() = default;
void ExampleVideoQualityAnalyzer::Start(std::string test_case_name,
int max_threads_count) {}
void ExampleVideoQualityAnalyzer::Start(
std::string test_case_name,
rtc::ArrayView<const std::string> peer_names,
int max_threads_count) {}
uint16_t ExampleVideoQualityAnalyzer::OnFrameCaptured(
absl::string_view peer_name,

View File

@ -16,6 +16,7 @@
#include <set>
#include <string>
#include "api/array_view.h"
#include "api/test/video_quality_analyzer_interface.h"
#include "api/video/encoded_image.h"
#include "api/video/video_frame.h"
@ -33,7 +34,9 @@ class ExampleVideoQualityAnalyzer : public VideoQualityAnalyzerInterface {
ExampleVideoQualityAnalyzer();
~ExampleVideoQualityAnalyzer() override;
void Start(std::string test_case_name, int max_threads_count) override;
void Start(std::string test_case_name,
rtc::ArrayView<const std::string> peer_names,
int max_threads_count) override;
uint16_t OnFrameCaptured(absl::string_view peer_name,
const std::string& stream_label,
const VideoFrame& frame) override;

View File

@ -15,6 +15,7 @@
#include "absl/memory/memory.h"
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "test/pc/e2e/analyzer/video/quality_analyzing_video_decoder.h"
#include "test/pc/e2e/analyzer/video/quality_analyzing_video_encoder.h"
#include "test/pc/e2e/analyzer/video/simulcast_dummy_buffer_helper.h"
@ -143,9 +144,11 @@ VideoQualityAnalyzerInjectionHelper::CreateVideoSink(
return std::make_unique<AnalyzingVideoSink>(peer_name, this);
}
void VideoQualityAnalyzerInjectionHelper::Start(std::string test_case_name,
int max_threads_count) {
analyzer_->Start(std::move(test_case_name), max_threads_count);
void VideoQualityAnalyzerInjectionHelper::Start(
std::string test_case_name,
rtc::ArrayView<const std::string> peer_names,
int max_threads_count) {
analyzer_->Start(std::move(test_case_name), peer_names, max_threads_count);
}
void VideoQualityAnalyzerInjectionHelper::OnStatsReports(

View File

@ -14,8 +14,10 @@
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/test/peerconnection_quality_test_fixture.h"
#include "api/test/stats_observer_interface.h"
#include "api/test/video_quality_analyzer_interface.h"
@ -70,11 +72,13 @@ class VideoQualityAnalyzerInjectionHelper : public StatsObserverInterface {
// into that file.
std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>> CreateVideoSink(
absl::string_view peer_name);
std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>> CreateVideoSink() {
return CreateVideoSink("unknown");
}
void Start(std::string test_case_name, int max_threads_count);
void Start(std::string test_case_name,
rtc::ArrayView<const std::string> peer_names,
int max_threads_count);
void Start(std::string test_case_name, int max_threads_count) {
Start(test_case_name, std::vector<std::string>{}, max_threads_count);
}
// Forwards |stats_reports| for Peer Connection |pc_label| to
// |analyzer_|.

View File

@ -252,8 +252,11 @@ void PeerConnectionE2EQualityTest::Run(RunParams run_params) {
quality_metrics_reporters_.push_back(
std::make_unique<VideoQualityMetricsReporter>());
video_quality_analyzer_injection_helper_->Start(test_case_name_,
video_analyzer_threads);
video_quality_analyzer_injection_helper_->Start(
test_case_name_,
std::vector<std::string>{alice_->params()->name.value(),
bob_->params()->name.value()},
video_analyzer_threads);
audio_quality_analyzer_->Start(test_case_name_, &analyzer_helper_);
for (auto& reporter : quality_metrics_reporters_) {
reporter->Start(test_case_name_);