[Stats] Add googTimingFrameInfo to the modern API.

This is exposing something that is already exposed in the legacy
getStats() API and is only available if the "video-timing" header
extension is used. Adding this metric here should unblock legacy
getStats() API deprecation. The follow-up to unship or standardize this
metric is tracked by https://crbug.com/webrtc/14586.

Bug: webrtc:14587
Change-Id: Ic3d45b0558d7caf4be2856a4cd95b88db312f85e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279860
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38444}
This commit is contained in:
Henrik Boström
2022-10-19 17:50:09 +02:00
committed by WebRTC LUCI CQ
parent 8e7a105c51
commit c5f8f800a2
5 changed files with 54 additions and 1 deletions

View File

@ -502,6 +502,13 @@ class RTC_EXPORT RTCInboundRTPStreamStats final
RTCStatsMember<uint32_t> pli_count;
RTCStatsMember<uint32_t> nack_count;
RTCStatsMember<uint64_t> qp_sum;
// 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/,
// `googTimingFrameInfo` is exposed with the value of
// TimingFrameInfo::ToString().
// TODO(https://crbug.com/webrtc/14586): Unship or standardize this metric.
RTCStatsMember<std::string> goog_timing_frame_info;
// Non-standard audio metrics.
RTCNonStandardStatsMember<uint64_t> jitter_buffer_flushes;
RTCNonStandardStatsMember<uint64_t> delayed_packet_outage_samples;

View File

@ -607,8 +607,13 @@ void SetInboundRTPStreamStatsFromVideoReceiverInfo(
if (video_receiver_info.framerate_decoded > 0) {
inbound_video->frames_per_second = video_receiver_info.framerate_decoded;
}
if (video_receiver_info.qp_sum)
if (video_receiver_info.qp_sum) {
inbound_video->qp_sum = *video_receiver_info.qp_sum;
}
if (video_receiver_info.timing_frame_info.has_value()) {
inbound_video->goog_timing_frame_info =
video_receiver_info.timing_frame_info->ToString();
}
inbound_video->total_decode_time =
video_receiver_info.total_decode_time.seconds<double>();
inbound_video->total_processing_delay =

View File

@ -38,6 +38,7 @@
#include "api/video/video_frame.h"
#include "api/video/video_sink_interface.h"
#include "api/video/video_source_interface.h"
#include "api/video/video_timing.h"
#include "common_video/include/quality_limitation_reason.h"
#include "media/base/media_channel.h"
#include "modules/audio_processing/include/audio_processing_statistics.h"
@ -2714,6 +2715,42 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Video) {
EXPECT_TRUE(report->Get(*expected_video.codec_id));
}
TEST_F(RTCStatsCollectorTest, CollectGoogTimingFrameInfo) {
cricket::VideoMediaInfo video_media_info;
video_media_info.receivers.push_back(cricket::VideoReceiverInfo());
video_media_info.receivers[0].local_stats.push_back(
cricket::SsrcReceiverInfo());
video_media_info.receivers[0].local_stats[0].ssrc = 1;
TimingFrameInfo timing_frame_info;
timing_frame_info.rtp_timestamp = 1;
timing_frame_info.capture_time_ms = 2;
timing_frame_info.encode_start_ms = 3;
timing_frame_info.encode_finish_ms = 4;
timing_frame_info.packetization_finish_ms = 5;
timing_frame_info.pacer_exit_ms = 6;
timing_frame_info.network_timestamp_ms = 7;
timing_frame_info.network2_timestamp_ms = 8;
timing_frame_info.receive_start_ms = 9;
timing_frame_info.receive_finish_ms = 10;
timing_frame_info.decode_start_ms = 11;
timing_frame_info.decode_finish_ms = 12;
timing_frame_info.render_time_ms = 13;
timing_frame_info.flags = 14;
video_media_info.receivers[0].timing_frame_info = timing_frame_info;
pc_->AddVideoChannel("Mid0", "Transport0", video_media_info);
stats_->SetupRemoteTrackAndReceiver(
cricket::MEDIA_TYPE_VIDEO, "RemoteVideoTrackID", "RemoteStreamId", 1);
rtc::scoped_refptr<const RTCStatsReport> report = stats_->GetStatsReport();
auto inbound_rtps = report->GetStatsOfType<RTCInboundRTPStreamStats>();
ASSERT_EQ(inbound_rtps.size(), 1u);
ASSERT_TRUE(inbound_rtps[0]->goog_timing_frame_info.is_defined());
EXPECT_EQ(*inbound_rtps[0]->goog_timing_frame_info,
"1,2,3,4,5,6,7,8,9,10,11,12,13,1,0");
}
TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Audio) {
cricket::VoiceMediaInfo voice_media_info;

View File

@ -937,6 +937,7 @@ class RTCStatsReportVerifier {
inbound_stream.total_interruption_duration);
verifier.TestMemberIsNonNegative<double>(
inbound_stream.min_playout_delay);
verifier.TestMemberIsDefined(inbound_stream.goog_timing_frame_info);
} else {
verifier.TestMemberIsUndefined(inbound_stream.frames_decoded);
verifier.TestMemberIsUndefined(inbound_stream.key_frames_decoded);
@ -965,6 +966,7 @@ class RTCStatsReportVerifier {
verifier.TestMemberIsNonNegative<double>(
inbound_stream.total_interruption_duration);
verifier.TestMemberIsUndefined(inbound_stream.min_playout_delay);
verifier.TestMemberIsUndefined(inbound_stream.goog_timing_frame_info);
}
return verifier.ExpectAllMembersSuccessfullyTested();
}

View File

@ -585,6 +585,7 @@ WEBRTC_RTCSTATS_IMPL(
&pli_count,
&nack_count,
&qp_sum,
&goog_timing_frame_info,
&jitter_buffer_flushes,
&delayed_packet_outage_samples,
&relative_packet_arrival_delay,
@ -648,6 +649,7 @@ RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
pli_count("pliCount"),
nack_count("nackCount"),
qp_sum("qpSum"),
goog_timing_frame_info("googTimingFrameInfo"),
jitter_buffer_flushes(
"jitterBufferFlushes",
{NonStandardGroupId::kRtcAudioJitterBufferMaxPackets}),