aboutsummaryrefslogtreecommitdiff
path: root/test/pc/e2e/analyzer/audio/default_audio_quality_analyzer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/pc/e2e/analyzer/audio/default_audio_quality_analyzer.cc')
-rw-r--r--test/pc/e2e/analyzer/audio/default_audio_quality_analyzer.cc42
1 files changed, 28 insertions, 14 deletions
diff --git a/test/pc/e2e/analyzer/audio/default_audio_quality_analyzer.cc b/test/pc/e2e/analyzer/audio/default_audio_quality_analyzer.cc
index 4a0061ed13..189eaca14a 100644
--- a/test/pc/e2e/analyzer/audio/default_audio_quality_analyzer.cc
+++ b/test/pc/e2e/analyzer/audio/default_audio_quality_analyzer.cc
@@ -13,8 +13,10 @@
#include "api/stats/rtc_stats.h"
#include "api/stats/rtcstats_objects.h"
#include "api/test/metrics/metric.h"
+#include "api/test/track_id_stream_info_map.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
+#include "test/pc/e2e/metric_metadata_keys.h"
namespace webrtc {
namespace webrtc_pc_e2e {
@@ -62,11 +64,12 @@ void DefaultAudioQualityAnalyzer::OnStatsReports(
sample.jitter_buffer_emitted_count =
stat->jitter_buffer_emitted_count.ValueOrDefault(0ul);
- const std::string stream_label = std::string(
- analyzer_helper_->GetStreamLabelFromTrackId(*stat->track_identifier));
+ TrackIdStreamInfoMap::StreamInfo stream_info =
+ analyzer_helper_->GetStreamInfoFromTrackId(*stat->track_identifier);
MutexLock lock(&lock_);
- StatsSample prev_sample = last_stats_sample_[stream_label];
+ stream_info_.emplace(stream_info.stream_label, stream_info);
+ StatsSample prev_sample = last_stats_sample_[stream_info.stream_label];
RTC_CHECK_GE(sample.total_samples_received,
prev_sample.total_samples_received);
double total_samples_diff = static_cast<double>(
@@ -75,7 +78,8 @@ void DefaultAudioQualityAnalyzer::OnStatsReports(
return;
}
- AudioStreamStats& audio_stream_stats = streams_stats_[stream_label];
+ AudioStreamStats& audio_stream_stats =
+ streams_stats_[stream_info.stream_label];
audio_stream_stats.expand_rate.AddSample(
(sample.concealed_samples - prev_sample.concealed_samples) /
total_samples_diff);
@@ -113,7 +117,7 @@ void DefaultAudioQualityAnalyzer::OnStatsReports(
jitter_buffer_emitted_count_diff);
}
- last_stats_sample_[stream_label] = sample;
+ last_stats_sample_[stream_info.stream_label] = sample;
}
}
@@ -125,27 +129,37 @@ std::string DefaultAudioQualityAnalyzer::GetTestCaseName(
void DefaultAudioQualityAnalyzer::Stop() {
MutexLock lock(&lock_);
for (auto& item : streams_stats_) {
+ const TrackIdStreamInfoMap::StreamInfo& stream_info =
+ stream_info_[item.first];
+ std::map<std::string, std::string> metric_metadata{
+ {MetricMetadataKey::kAudioStreamMetadataKey, item.first},
+ {MetricMetadataKey::kPeerMetadataKey, stream_info.receiver_peer},
+ {MetricMetadataKey::kReceiverMetadataKey, stream_info.receiver_peer}};
+
metrics_logger_->LogMetric("expand_rate", GetTestCaseName(item.first),
item.second.expand_rate, Unit::kUnitless,
- ImprovementDirection::kSmallerIsBetter);
+ ImprovementDirection::kSmallerIsBetter,
+ metric_metadata);
metrics_logger_->LogMetric("accelerate_rate", GetTestCaseName(item.first),
item.second.accelerate_rate, Unit::kUnitless,
- ImprovementDirection::kSmallerIsBetter);
+ ImprovementDirection::kSmallerIsBetter,
+ metric_metadata);
metrics_logger_->LogMetric("preemptive_rate", GetTestCaseName(item.first),
item.second.preemptive_rate, Unit::kUnitless,
- ImprovementDirection::kSmallerIsBetter);
- metrics_logger_->LogMetric("speech_expand_rate",
- GetTestCaseName(item.first),
- item.second.speech_expand_rate, Unit::kUnitless,
- ImprovementDirection::kSmallerIsBetter);
+ ImprovementDirection::kSmallerIsBetter,
+ metric_metadata);
+ metrics_logger_->LogMetric(
+ "speech_expand_rate", GetTestCaseName(item.first),
+ item.second.speech_expand_rate, Unit::kUnitless,
+ ImprovementDirection::kSmallerIsBetter, metric_metadata);
metrics_logger_->LogMetric(
"average_jitter_buffer_delay_ms", GetTestCaseName(item.first),
item.second.average_jitter_buffer_delay_ms, Unit::kMilliseconds,
- ImprovementDirection::kNeitherIsBetter);
+ ImprovementDirection::kNeitherIsBetter, metric_metadata);
metrics_logger_->LogMetric(
"preferred_buffer_size_ms", GetTestCaseName(item.first),
item.second.preferred_buffer_size_ms, Unit::kMilliseconds,
- ImprovementDirection::kNeitherIsBetter);
+ ImprovementDirection::kNeitherIsBetter, metric_metadata);
}
}