Rename corruption related metrics according to WebRTC's Statistics API.
See https://www.w3.org/TR/webrtc-stats/#dom-rtcinboundrtpstreamstats-totalcorruptionprobability for more details.
Bug: webrtc:358039777
Change-Id: I34236b9423864008486a9f9949f46397ff8b9f92
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/367960
Commit-Queue: Emil Vardar (xWF) <vardar@google.com>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43379}
diff --git a/api/stats/rtcstats_objects.h b/api/stats/rtcstats_objects.h
index 67341aa..625d122 100644
--- a/api/stats/rtcstats_objects.h
+++ b/api/stats/rtcstats_objects.h
@@ -297,10 +297,9 @@
std::optional<uint32_t> pli_count;
std::optional<uint32_t> nack_count;
std::optional<uint64_t> qp_sum;
- // https://webrtc.googlesource.com/src/+/refs/heads/main/docs/native-code/rtp-hdrext/corruption-detection
- std::optional<double> corruption_score_sum;
- std::optional<double> corruption_score_squared_sum;
- std::optional<uint32_t> corruption_score_count;
+ std::optional<double> total_corruption_probability;
+ std::optional<double> total_squared_corruption_probability;
+ std::optional<uint64_t> corruption_measurements;
// This is a remnant of the legacy getStats() API. When the "video-timing"
// header extension is used,
// https://webrtc.github.io/webrtc-org/experiments/rtp-hdrext/video-timing/,
diff --git a/pc/peer_connection_integrationtest.cc b/pc/peer_connection_integrationtest.cc
index 694e135..4cd31e7 100644
--- a/pc/peer_connection_integrationtest.cc
+++ b/pc/peer_connection_integrationtest.cc
@@ -4142,20 +4142,20 @@
for (const auto& stat : inbound_stream_stats) {
if (*stat->kind == "video") {
if (pair == caller()) {
- EXPECT_TRUE(stat->corruption_score_sum.has_value());
- EXPECT_TRUE(stat->corruption_score_squared_sum.has_value());
+ EXPECT_TRUE(stat->total_corruption_probability.has_value());
+ EXPECT_TRUE(stat->total_squared_corruption_probability.has_value());
double average_corruption_score =
- (*stat->corruption_score_sum) /
- static_cast<int32_t>(*stat->corruption_score_count);
+ (*stat->total_corruption_probability) /
+ static_cast<int32_t>(*stat->corruption_measurements);
EXPECT_GE(average_corruption_score, 0.0);
EXPECT_LE(average_corruption_score, 1.0);
}
if (pair == callee()) {
// Since only `caller` requests corruption score calculation the
// callee should not aggregate it.
- EXPECT_FALSE(stat->corruption_score_sum.has_value());
- EXPECT_FALSE(stat->corruption_score_squared_sum.has_value());
+ EXPECT_FALSE(stat->total_corruption_probability.has_value());
+ EXPECT_FALSE(stat->total_squared_corruption_probability.has_value());
}
}
}
@@ -4196,12 +4196,12 @@
report->GetStatsOfType<RTCInboundRtpStreamStats>();
for (const auto& stat : inbound_stream_stats) {
if (*stat->kind == "video") {
- EXPECT_TRUE(stat->corruption_score_sum.has_value());
- EXPECT_TRUE(stat->corruption_score_squared_sum.has_value());
+ EXPECT_TRUE(stat->total_corruption_probability.has_value());
+ EXPECT_TRUE(stat->total_squared_corruption_probability.has_value());
double average_corruption_score =
- (*stat->corruption_score_sum) /
- static_cast<int32_t>(*stat->corruption_score_count);
+ (*stat->total_corruption_probability) /
+ static_cast<int32_t>(*stat->corruption_measurements);
EXPECT_GE(average_corruption_score, 0.0);
EXPECT_LE(average_corruption_score, 1.0);
}
@@ -4245,8 +4245,8 @@
report->GetStatsOfType<RTCInboundRtpStreamStats>();
for (const auto& stat : inbound_stream_stats) {
if (*stat->kind == "video") {
- EXPECT_FALSE(stat->corruption_score_sum.has_value());
- EXPECT_FALSE(stat->corruption_score_squared_sum.has_value());
+ EXPECT_FALSE(stat->total_corruption_probability.has_value());
+ EXPECT_FALSE(stat->total_squared_corruption_probability.has_value());
}
}
}
diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc
index 47a1a86..451590f 100644
--- a/pc/rtc_stats_collector.cc
+++ b/pc/rtc_stats_collector.cc
@@ -627,11 +627,11 @@
if (video_receiver_info.corruption_score_sum.has_value()) {
RTC_CHECK(video_receiver_info.corruption_score_squared_sum.has_value());
RTC_CHECK_GT(video_receiver_info.corruption_score_count, 0);
- inbound_video->corruption_score_sum =
+ inbound_video->total_corruption_probability =
*video_receiver_info.corruption_score_sum;
- inbound_video->corruption_score_squared_sum =
+ inbound_video->total_squared_corruption_probability =
*video_receiver_info.corruption_score_squared_sum;
- inbound_video->corruption_score_count =
+ inbound_video->corruption_measurements =
video_receiver_info.corruption_score_count;
}
if (video_receiver_info.timing_frame_info.has_value()) {
diff --git a/pc/rtc_stats_collector_unittest.cc b/pc/rtc_stats_collector_unittest.cc
index 1cc3ce5..696e071 100644
--- a/pc/rtc_stats_collector_unittest.cc
+++ b/pc/rtc_stats_collector_unittest.cc
@@ -2459,9 +2459,9 @@
video_media_info.receivers[0].corruption_score_sum = 0.5;
video_media_info.receivers[0].corruption_score_squared_sum = 0.25;
video_media_info.receivers[0].corruption_score_count = 5;
- expected_video.corruption_score_sum = 0.5;
- expected_video.corruption_score_squared_sum = 0.25;
- expected_video.corruption_score_count = 5;
+ expected_video.total_corruption_probability = 0.5;
+ expected_video.total_squared_corruption_probability = 0.25;
+ expected_video.corruption_measurements = 5;
video_media_info.receivers[0].last_packet_received = Timestamp::Seconds(1);
expected_video.last_packet_received_timestamp = 1000.0;
video_media_info.receivers[0].content_type = VideoContentType::SCREENSHARE;
diff --git a/pc/rtc_stats_integrationtest.cc b/pc/rtc_stats_integrationtest.cc
index 11f7e5c..c21ab0e 100644
--- a/pc/rtc_stats_integrationtest.cc
+++ b/pc/rtc_stats_integrationtest.cc
@@ -563,10 +563,11 @@
// As long as the corruption detection RTP header extension is not activated
// it should not aggregate any corruption score. The tests where this header
// extension is enabled are located in pc/peer_connection_integrationtest.cc
- verifier.TestAttributeIsUndefined(inbound_stream.corruption_score_sum);
verifier.TestAttributeIsUndefined(
- inbound_stream.corruption_score_squared_sum);
- verifier.TestAttributeIsUndefined(inbound_stream.corruption_score_count);
+ inbound_stream.total_corruption_probability);
+ verifier.TestAttributeIsUndefined(
+ inbound_stream.total_squared_corruption_probability);
+ verifier.TestAttributeIsUndefined(inbound_stream.corruption_measurements);
verifier.TestAttributeIsNonNegative<uint32_t>(
inbound_stream.packets_received);
if (inbound_stream.kind.has_value() && *inbound_stream.kind == "audio") {
diff --git a/pc/test/integration_test_helpers.h b/pc/test/integration_test_helpers.h
index 9a218d9..6dbbd0b 100644
--- a/pc/test/integration_test_helpers.h
+++ b/pc/test/integration_test_helpers.h
@@ -750,7 +750,7 @@
report->GetStatsOfType<RTCInboundRtpStreamStats>();
for (const auto& stat : inbound_stream_stats) {
if (*stat->kind == "video") {
- return stat->corruption_score_count.value_or(0);
+ return stat->corruption_measurements.value_or(0);
}
}
return 0;
diff --git a/stats/rtcstats_objects.cc b/stats/rtcstats_objects.cc
index 4ee9bdc..4a08133 100644
--- a/stats/rtcstats_objects.cc
+++ b/stats/rtcstats_objects.cc
@@ -267,9 +267,10 @@
AttributeInit("pliCount", &pli_count),
AttributeInit("nackCount", &nack_count),
AttributeInit("qpSum", &qp_sum),
- AttributeInit("corruptionScoreSum", &corruption_score_sum),
- AttributeInit("corruptionScoreSumSquared", &corruption_score_squared_sum),
- AttributeInit("corruptionScoreCount", &corruption_score_count),
+ AttributeInit("totalCorruptionProbability", &total_corruption_probability),
+ AttributeInit("totalSquaredCorruptionProbability",
+ &total_squared_corruption_probability),
+ AttributeInit("corruptionMeasurements", &corruption_measurements),
AttributeInit("googTimingFrameInfo", &goog_timing_frame_info),
AttributeInit("powerEfficientDecoder", &power_efficient_decoder),
AttributeInit("jitterBufferFlushes", &jitter_buffer_flushes),