Enable custom metrics gathering from stats API in PC framework.

It is done by making QualityMetricsReporter implements
StatsObserverInterface.

Bug: webrtc:10138
Change-Id: Ied6c9a7e53bf942d0e48ce107f668b6af8e42735
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/149807
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28916}
This commit is contained in:
Artem Titov 2019-08-19 14:38:06 +02:00 committed by Commit Bot
parent e21f3f574b
commit a854921813
7 changed files with 15 additions and 6 deletions

View File

@ -295,6 +295,7 @@ rtc_source_set("peer_connection_quality_test_fixture_api") {
":libjingle_peerconnection_api",
":network_state_predictor_api",
":simulated_network_api",
":stats_observer_interface",
":video_quality_analyzer_api",
"../logging:rtc_event_log_api",
"../media:rtc_media_base",

View File

@ -26,6 +26,7 @@
#include "api/task_queue/task_queue_factory.h"
#include "api/test/audio_quality_analyzer_interface.h"
#include "api/test/simulated_network.h"
#include "api/test/stats_observer_interface.h"
#include "api/test/video_quality_analyzer_interface.h"
#include "api/transport/network_control.h"
#include "api/units/time_delta.h"
@ -317,7 +318,7 @@ class PeerConnectionE2EQualityTestFixture {
};
// Represent an entity that will report quality metrics after test.
class QualityMetricsReporter {
class QualityMetricsReporter : public StatsObserverInterface {
public:
virtual ~QualityMetricsReporter() = default;

View File

@ -16,7 +16,7 @@
namespace webrtc {
namespace webrtc_pc_e2e {
// Instances of |TrackIdStreamLabelMap| provide bookkeeing capabilities that
// Instances of |TrackIdStreamLabelMap| provide bookkeeping capabilities that
// are useful to associate stats reports track_ids to the remote stream_id.
class TrackIdStreamLabelMap {
public:

View File

@ -96,7 +96,7 @@ class VideoQualityAnalyzerInterface : public StatsObserverInterface {
// All available codes are listed in
// modules/video_coding/include/video_error_codes.h
virtual void OnDecoderError(uint16_t frame_id, int32_t error_code) {}
// Will be called everytime new stats reports are available for the
// Will be called every time new stats reports are available for the
// Peer Connection identified by |pc_label|.
void OnStatsReports(const std::string& pc_label,
const StatsReports& stats_reports) override {}

View File

@ -21,7 +21,7 @@
namespace webrtc {
namespace webrtc_pc_e2e {
// This class is a utility that provides bookkeeing capabilities that
// This class is a utility that provides bookkeeping capabilities that
// are useful to associate stats reports track_ids to the remote stream_id.
// The framework will populate an instance of this class and it will pass
// it to the Start method of Media Quality Analyzers.

View File

@ -29,6 +29,8 @@ class NetworkQualityMetricsReporter
// Network stats must be empty when this method will be invoked.
void Start(absl::string_view test_case_name) override;
void OnStatsReports(const std::string& pc_label,
const StatsReports& reports) override {}
void StopAndReportResults() override;
private:

View File

@ -346,8 +346,13 @@ void PeerConnectionE2EQualityTest::Run(RunParams run_params) {
}
}
StatsPoller stats_poller({audio_quality_analyzer_.get(),
video_quality_analyzer_injection_helper_.get()},
std::vector<StatsObserverInterface*> observers = {
audio_quality_analyzer_.get(),
video_quality_analyzer_injection_helper_.get()};
for (auto& reporter : quality_metrics_reporters_) {
observers.push_back(reporter.get());
}
StatsPoller stats_poller(observers,
{{"alice", alice_.get()}, {"bob", bob_.get()}});
task_queue_->PostTask([&stats_poller, this]() {