diff options
Diffstat (limited to 'test/pc/e2e/cross_media_metrics_reporter.cc')
-rw-r--r-- | test/pc/e2e/cross_media_metrics_reporter.cc | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/test/pc/e2e/cross_media_metrics_reporter.cc b/test/pc/e2e/cross_media_metrics_reporter.cc index 99c1a0bfc1..d09135d182 100644 --- a/test/pc/e2e/cross_media_metrics_reporter.cc +++ b/test/pc/e2e/cross_media_metrics_reporter.cc @@ -19,6 +19,7 @@ #include "rtc_base/checks.h" #include "rtc_base/event.h" #include "system_wrappers/include/field_trial.h" +#include "test/pc/e2e/metric_metadata_keys.h" namespace webrtc { namespace webrtc_pc_e2e { @@ -43,15 +44,17 @@ void CrossMediaMetricsReporter::OnStatsReports( absl::string_view pc_label, const rtc::scoped_refptr<const RTCStatsReport>& report) { auto inbound_stats = report->GetStatsOfType<RTCInboundRTPStreamStats>(); - std::map<absl::string_view, std::vector<const RTCInboundRTPStreamStats*>> + std::map<std::string, std::vector<const RTCInboundRTPStreamStats*>> sync_group_stats; for (const auto& stat : inbound_stats) { auto media_source_stat = report->GetAs<DEPRECATED_RTCMediaStreamTrackStats>(*stat->track_id); if (stat->estimated_playout_timestamp.ValueOrDefault(0.) > 0 && media_source_stat->track_identifier.is_defined()) { - sync_group_stats[reporter_helper_->GetSyncGroupLabelFromTrackId( - *media_source_stat->track_identifier)] + sync_group_stats[reporter_helper_ + ->GetStreamInfoFromTrackId( + *media_source_stat->track_identifier) + .sync_group] .push_back(stat); } } @@ -85,12 +88,12 @@ void CrossMediaMetricsReporter::OnStatsReports( *video_stat->track_id); // *_source_stat->track_identifier is always defined here because we // checked it while grouping stats. - stats_info_[sync_group].audio_stream_label = - std::string(reporter_helper_->GetStreamLabelFromTrackId( - *audio_source_stat->track_identifier)); - stats_info_[sync_group].video_stream_label = - std::string(reporter_helper_->GetStreamLabelFromTrackId( - *video_source_stat->track_identifier)); + stats_info_[sync_group].audio_stream_info = + reporter_helper_->GetStreamInfoFromTrackId( + *audio_source_stat->track_identifier); + stats_info_[sync_group].video_stream_info = + reporter_helper_->GetStreamInfoFromTrackId( + *video_source_stat->track_identifier); } double audio_video_playout_diff = *audio_stat->estimated_playout_timestamp - @@ -111,16 +114,35 @@ void CrossMediaMetricsReporter::StopAndReportResults() { MutexLock lock(&mutex_); for (const auto& pair : stats_info_) { const std::string& sync_group = pair.first; + std::map<std::string, std::string> audio_metric_metadata{ + {MetricMetadataKey::kPeerSyncGroupMetadataKey, sync_group}, + {MetricMetadataKey::kAudioStreamMetadataKey, + pair.second.audio_stream_info.stream_label}, + {MetricMetadataKey::kPeerMetadataKey, + pair.second.audio_stream_info.receiver_peer}, + {MetricMetadataKey::kReceiverMetadataKey, + pair.second.audio_stream_info.receiver_peer}}; metrics_logger_->LogMetric( "audio_ahead_ms", - GetTestCaseName(pair.second.audio_stream_label, sync_group), + GetTestCaseName(pair.second.audio_stream_info.stream_label, sync_group), pair.second.audio_ahead_ms, Unit::kMilliseconds, - webrtc::test::ImprovementDirection::kSmallerIsBetter); + webrtc::test::ImprovementDirection::kSmallerIsBetter, + std::move(audio_metric_metadata)); + + std::map<std::string, std::string> video_metric_metadata{ + {MetricMetadataKey::kPeerSyncGroupMetadataKey, sync_group}, + {MetricMetadataKey::kAudioStreamMetadataKey, + pair.second.video_stream_info.stream_label}, + {MetricMetadataKey::kPeerMetadataKey, + pair.second.video_stream_info.receiver_peer}, + {MetricMetadataKey::kReceiverMetadataKey, + pair.second.video_stream_info.receiver_peer}}; metrics_logger_->LogMetric( "video_ahead_ms", - GetTestCaseName(pair.second.video_stream_label, sync_group), + GetTestCaseName(pair.second.video_stream_info.stream_label, sync_group), pair.second.video_ahead_ms, Unit::kMilliseconds, - webrtc::test::ImprovementDirection::kSmallerIsBetter); + webrtc::test::ImprovementDirection::kSmallerIsBetter, + std::move(video_metric_metadata)); } } |