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}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index d5c8229..833e319 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -285,6 +285,7 @@
sources = [ "test/video_quality_analyzer_interface.h" ]
deps = [
+ ":array_view",
":stats_observer_interface",
"video:encoded_image",
"video:video_frame",
diff --git a/api/test/video_quality_analyzer_interface.h b/api/test/video_quality_analyzer_interface.h
index 5bf8a1a..22114be 100644
--- a/api/test/video_quality_analyzer_interface.h
+++ b/api/test/video_quality_analyzer_interface.h
@@ -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 @@
// 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.
diff --git a/test/pc/e2e/BUILD.gn b/test/pc/e2e/BUILD.gn
index f31bd2c..165eac1 100644
--- a/test/pc/e2e/BUILD.gn
+++ b/test/pc/e2e/BUILD.gn
@@ -189,6 +189,7 @@
":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 @@
]
deps = [
+ "../../../api:array_view",
"../../../api:video_quality_analyzer_api",
"../../../api/video:encoded_image",
"../../../api/video:video_frame",
@@ -582,6 +584,7 @@
deps = [
"../..:perf_test",
+ "../../../api:array_view",
"../../../api:video_quality_analyzer_api",
"../../../api/units:time_delta",
"../../../api/units:timestamp",
diff --git a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc
index b09292b..bada999 100644
--- a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc
+++ b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc
@@ -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 @@
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>(
diff --git a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h
index 2f83f23..b816876 100644
--- a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h
+++ b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h
@@ -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 @@
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;
diff --git a/test/pc/e2e/analyzer/video/default_video_quality_analyzer_test.cc b/test/pc/e2e/analyzer/video/default_video_quality_analyzer_test.cc
index ef6baf9..973460f 100644
--- a/test/pc/e2e/analyzer/video/default_video_quality_analyzer_test.cc
+++ b/test/pc/e2e/analyzer/video/default_video_quality_analyzer_test.cc
@@ -75,7 +75,9 @@
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 @@
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 @@
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;
diff --git a/test/pc/e2e/analyzer/video/example_video_quality_analyzer.cc b/test/pc/e2e/analyzer/video/example_video_quality_analyzer.cc
index 4488234..a980b0e 100644
--- a/test/pc/e2e/analyzer/video/example_video_quality_analyzer.cc
+++ b/test/pc/e2e/analyzer/video/example_video_quality_analyzer.cc
@@ -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 @@
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,
diff --git a/test/pc/e2e/analyzer/video/example_video_quality_analyzer.h b/test/pc/e2e/analyzer/video/example_video_quality_analyzer.h
index a4a1104..0126093 100644
--- a/test/pc/e2e/analyzer/video/example_video_quality_analyzer.h
+++ b/test/pc/e2e/analyzer/video/example_video_quality_analyzer.h
@@ -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 @@
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;
diff --git a/test/pc/e2e/analyzer/video/video_quality_analyzer_injection_helper.cc b/test/pc/e2e/analyzer/video/video_quality_analyzer_injection_helper.cc
index 7410954..d96fde0 100644
--- a/test/pc/e2e/analyzer/video/video_quality_analyzer_injection_helper.cc
+++ b/test/pc/e2e/analyzer/video/video_quality_analyzer_injection_helper.cc
@@ -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 @@
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(
diff --git a/test/pc/e2e/analyzer/video/video_quality_analyzer_injection_helper.h b/test/pc/e2e/analyzer/video/video_quality_analyzer_injection_helper.h
index 3dfc0af..c412ea1 100644
--- a/test/pc/e2e/analyzer/video/video_quality_analyzer_injection_helper.h
+++ b/test/pc/e2e/analyzer/video/video_quality_analyzer_injection_helper.h
@@ -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 @@
// 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_|.
diff --git a/test/pc/e2e/peer_connection_quality_test.cc b/test/pc/e2e/peer_connection_quality_test.cc
index cea4955..362c7c0 100644
--- a/test/pc/e2e/peer_connection_quality_test.cc
+++ b/test/pc/e2e/peer_connection_quality_test.cc
@@ -252,8 +252,11 @@
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_);