Add Start method with TrackIdStreamLabelMap to PeerConnectionE2EQualityTestFixture::QualityMetricsReporter

Bug: webrtc:11381
Change-Id: I55b671e9a2928da3d204030654d4eee2a5893448
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178360
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Andrey Logvin <landrey@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31598}
This commit is contained in:
Andrey Logvin 2020-06-30 12:54:23 +00:00 committed by Commit Bot
parent f279d7c8f9
commit 9d841fb1f5
8 changed files with 30 additions and 6 deletions

View File

@ -377,6 +377,7 @@ rtc_source_set("peer_connection_quality_test_fixture_api") {
":rtp_parameters",
":simulated_network_api",
":stats_observer_interface",
":track_id_stream_label_map",
":video_quality_analyzer_api",
"../media:rtc_media_base",
"../rtc_base:deprecation",

View File

@ -32,6 +32,7 @@
#include "api/test/frame_generator_interface.h"
#include "api/test/simulated_network.h"
#include "api/test/stats_observer_interface.h"
#include "api/test/track_id_stream_label_map.h"
#include "api/test/video_quality_analyzer_interface.h"
#include "api/transport/network_control.h"
#include "api/units/time_delta.h"
@ -411,7 +412,19 @@ class PeerConnectionE2EQualityTestFixture {
// Invoked by framework after peer connection factory and peer connection
// itself will be created but before offer/answer exchange will be started.
virtual void Start(absl::string_view test_case_name) = 0;
// |test_case_name| is name of test case, that should be used to report all
// metrics.
// |reporter_helper| is a pointer to a class that will allow track_id to
// stream_id matching. The caller is responsible for ensuring the
// TrackIdStreamLabelMap will be valid from Start() to
// StopAndReportResults().
virtual void Start(absl::string_view test_case_name,
const TrackIdStreamLabelMap* reporter_helper) = 0;
// This method has been added for backwards compatibility with upstream
// project.
void Start(absl::string_view test_case_name) {
Start(test_case_name, nullptr);
}
// Invoked by framework after call is ended and peer connection factory and
// peer connection are destroyed.

View File

@ -593,6 +593,7 @@ if (!build_with_chromium) {
"../..:perf_test",
"../../../api:peer_connection_quality_test_fixture_api",
"../../../api:rtc_stats_api",
"../../../api:track_id_stream_label_map",
"../../../api/units:data_rate",
"../../../api/units:data_size",
"../../../api/units:time_delta",
@ -646,6 +647,7 @@ if (!build_with_chromium) {
"../../../api:network_emulation_manager_api",
"../../../api:peer_connection_quality_test_fixture_api",
"../../../api:rtc_stats_api",
"../../../api:track_id_stream_label_map",
"../../../api/units:data_size",
"../../../rtc_base:criticalsection",
"../../../rtc_base:rtc_event",

View File

@ -19,7 +19,9 @@
namespace webrtc {
namespace webrtc_pc_e2e {
void VideoQualityMetricsReporter::Start(absl::string_view test_case_name) {
void VideoQualityMetricsReporter::Start(
absl::string_view test_case_name,
const TrackIdStreamLabelMap* /*reporter_helper*/) {
test_case_name_ = std::string(test_case_name);
start_time_ = Now();
}

View File

@ -15,6 +15,7 @@
#include <string>
#include "api/test/peerconnection_quality_test_fixture.h"
#include "api/test/track_id_stream_label_map.h"
#include "api/units/data_size.h"
#include "api/units/timestamp.h"
#include "rtc_base/critical_section.h"
@ -36,7 +37,8 @@ class VideoQualityMetricsReporter
VideoQualityMetricsReporter(Clock* const clock) : clock_(clock) {}
~VideoQualityMetricsReporter() override = default;
void Start(absl::string_view test_case_name) override;
void Start(absl::string_view test_case_name,
const TrackIdStreamLabelMap* reporter_helper) override;
void OnStatsReports(
absl::string_view pc_label,
const rtc::scoped_refptr<const RTCStatsReport>& report) override;

View File

@ -29,7 +29,9 @@ constexpr int kStatsWaitTimeoutMs = 1000;
constexpr char kUseStandardBytesStats[] = "WebRTC-UseStandardBytesStats";
}
void NetworkQualityMetricsReporter::Start(absl::string_view test_case_name) {
void NetworkQualityMetricsReporter::Start(
absl::string_view test_case_name,
const TrackIdStreamLabelMap* /*reporter_helper*/) {
test_case_name_ = std::string(test_case_name);
// Check that network stats are clean before test execution.
EmulatedNetworkStats alice_stats = PopulateStats(alice_network_);

View File

@ -15,6 +15,7 @@
#include "api/test/network_emulation_manager.h"
#include "api/test/peerconnection_quality_test_fixture.h"
#include "api/test/track_id_stream_label_map.h"
#include "api/units/data_size.h"
#include "rtc_base/critical_section.h"
@ -30,7 +31,8 @@ class NetworkQualityMetricsReporter
~NetworkQualityMetricsReporter() override = default;
// Network stats must be empty when this method will be invoked.
void Start(absl::string_view test_case_name) override;
void Start(absl::string_view test_case_name,
const TrackIdStreamLabelMap* reporter_helper) override;
void OnStatsReports(
absl::string_view pc_label,
const rtc::scoped_refptr<const RTCStatsReport>& report) override;

View File

@ -259,7 +259,7 @@ void PeerConnectionE2EQualityTest::Run(RunParams run_params) {
video_analyzer_threads);
audio_quality_analyzer_->Start(test_case_name_, &analyzer_helper_);
for (auto& reporter : quality_metrics_reporters_) {
reporter->Start(test_case_name_);
reporter->Start(test_case_name_, &analyzer_helper_);
}
// Start RTCEventLog recording if requested.