1<?% config.freshness.reviewed = '2021-04-14' %?> 2<?% config.freshness.owner = 'asapersson' %?> 3 4# Video stats 5 6Overview of collected statistics for [VideoSendStream] and [VideoReceiveStream]. 7 8## VideoSendStream 9 10[VideoSendStream::Stats] for a sending stream can be gathered via `VideoSendStream::GetStats()`. 11 12Some statistics are collected per RTP stream (see [StreamStats]) and can be of `StreamType`: `kMedia`, `kRtx`, `kFlexfec`. 13 14Multiple `StreamStats` objects are for example present if simulcast is used (multiple `kMedia` objects) or if RTX or FlexFEC is negotiated. 15 16### SendStatisticsProxy 17`VideoSendStream` owns a [SendStatisticsProxy] which implements 18`VideoStreamEncoderObserver`, 19`RtcpStatisticsCallback`, 20`ReportBlockDataObserver`, 21`RtcpPacketTypeCounterObserver`, 22`StreamDataCountersCallback`, 23`BitrateStatisticsObserver`, 24`FrameCountObserver`, 25`SendSideDelayObserver` 26and holds a `VideoSendStream::Stats` object. 27 28`SendStatisticsProxy` is called via these interfaces by different components (e.g. `RtpRtcp` module) to update stats. 29 30#### StreamStats 31* `type` - kMedia, kRtx or kFlexfec. 32* `referenced_media_ssrc` - only present for type kRtx/kFlexfec. The SSRC for the kMedia stream that retransmissions or FEC is performed for. 33 34Updated when a frame has been encoded, `VideoStreamEncoder::OnEncodedImage`. 35* `frames_encoded `- total number of encoded frames. 36* `encode_frame_rate` - number of encoded frames during the last second. 37* `width` - width of last encoded frame [[rtcoutboundrtpstreamstats-framewidth]]. 38* `height` - height of last encoded frame [[rtcoutboundrtpstreamstats-frameheight]]. 39* `total_encode_time_ms` - total encode time for encoded frames. 40* `qp_sum` - sum of quantizer values of encoded frames [[rtcoutboundrtpstreamstats-qpsum]]. 41* `frame_counts` - total number of encoded key/delta frames [[rtcoutboundrtpstreamstats-keyframesencoded]]. 42 43Updated when a RTP packet is transmitted to the network, `RtpSenderEgress::SendPacket`. 44* `rtp_stats` - total number of sent bytes/packets. 45* `total_bitrate_bps` - total bitrate sent in bits per second (over a one second window). 46* `retransmit_bitrate_bps` - total retransmit bitrate sent in bits per second (over a one second window). 47* `avg_delay_ms` - average capture-to-send delay for sent packets (over a one second window). 48* `max_delay_ms` - maximum capture-to-send delay for sent packets (over a one second window). 49* `total_packet_send_delay_ms` - total capture-to-send delay for sent packets [[rtcoutboundrtpstreamstats-totalpacketsenddelay]]. 50 51Updated when an incoming RTCP packet is parsed, `RTCPReceiver::ParseCompoundPacket`. 52* `rtcp_packet_type_counts` - total number of received NACK/FIR/PLI packets [rtcoutboundrtpstreamstats-[nackcount], [fircount], [plicount]]. 53 54Updated when a RTCP report block packet is received, `RTCPReceiver::TriggerCallbacksFromRtcpPacket`. 55* `rtcp_stats` - RTCP report block data. 56* `report_block_data` - RTCP report block data. 57 58#### Stats 59* `std::map<uint32_t, StreamStats> substreams` - StreamStats mapped per SSRC. 60 61Updated when a frame is received from the source, `VideoStreamEncoder::OnFrame`. 62* `frames` - total number of frames fed to VideoStreamEncoder. 63* `input_frame_rate` - number of frames fed to VideoStreamEncoder during the last second. 64* `frames_dropped_by_congestion_window` - total number of dropped frames due to congestion window pushback. 65* `frames_dropped_by_encoder_queue` - total number of dropped frames due to that the encoder is blocked. 66 67Updated if a frame from the source is dropped, `VideoStreamEncoder::OnDiscardedFrame`. 68* `frames_dropped_by_capturer` - total number dropped frames by the source. 69 70Updated if a frame is dropped by `FrameDropper`, `VideoStreamEncoder::MaybeEncodeVideoFrame`. 71* `frames_dropped_by_rate_limiter` - total number of dropped frames to avoid bitrate overuse. 72 73Updated (if changed) before a frame is passed to the encoder, `VideoStreamEncoder::EncodeVideoFrame`. 74* `encoder_implementation_name` - name of encoder implementation [[rtcoutboundrtpstreamstats-encoderimplementation]]. 75 76Updated after a frame has been encoded, `VideoStreamEncoder::OnEncodedImage`. 77* `frames_encoded `- total number of encoded frames [[rtcoutboundrtpstreamstats-framesencoded]]. 78* `encode_frame_rate` - number of encoded frames during the last second [[rtcoutboundrtpstreamstats-framespersecond]]. 79* `total_encoded_bytes_target` - total target frame size in bytes [[rtcoutboundrtpstreamstats-totalencodedbytestarget]]. 80* `huge_frames_sent` - total number of huge frames sent [[rtcoutboundrtpstreamstats-hugeframessent]]. 81* `media_bitrate_bps` - the actual bitrate the encoder is producing. 82* `avg_encode_time_ms` - average encode time for encoded frames. 83* `total_encode_time_ms` - total encode time for encoded frames [[rtcoutboundrtpstreamstats-totalencodetime]]. 84* `frames_dropped_by_encoder`- total number of dropped frames by the encoder. 85 86Adaptation stats. 87* `bw_limited_resolution` - shows if resolution is limited due to restricted bandwidth. 88* `cpu_limited_resolution` - shows if resolution is limited due to cpu. 89* `bw_limited_framerate` - shows if framerate is limited due to restricted bandwidth. 90* `cpu_limited_framerate` - shows if framerate is limited due to cpu. 91* `quality_limitation_reason` - current reason for limiting resolution and/or framerate [[rtcoutboundrtpstreamstats-qualitylimitationreason]]. 92* `quality_limitation_durations_ms` - total time spent in quality limitation state [[rtcoutboundrtpstreamstats-qualitylimitationdurations]]. 93* `quality_limitation_resolution_changes` - total number of times that resolution has changed due to quality limitation [[rtcoutboundrtpstreamstats-qualitylimitationresolutionchanges]]. 94* `number_of_cpu_adapt_changes` - total number of times resolution/framerate has changed due to cpu limitation. 95* `number_of_quality_adapt_changes` - total number of times resolution/framerate has changed due to quality limitation. 96 97Updated when the encoder is configured, `VideoStreamEncoder::ReconfigureEncoder`. 98* `content_type` - configured content type (UNSPECIFIED/SCREENSHARE). 99 100Updated when the available bitrate changes, `VideoSendStreamImpl::OnBitrateUpdated`. 101* `target_media_bitrate_bps` - the bitrate the encoder is configured to use. 102* `suspended` - shows if video is suspended due to zero target bitrate. 103 104## VideoReceiveStream 105[VideoReceiveStream::Stats] for a receiving stream can be gathered via `VideoReceiveStream::GetStats()`. 106 107### ReceiveStatisticsProxy 108`VideoReceiveStream` owns a [ReceiveStatisticsProxy] which implements 109`VCMReceiveStatisticsCallback`, 110`RtcpCnameCallback`, 111`RtcpPacketTypeCounterObserver`, 112`CallStatsObserver` 113and holds a `VideoReceiveStream::Stats` object. 114 115`ReceiveStatisticsProxy` is called via these interfaces by different components (e.g. `RtpRtcp` module) to update stats. 116 117#### Stats 118* `current_payload_type` - current payload type. 119* `ssrc` - configured SSRC for the received stream. 120 121Updated when a complete frame is received, `FrameBuffer::InsertFrame`. 122* `frame_counts` - total number of key/delta frames received [[rtcinboundrtpstreamstats-keyframesdecoded]]. 123* `network_frame_rate` - number of frames received during the last second. 124 125Updated when a frame is ready for decoding, `FrameBuffer::GetNextFrame`. From `VCMTiming`: 126* `jitter_buffer_ms` - jitter buffer delay in ms. 127* `max_decode_ms` - the 95th percentile observed decode time within a time window (10 sec). 128* `render_delay_ms` - render delay in ms. 129* `min_playout_delay_ms` - minimum playout delay in ms. 130* `target_delay_ms` - target playout delay in ms. Max(`min_playout_delay_ms`, `jitter_delay_ms` + `max_decode_ms` + `render_delay_ms`). 131* `current_delay_ms` - actual playout delay in ms. 132* `jitter_buffer_delay_seconds` - total jitter buffer delay in seconds [[rtcinboundrtpstreamstats-jitterbufferdelay]]. 133* `jitter_buffer_emitted_count` - total number of frames that have come out from the jitter buffer [[rtcinboundrtpstreamstats-jitterbufferemittedcount]]. 134 135Updated (if changed) after a frame is passed to the decoder, `VCMGenericDecoder::Decode`. 136* `decoder_implementation_name` - name of decoder implementation [[rtcinboundrtpstreamstats-decoderimplementation]]. 137 138Updated when a frame is ready for decoding, `FrameBuffer::GetNextFrame`. 139* `timing_frame_info` - timestamps for a full lifetime of a frame. 140* `first_frame_received_to_decoded_ms` - initial decoding latency between the first arrived frame and the first decoded frame. 141* `frames_dropped` - total number of dropped frames prior to decoding or if the system is too slow [[rtcreceivedrtpstreamstats-framesdropped]]. 142 143Updated after a frame has been decoded, `VCMDecodedFrameCallback::Decoded`. 144* `frames_decoded` - total number of decoded frames [[rtcinboundrtpstreamstats-framesdecoded]]. 145* `decode_frame_rate` - number of decoded frames during the last second [[rtcinboundrtpstreamstats-framespersecond]]. 146* `decode_ms` - time to decode last frame in ms. 147* `total_decode_time_ms` - total decode time for decoded frames [[rtcinboundrtpstreamstats-totaldecodetime]]. 148* `qp_sum` - sum of quantizer values of decoded frames [[rtcinboundrtpstreamstats-qpsum]]. 149* `content_type` - content type (UNSPECIFIED/SCREENSHARE). 150* `interframe_delay_max_ms` - max inter-frame delay within a time window between decoded frames. 151* `total_inter_frame_delay` - sum of inter-frame delay in seconds between decoded frames [[rtcinboundrtpstreamstats-totalinterframedelay]]. 152* `total_squared_inter_frame_delay` - sum of squared inter-frame delays in seconds between decoded frames [[rtcinboundrtpstreamstats-totalsquaredinterframedelay]]. 153 154Updated before a frame is sent to the renderer, `VideoReceiveStream2::OnFrame`. 155* `frames_rendered` - total number of rendered frames. 156* `render_frame_rate` - number of rendered frames during the last second. 157* `width` - width of last frame fed to renderer [[rtcinboundrtpstreamstats-framewidth]]. 158* `height` - height of last frame fed to renderer [[rtcinboundrtpstreamstats-frameheight]]. 159* `estimated_playout_ntp_timestamp_ms` - estimated playout NTP timestamp [[rtcinboundrtpstreamstats-estimatedplayouttimestamp]]. 160* `sync_offset_ms` - NTP timestamp difference between the last played out audio and video frame. 161* `freeze_count` - total number of detected freezes. 162* `pause_count` - total number of detected pauses. 163* `total_freezes_duration_ms` - total duration of freezes in ms. 164* `total_pauses_duration_ms` - total duration of pauses in ms. 165* `total_frames_duration_ms` - time in ms between the last rendered frame and the first rendered frame. 166* `sum_squared_frame_durations` - sum of squared inter-frame delays in seconds between rendered frames. 167 168`ReceiveStatisticsImpl::OnRtpPacket` is updated for received RTP packets. From `ReceiveStatistics`: 169* `total_bitrate_bps` - incoming bitrate in bps. 170* `rtp_stats` - RTP statistics for the received stream. 171 172Updated when a RTCP packet is sent, `RTCPSender::ComputeCompoundRTCPPacket`. 173* `rtcp_packet_type_counts` - total number of sent NACK/FIR/PLI packets [rtcinboundrtpstreamstats-[nackcount], [fircount], [plicount]]. 174 175 176[VideoSendStream]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/call/video_send_stream.h 177[VideoSendStream::Stats]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/call/video_send_stream.h?q=VideoSendStream::Stats 178[StreamStats]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/call/video_send_stream.h?q=VideoSendStream::StreamStats 179[SendStatisticsProxy]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/video/send_statistics_proxy.h 180[rtcoutboundrtpstreamstats-framewidth]: https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-framewidth 181[rtcoutboundrtpstreamstats-frameheight]: https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-frameheight 182[rtcoutboundrtpstreamstats-qpsum]: https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-qpsum 183[rtcoutboundrtpstreamstats-keyframesencoded]: https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-keyframesencoded 184[rtcoutboundrtpstreamstats-totalpacketsenddelay]: https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-totalpacketsenddelay 185[nackcount]: https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-nackcount 186[fircount]: https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-fircount 187[plicount]: https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-plicount 188[rtcoutboundrtpstreamstats-encoderimplementation]: https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-encoderimplementation 189[rtcoutboundrtpstreamstats-framesencoded]: https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-framesencoded 190[rtcoutboundrtpstreamstats-framespersecond]: https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-framespersecond 191[rtcoutboundrtpstreamstats-totalencodedbytestarget]: https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-totalencodedbytestarget 192[rtcoutboundrtpstreamstats-hugeframessent]: https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-hugeframessent 193[rtcoutboundrtpstreamstats-totalencodetime]: https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-totalencodetime 194[rtcoutboundrtpstreamstats-qualitylimitationreason]: https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-qualitylimitationreason 195[rtcoutboundrtpstreamstats-qualitylimitationdurations]: https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-qualitylimitationdurations 196[rtcoutboundrtpstreamstats-qualitylimitationresolutionchanges]: https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-qualitylimitationresolutionchanges 197 198[VideoReceiveStream]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/call/video_receive_stream.h 199[VideoReceiveStream::Stats]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/call/video_receive_stream.h?q=VideoReceiveStream::Stats 200[ReceiveStatisticsProxy]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/video/receive_statistics_proxy2.h 201[rtcinboundrtpstreamstats-keyframesdecoded]: https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-keyframesdecoded 202[rtcinboundrtpstreamstats-jitterbufferdelay]: https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-jitterbufferdelay 203[rtcinboundrtpstreamstats-jitterbufferemittedcount]: https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-jitterbufferemittedcount 204[rtcinboundrtpstreamstats-decoderimplementation]: https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-decoderimplementation 205[rtcreceivedrtpstreamstats-framesdropped]: https://www.w3.org/TR/webrtc-stats/#dom-rtcreceivedrtpstreamstats-framesdropped 206[rtcinboundrtpstreamstats-framesdecoded]: https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-framesdecoded 207[rtcinboundrtpstreamstats-framespersecond]: https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-framespersecond 208[rtcinboundrtpstreamstats-totaldecodetime]: https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-totaldecodetime 209[rtcinboundrtpstreamstats-qpsum]: https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-qpsum 210[rtcinboundrtpstreamstats-totalinterframedelay]: https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-totalinterframedelay 211[rtcinboundrtpstreamstats-totalsquaredinterframedelay]: https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-totalsquaredinterframedelay 212[rtcinboundrtpstreamstats-estimatedplayouttimestamp]: https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-estimatedplayouttimestamp 213[rtcinboundrtpstreamstats-framewidth]: https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-framewidth 214[rtcinboundrtpstreamstats-frameheight]: https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-frameheight 215[nackcount]: https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-nackcount 216[fircount]: https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-fircount 217[plicount]: https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-plicount 218