Move pause and freeze metrics to standardized location.

These metrics were recently standardized. Part of the standardization
effort was to move them from obsolete "track" stats (on track for
deprecation and removal: https://crbug.com/webrtc/14175) into the
"inbound-rtp" stats which are not deprecated.

To ease transition for downstream projects, the metrics are temporarily
duplicated in both the old and new locations. In a follow-up CL, they
will be deleted from "track".

Bug: webrtc:14521
Change-Id: I0d9036472607a8c717ec823a458a79a49ddb80c7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/278080
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38308}
This commit is contained in:
Henrik Boström 2022-10-06 11:59:05 +02:00 committed by WebRTC LUCI CQ
parent 7fe7091f8a
commit c57a28c46b
5 changed files with 87 additions and 32 deletions

View File

@ -357,12 +357,13 @@ class RTC_EXPORT RTCMediaStreamTrackStats final : public RTCStats {
RTCNonStandardStatsMember<double> total_interruption_duration;
// Non-standard video-only members.
// https://w3c.github.io/webrtc-provisional-stats/#dom-rtcvideoreceiverstats
RTCNonStandardStatsMember<double> total_frames_duration;
RTCNonStandardStatsMember<double> sum_squared_frame_durations;
// TODO(crbug.com/webrtc/14521): These metrics have been moved, delete them.
RTCNonStandardStatsMember<uint32_t> freeze_count;
RTCNonStandardStatsMember<uint32_t> pause_count;
RTCNonStandardStatsMember<double> total_freezes_duration;
RTCNonStandardStatsMember<double> total_pauses_duration;
RTCNonStandardStatsMember<double> total_frames_duration;
RTCNonStandardStatsMember<double> sum_squared_frame_durations;
};
// https://w3c.github.io/webrtc-stats/#pcstats-dict*
@ -485,6 +486,10 @@ class RTC_EXPORT RTCInboundRTPStreamStats final
RTCNonStandardStatsMember<uint32_t> frames_assembled_from_multiple_packets;
RTCStatsMember<double> total_inter_frame_delay;
RTCStatsMember<double> total_squared_inter_frame_delay;
RTCStatsMember<uint32_t> pause_count;
RTCStatsMember<double> total_pauses_duration;
RTCStatsMember<uint32_t> freeze_count;
RTCStatsMember<double> total_freezes_duration;
// https://w3c.github.io/webrtc-provisional-stats/#dom-rtcinboundrtpstreamstats-contenttype
RTCStatsMember<std::string> content_type;
// Only populated if audio/video sync is enabled.

View File

@ -608,6 +608,14 @@ void SetInboundRTPStreamStatsFromVideoReceiverInfo(
video_receiver_info.total_inter_frame_delay;
inbound_video->total_squared_inter_frame_delay =
video_receiver_info.total_squared_inter_frame_delay;
inbound_video->pause_count = video_receiver_info.pause_count;
inbound_video->total_pauses_duration =
static_cast<double>(video_receiver_info.total_pauses_duration_ms) /
rtc::kNumMillisecsPerSec;
inbound_video->freeze_count = video_receiver_info.freeze_count;
inbound_video->total_freezes_duration =
static_cast<double>(video_receiver_info.total_freezes_duration_ms) /
rtc::kNumMillisecsPerSec;
inbound_video->min_playout_delay =
static_cast<double>(video_receiver_info.min_playout_delay_ms) /
rtc::kNumMillisecsPerSec;
@ -1104,6 +1112,14 @@ ProduceMediaStreamTrackStatsFromVideoReceiverInfo(
// value as "RTCInboundRTPStreamStats.framesDecoded". https://crbug.com/659137
video_track_stats->frames_decoded = video_receiver_info.frames_decoded;
video_track_stats->frames_dropped = video_receiver_info.frames_dropped;
video_track_stats->total_frames_duration =
static_cast<double>(video_receiver_info.total_frames_duration_ms) /
rtc::kNumMillisecsPerSec;
video_track_stats->sum_squared_frame_durations =
video_receiver_info.sum_squared_frame_durations;
// TODO(crbug.com/webrtc/14521): These metrics have been moved, delete them
// from "track".
video_track_stats->freeze_count = video_receiver_info.freeze_count;
video_track_stats->pause_count = video_receiver_info.pause_count;
video_track_stats->total_freezes_duration =
@ -1112,11 +1128,6 @@ ProduceMediaStreamTrackStatsFromVideoReceiverInfo(
video_track_stats->total_pauses_duration =
static_cast<double>(video_receiver_info.total_pauses_duration_ms) /
rtc::kNumMillisecsPerSec;
video_track_stats->total_frames_duration =
static_cast<double>(video_receiver_info.total_frames_duration_ms) /
rtc::kNumMillisecsPerSec;
video_track_stats->sum_squared_frame_durations =
video_receiver_info.sum_squared_frame_durations;
return video_track_stats;
}

View File

@ -2376,12 +2376,14 @@ TEST_F(RTCStatsCollectorTest,
video_receiver_info_ssrc3.frames_decoded = 995;
video_receiver_info_ssrc3.frames_dropped = 10;
video_receiver_info_ssrc3.frames_rendered = 990;
video_receiver_info_ssrc3.total_frames_duration_ms = 15000;
video_receiver_info_ssrc3.sum_squared_frame_durations = 1.5;
// TODO(crbug.com/webrtc/14521): When removed from "track", there's no need to
// test these here.
video_receiver_info_ssrc3.freeze_count = 3;
video_receiver_info_ssrc3.pause_count = 2;
video_receiver_info_ssrc3.total_freezes_duration_ms = 1000;
video_receiver_info_ssrc3.total_pauses_duration_ms = 10000;
video_receiver_info_ssrc3.total_frames_duration_ms = 15000;
video_receiver_info_ssrc3.sum_squared_frame_durations = 1.5;
stats_->CreateMockRtpSendersReceiversAndChannels(
{}, {}, {},
@ -2425,12 +2427,13 @@ TEST_F(RTCStatsCollectorTest,
expected_remote_video_track_ssrc3.frames_received = 1000;
expected_remote_video_track_ssrc3.frames_decoded = 995;
expected_remote_video_track_ssrc3.frames_dropped = 10;
expected_remote_video_track_ssrc3.total_frames_duration = 15;
expected_remote_video_track_ssrc3.sum_squared_frame_durations = 1.5;
// TODO(crbug.com/webrtc/14521): These metrics have been moved, delete them.
expected_remote_video_track_ssrc3.freeze_count = 3;
expected_remote_video_track_ssrc3.pause_count = 2;
expected_remote_video_track_ssrc3.total_freezes_duration = 1;
expected_remote_video_track_ssrc3.total_pauses_duration = 10;
expected_remote_video_track_ssrc3.total_frames_duration = 15;
expected_remote_video_track_ssrc3.sum_squared_frame_durations = 1.5;
ASSERT_TRUE(report->Get(expected_remote_video_track_ssrc3.id()));
EXPECT_EQ(expected_remote_video_track_ssrc3,
@ -2576,6 +2579,10 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Video) {
video_media_info.receivers[0].frames_assembled_from_multiple_packets = 23;
video_media_info.receivers[0].total_inter_frame_delay = 0.123;
video_media_info.receivers[0].total_squared_inter_frame_delay = 0.00456;
video_media_info.receivers[0].pause_count = 2;
video_media_info.receivers[0].total_pauses_duration_ms = 10000;
video_media_info.receivers[0].freeze_count = 3;
video_media_info.receivers[0].total_freezes_duration_ms = 1000;
video_media_info.receivers[0].jitter_ms = 1199;
video_media_info.receivers[0].jitter_buffer_delay_seconds = 3.456;
video_media_info.receivers[0].jitter_buffer_target_delay_seconds = 1.1;
@ -2638,6 +2645,10 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Video) {
expected_video.frames_assembled_from_multiple_packets = 23;
expected_video.total_inter_frame_delay = 0.123;
expected_video.total_squared_inter_frame_delay = 0.00456;
expected_video.pause_count = 2;
expected_video.total_pauses_duration = 10;
expected_video.freeze_count = 3;
expected_video.total_freezes_duration = 1;
expected_video.jitter = 1.199;
expected_video.jitter_buffer_delay = 3.456;
expected_video.jitter_buffer_target_delay = 1.1;

View File

@ -594,6 +594,12 @@ class RTCStatsReportVerifier {
media_stream_track.frames_decoded);
verifier.TestMemberIsNonNegative<uint32_t>(
media_stream_track.frames_dropped);
verifier.TestMemberIsNonNegative<double>(
media_stream_track.total_frames_duration);
verifier.TestMemberIsNonNegative<double>(
media_stream_track.sum_squared_frame_durations);
// TODO(crbug.com/webrtc/14521): These metrics have been moved, delete
// them from "track".
verifier.TestMemberIsNonNegative<uint32_t>(
media_stream_track.freeze_count);
verifier.TestMemberIsNonNegative<uint32_t>(
@ -602,10 +608,6 @@ class RTCStatsReportVerifier {
media_stream_track.total_freezes_duration);
verifier.TestMemberIsNonNegative<double>(
media_stream_track.total_pauses_duration);
verifier.TestMemberIsNonNegative<double>(
media_stream_track.total_frames_duration);
verifier.TestMemberIsNonNegative<double>(
media_stream_track.sum_squared_frame_durations);
} else {
verifier.TestMemberIsIDReference(media_stream_track.media_source_id,
RTCVideoSourceStats::kType);
@ -620,16 +622,18 @@ class RTCStatsReportVerifier {
verifier.TestMemberIsUndefined(media_stream_track.frames_received);
verifier.TestMemberIsUndefined(media_stream_track.frames_decoded);
verifier.TestMemberIsUndefined(media_stream_track.frames_dropped);
verifier.TestMemberIsUndefined(
media_stream_track.total_frames_duration);
verifier.TestMemberIsUndefined(
media_stream_track.sum_squared_frame_durations);
// TODO(crbug.com/webrtc/14521): These metrics have been moved, delete
// them from "track".
verifier.TestMemberIsUndefined(media_stream_track.freeze_count);
verifier.TestMemberIsUndefined(media_stream_track.pause_count);
verifier.TestMemberIsUndefined(
media_stream_track.total_freezes_duration);
verifier.TestMemberIsUndefined(
media_stream_track.total_pauses_duration);
verifier.TestMemberIsUndefined(
media_stream_track.total_frames_duration);
verifier.TestMemberIsUndefined(
media_stream_track.sum_squared_frame_durations);
}
// Video-only members
verifier.TestMemberIsNonNegative<uint32_t>(
@ -736,10 +740,6 @@ class RTCStatsReportVerifier {
verifier.TestMemberIsUndefined(media_stream_track.frames_received);
verifier.TestMemberIsUndefined(media_stream_track.frames_decoded);
verifier.TestMemberIsUndefined(media_stream_track.frames_dropped);
verifier.TestMemberIsUndefined(media_stream_track.freeze_count);
verifier.TestMemberIsUndefined(media_stream_track.pause_count);
verifier.TestMemberIsUndefined(media_stream_track.total_freezes_duration);
verifier.TestMemberIsUndefined(media_stream_track.total_pauses_duration);
verifier.TestMemberIsUndefined(media_stream_track.total_frames_duration);
verifier.TestMemberIsUndefined(
media_stream_track.sum_squared_frame_durations);
@ -751,6 +751,12 @@ class RTCStatsReportVerifier {
verifier.MarkMemberTested(media_stream_track.echo_return_loss, true);
verifier.MarkMemberTested(media_stream_track.echo_return_loss_enhancement,
true);
// TODO(crbug.com/webrtc/14521): These metrics have been moved, delete
// them from "track".
verifier.TestMemberIsUndefined(media_stream_track.freeze_count);
verifier.TestMemberIsUndefined(media_stream_track.pause_count);
verifier.TestMemberIsUndefined(media_stream_track.total_freezes_duration);
verifier.TestMemberIsUndefined(media_stream_track.total_pauses_duration);
}
return verifier.ExpectAllMembersSuccessfullyTested();
}
@ -905,6 +911,12 @@ class RTCStatsReportVerifier {
inbound_stream.total_inter_frame_delay);
verifier.TestMemberIsNonNegative<double>(
inbound_stream.total_squared_inter_frame_delay);
verifier.TestMemberIsNonNegative<uint32_t>(inbound_stream.pause_count);
verifier.TestMemberIsNonNegative<double>(
inbound_stream.total_pauses_duration);
verifier.TestMemberIsNonNegative<uint32_t>(inbound_stream.freeze_count);
verifier.TestMemberIsNonNegative<double>(
inbound_stream.total_freezes_duration);
// The integration test is not set up to test screen share; don't require
// this to be present.
verifier.MarkMemberTested(inbound_stream.content_type, true);
@ -922,6 +934,10 @@ class RTCStatsReportVerifier {
verifier.TestMemberIsUndefined(inbound_stream.total_inter_frame_delay);
verifier.TestMemberIsUndefined(
inbound_stream.total_squared_inter_frame_delay);
verifier.TestMemberIsUndefined(inbound_stream.pause_count);
verifier.TestMemberIsUndefined(inbound_stream.total_pauses_duration);
verifier.TestMemberIsUndefined(inbound_stream.freeze_count);
verifier.TestMemberIsUndefined(inbound_stream.total_freezes_duration);
verifier.TestMemberIsUndefined(inbound_stream.content_type);
verifier.TestMemberIsUndefined(inbound_stream.min_playout_delay);
}

View File

@ -430,12 +430,12 @@ WEBRTC_RTCSTATS_IMPL(RTCMediaStreamTrackStats, RTCStats, "track",
&relative_packet_arrival_delay,
&interruption_count,
&total_interruption_duration,
&total_frames_duration,
&sum_squared_frame_durations,
&freeze_count,
&pause_count,
&total_freezes_duration,
&total_pauses_duration,
&total_frames_duration,
&sum_squared_frame_durations)
&total_pauses_duration)
// clang-format on
RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(const std::string& id,
@ -485,12 +485,12 @@ RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(std::string&& id,
{NonStandardGroupId::kRtcStatsRelativePacketArrivalDelay}),
interruption_count("interruptionCount"),
total_interruption_duration("totalInterruptionDuration"),
total_frames_duration("totalFramesDuration"),
sum_squared_frame_durations("sumOfSquaredFramesDuration"),
freeze_count("freezeCount"),
pause_count("pauseCount"),
total_freezes_duration("totalFreezesDuration"),
total_pauses_duration("totalPausesDuration"),
total_frames_duration("totalFramesDuration"),
sum_squared_frame_durations("sumOfSquaredFramesDuration") {
total_pauses_duration("totalPausesDuration") {
RTC_DCHECK(kind == RTCMediaStreamTrackKind::kAudio ||
kind == RTCMediaStreamTrackKind::kVideo);
}
@ -530,12 +530,12 @@ RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
relative_packet_arrival_delay(other.relative_packet_arrival_delay),
interruption_count(other.interruption_count),
total_interruption_duration(other.total_interruption_duration),
total_frames_duration(other.total_frames_duration),
sum_squared_frame_durations(other.sum_squared_frame_durations),
freeze_count(other.freeze_count),
pause_count(other.pause_count),
total_freezes_duration(other.total_freezes_duration),
total_pauses_duration(other.total_pauses_duration),
total_frames_duration(other.total_frames_duration),
sum_squared_frame_durations(other.sum_squared_frame_durations) {}
total_pauses_duration(other.total_pauses_duration) {}
RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() {}
@ -685,6 +685,10 @@ WEBRTC_RTCSTATS_IMPL(
&frames_assembled_from_multiple_packets,
&total_inter_frame_delay,
&total_squared_inter_frame_delay,
&pause_count,
&total_pauses_duration,
&freeze_count,
&total_freezes_duration,
&content_type,
&estimated_playout_timestamp,
&decoder_implementation,
@ -739,6 +743,10 @@ RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
"framesAssembledFromMultiplePackets"),
total_inter_frame_delay("totalInterFrameDelay"),
total_squared_inter_frame_delay("totalSquaredInterFrameDelay"),
pause_count("pauseCount"),
total_pauses_duration("totalPausesDuration"),
freeze_count("freezeCount"),
total_freezes_duration("totalFreezesDuration"),
content_type("contentType"),
estimated_playout_timestamp("estimatedPlayoutTimestamp"),
decoder_implementation("decoderImplementation"),
@ -789,6 +797,10 @@ RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
other.frames_assembled_from_multiple_packets),
total_inter_frame_delay(other.total_inter_frame_delay),
total_squared_inter_frame_delay(other.total_squared_inter_frame_delay),
pause_count(other.pause_count),
total_pauses_duration(other.total_pauses_duration),
freeze_count(other.freeze_count),
total_freezes_duration(other.total_freezes_duration),
content_type(other.content_type),
estimated_playout_timestamp(other.estimated_playout_timestamp),
decoder_implementation(other.decoder_implementation),