aboutsummaryrefslogtreecommitdiff
path: root/media
diff options
context:
space:
mode:
authorPhilipp Hancke <phancke@nvidia.com>2022-05-05 15:55:36 +0200
committerWebRTC LUCI CQ <webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-05-18 09:16:10 +0000
commit0359ba22256f26c723edac508886eb5df8073487 (patch)
treef99c4f0526724c01670801b2e2b546ef5bbf2df6 /media
parent94c09169a22a847a6aa8d9d13f1949d1bc497c58 (diff)
downloadwebrtc-0359ba22256f26c723edac508886eb5df8073487.tar.gz
stats: add frame assembly time stats
implements a total frame assembly time statistic that measures the cumulative time between the arrival of the first packet of a frame (the lowest reception time) and the time all packets of the frame have been received (i.e. the highest reception time) This is similar to totalProcessingDelay https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-totalprocessingdelay in particular with respect to only being incremented for frames that are being decoded but does not include the amount of time spent decoding the frame. This statistic is useful for evaluating mechanisms like NACK and FEC and gives some insight into the behavior of the pacer sending the packets. Note that for frames with just a single packet the assembly time will be zero. In order to calculate an average assembly time an additional frames_assembled_from_multiple_packets counter for frames with more than a single packet is added. Currently this is a nonstandard stat so will only show up in webrtc-internals and not in getStats. Formally it can be defined as totalAssemblyTime of type double Only exists for video. The sum of the time, in seconds, each video frame takes from the time the first RTP packet is received (reception timestamp) and to the time the last RTP packet of a frame is received. Given the complexities involved, the time of arrival or the reception timestamp is measured as close to the network layer as possible. This metric is not incremented for frames that are not decoded, i.e., framesDropped, partialFramesLost or frames that fail decoding for other reasons (if any). Only incremented for frames consisting of more than one RTP packet. The average frame assembly time can be calculated by dividing the totalAssemblyTime with framesAssembledFromMultiplePacket. framesAssembledFromMultiplePacket of type unsigned long Only exists for video. It represents the total number of frames correctly decoded for this RTP stream that consist of more than one RTP packet. For such frames the totalAssemblyTime is incremented. BUG=webrtc:13986 Change-Id: Ie0ae431d72a57a0001c3240daba8eda35955f04e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/260920 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36922}
Diffstat (limited to 'media')
-rw-r--r--media/base/media_channel.h2
-rw-r--r--media/engine/webrtc_video_engine.cc3
-rw-r--r--media/engine/webrtc_video_engine_unittest.cc5
3 files changed, 10 insertions, 0 deletions
diff --git a/media/base/media_channel.h b/media/base/media_channel.h
index 3673169939..bb07f15b9d 100644
--- a/media/base/media_channel.h
+++ b/media/base/media_channel.h
@@ -615,6 +615,8 @@ struct VideoReceiverInfo : public MediaReceiverInfo {
uint64_t total_decode_time_ms = 0;
// https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-totalprocessingdelay
webrtc::TimeDelta total_processing_delay = webrtc::TimeDelta::Millis(0);
+ webrtc::TimeDelta total_assembly_time = webrtc::TimeDelta::Millis(0);
+ uint32_t frames_assembled_from_multiple_packets = 0;
double total_inter_frame_delay = 0;
double total_squared_inter_frame_delay = 0;
int64_t interframe_delay_max_ms = -1;
diff --git a/media/engine/webrtc_video_engine.cc b/media/engine/webrtc_video_engine.cc
index a8f33a960f..8135a526fb 100644
--- a/media/engine/webrtc_video_engine.cc
+++ b/media/engine/webrtc_video_engine.cc
@@ -3180,6 +3180,9 @@ WebRtcVideoChannel::WebRtcVideoReceiveStream::GetVideoReceiverInfo(
info.qp_sum = stats.qp_sum;
info.total_decode_time_ms = stats.total_decode_time_ms;
info.total_processing_delay = stats.total_processing_delay;
+ info.total_assembly_time = stats.total_assembly_time;
+ info.frames_assembled_from_multiple_packets =
+ stats.frames_assembled_from_multiple_packets;
info.last_packet_received_timestamp_ms =
stats.rtp_stats.last_packet_received_timestamp_ms;
info.estimated_playout_ntp_timestamp_ms =
diff --git a/media/engine/webrtc_video_engine_unittest.cc b/media/engine/webrtc_video_engine_unittest.cc
index 231fc84f6d..e1bfa73cb1 100644
--- a/media/engine/webrtc_video_engine_unittest.cc
+++ b/media/engine/webrtc_video_engine_unittest.cc
@@ -6116,6 +6116,8 @@ TEST_F(WebRtcVideoChannelTest, GetStatsTranslatesDecodeStatsCorrectly) {
stats.frames_decoded = 14;
stats.qp_sum = 15;
stats.total_decode_time_ms = 16;
+ stats.total_assembly_time = webrtc::TimeDelta::Millis(4);
+ stats.frames_assembled_from_multiple_packets = 2;
stream->SetStats(stats);
cricket::VideoMediaInfo info;
@@ -6144,6 +6146,9 @@ TEST_F(WebRtcVideoChannelTest, GetStatsTranslatesDecodeStatsCorrectly) {
info.receivers[0].key_frames_decoded);
EXPECT_EQ(stats.qp_sum, info.receivers[0].qp_sum);
EXPECT_EQ(stats.total_decode_time_ms, info.receivers[0].total_decode_time_ms);
+ EXPECT_EQ(stats.total_assembly_time, info.receivers[0].total_assembly_time);
+ EXPECT_EQ(stats.frames_assembled_from_multiple_packets,
+ info.receivers[0].frames_assembled_from_multiple_packets);
}
TEST_F(WebRtcVideoChannelTest,