This is an unofficial proposal.

Abstract

Unofficial additions to WebRTC's RTCPeerConnection.getStats() API.

Introduction

This document contains unofficial additions to the Identifiers for WebRTC's Statistics API specification [[WEBRTC-STATS]]. If a metric gains consensus it should be moved to the official spec.

Terminology

{{RTCStats}} and dictionaries that are extended in this document are defined in [[WEBRTC-STATS]]. The term RTCPeerConnection is defined in [[WEBRTC]] and {{DOMHighResTimeStamp}} is defined in [[HR-TIME]].

RTCCodecType enum

enum RTCCodecType {
"encode",
"decode",
};
{{RTCCodecType}} Enumeration description
Enum valueDescription
encode

The attached {{RTCCodecStats}} represents a media format that is being encoded, or that the implementation is prepared to encode.

decode

The attached {{RTCCodecStats}} represents a media format that the implementation is prepared to decode.

RTCCodecStats dictionary non-standardized members

partial dictionary RTCCodecStats {
      RTCCodecType codecType;
};
codecType of type {{RTCCodecType}}

{{RTCCodecType/"encode"}} or {{RTCCodecType/"decode"}}, depending on whether this object represents a media format that the implementation is prepared to encode or decode. If the dictionary member is not present, it means that this media format can be both encoded and decoded.

RTCMediaSourceStats dictionary non-standardized members

partial dictionary RTCMediaSourceStats {
      boolean relayedSource;
};
relayedSource of type boolean
true if the source is remote, for instance if it is sourced from another host via an RTCPeerConnection. false otherwise.

RTCVideoSourceStats dictionary non-standardized members

partial dictionary RTCVideoSourceStats {
      unsigned long bitDepth;
};
bitDepth of type unsigned long

The bit depth per pixel of the last frame originating from this source. Before a frame has been produced this member does not exist.

RTCRtpTransceiverStats dictionary non-standardized members

dictionary RTCRtpTransceiverStats : RTCStats {
      required DOMString senderId;
      required DOMString receiverId;
      DOMString          mid;
};
senderId of type DOMString

The identifier for the {{RTCRtpSenderStats}} stats object representing the RTCRtpSender associated with the RTCRtpTransceiver that this stats object represents.

receiverId of type DOMString

The identifier for the {{RTCRtpReceiverStats}} stats object representing the RTCRtpReceiver associated with the RTCRtpTransceiver that this stats object represents.

mid of type DOMString

If the RTCRtpTransceiver that this stats object represents has a RTCRtpTransceiver.mid value that is not null, this is that value, otherwise this member is not present.

RTCRtpSenderStats dictionary non-standardized members

dictionary RTCRtpSenderStats : RTCStats {
      DOMString mediaSourceId;
};
mediaSourceId of type DOMString

The identifier of the stats object representing the track currently attached to this sender, an {{RTCMediaSourceStats}}.

RTCRtpReceiverStats dictionary non-standardized members

dictionary RTCRtpReceiverStats : RTCStats {
      required DOMString trackIdentifier;
      required DOMString kind;
};
trackIdentifier of type DOMString

The id property of the {{RTCMediaStreamTrack}} attached to the {{RTCRtpReceiver}} that this stats object represents.

kind of type DOMString

Either "audio" or "video". The kind property of the {{RTCMediaStreamTrack}} attached to the {{RTCRtpReceiver}} that this stats object represents.

RTCOutboundRtpStreamStats dictionary non-standardized members

partial dictionary RTCOutboundRtpStreamStats {
      DOMString             contentType;
      DOMHighResTimeStamp   lastPacketSentTimestamp;
      unsigned long         packetsDiscardedOnSend;
      unsigned long long    bytesDiscardedOnSend;
      unsigned long         fecPacketsSent;
      unsigned long         frameBitDepth;
      unsigned long         framesDiscardedOnSend;
      unsigned long long    totalSamplesSent;
      unsigned long long    samplesEncodedWithSilk;
      unsigned long long    samplesEncodedWithCelt;
      boolean               voiceActivityFlag;
      double                averageRtcpInterval;
      record<USVString, unsigned long long> perDscpPacketsSent;
      unsigned long         sliCount;
};
contentType of type DOMString

This metric exposes the video-content-type of the last key frame sent. This value is updated every time the last packet of a key frame is sent, and it is updated as follows: if this packet contained the video-content-type RTP header extension value 0x00, contentType is "unspecified", if it is 0x01, contentType is "screenshare". In all other cases, such as if the header extension is missing, its value is invalid or no last packet of a key frame has been sent yet, contentType is missing.

lastPacketSentTimestamp of type DOMHighResTimeStamp

Represents the timestamp at which the last packet was sent for this SSRC. This differs from {{RTCStats/timestamp}}, which represents the time at which the statistics were generated by the local endpoint.

packetsDiscardedOnSend of type unsigned long

Total number of RTP packets for this SSRC that have been discarded due to socket errors, i.e. a socket error occured when handing the packets to the socket. This might happen due to various reasons, including full buffer or no available memory.

bytesDiscardedOnSend of type unsigned long long

Total number of bytes for this SSRC that have been discarded due to socket errors, i.e. a socket error occured when handing the packets containing the bytes to the socket. This might happen due to various reasons, including full buffer or no available memory. Calculated as defined in [[!RFC3550]] section 6.4.1.

fecPacketsSent of type unsigned long

Total number of RTP FEC packets sent for this SSRC. This counter can also be incremented when sending FEC packets in-band with media packets (e.g., with Opus).

frameBitDepth of type unsigned long

Only exists for video. Represents the bit depth per pixel of the last encoded frame. Typical values are 24, 30, or 36 bits. Before the first frame is encoded this member does not exist.

framesDiscardedOnSend of type unsigned long

Total number of video frames that have been discarded for this SSRC due to socket errors, i.e. a socket error occured when handing the packets to the socket. This might happen due to various reasons, including full buffer or no available memory.

totalSamplesSent of type unsigned long long

Only exists for audio. The total number of samples that have been sent over this RTP stream.

samplesEncodedWithSilk of type unsigned long long

Only exists for audio and when the audio codec is Opus. The total number of samples encoded by the SILK portion of the Opus codec.

samplesEncodedWithCelt of type unsigned long long

Only exists for audio and when the audio codec is Opus. The total number of samples encoded by the CELT portion of the Opus codec.

voiceActivityFlag of type boolean

Only exists for audio. Whether the last RTP packet sent contained voice activity or not based on the presence of the V bit in the extension header, as defined in [[RFC6464]].

averageRtcpInterval of type double

The average RTCP interval between two consecutive compound RTCP packets. This is calculated by the sending endpoint when sending compound RTCP reports. Compound packets must contain at least a RTCP RR or SR block and an SDES packet with the CNAME item.

perDscpPacketsSent of type record<USVString, unsigned long long>

Total number of packets sent for this SSRC, per DSCP. DSCPs are identified as decimal integers in string form.

sliCount of type unsigned long

Only exists for video. Count the total number of Slice Loss Indication (SLI) packets received by this sender. Calculated as defined in [[!RFC4585]] section 6.3.2.

RTCReceivedRtpStreamStats dictionary non-standardized members

partial dictionary RTCReceivedRtpStreamStats {
      unsigned long long   packetsRepaired;
      unsigned long long   burstPacketsLost;
      unsigned long long   burstPacketsDiscarded;
      unsigned long        burstLossCount;
      unsigned long        burstDiscardCount;
      double               burstLossRate;
      double               burstDiscardRate;
      double               gapLossRate;
      double               gapDiscardRate;
      unsigned long        partialFramesLost;
      unsigned long        fullFramesLost;
};
packetsRepaired of type unsigned long long

The cumulative number of lost RTP packets repaired after applying an error-resilience mechanism [[XRBLOCK-STATS]]. It is measured for the primary source RTP packets and only counted for RTP packets that have no further chance of repair. To clarify, the value is upper-bound to the cumulative number of lost packets. Calculated as defined in [[!RFC7509]] section 3.1 and Appendix A.b.

burstPacketsLost of type unsigned long long

The cumulative number of RTP packets lost during loss bursts, Appendix A (c) of [[!RFC6958]].

burstPacketsDiscarded of type unsigned long long

The cumulative number of RTP packets discarded during discard bursts, Appendix A (b) of [[!RFC7003]].

burstLossCount of type unsigned long

The cumulative number of bursts of lost RTP packets, Appendix A (e) of [[!RFC6958]].

[[!RFC3611]] recommends a Gmin (threshold) value of 16 for classifying a sequence of packet losses or discards as a burst.

burstDiscardCount of type unsigned long

The cumulative number of bursts of discarded RTP packets, Appendix A (e) of [[!RFC8015]].

burstLossRate of type double

The fraction of RTP packets lost during bursts to the total number of RTP packets expected in the bursts. As defined in Appendix A (a) of [[!RFC7004]], however, the actual value is reported without multiplying by 32768.

burstDiscardRate of type double

The fraction of RTP packets discarded during bursts to the total number of RTP packets expected in bursts. As defined in Appendix A (e) of [[!RFC7004]], however, the actual value is reported without multiplying by 32768.

gapLossRate of type double

The fraction of RTP packets lost during the gap periods. Appendix A (b) of [[!RFC7004]], however, the actual value is reported without multiplying by 32768.

gapDiscardRate of type double

The fraction of RTP packets discarded during the gap periods. Appendix A (f) of [[!RFC7004]], however, the actual value is reported without multiplying by 32768.

partialFramesLost of type unsigned long

Only exists for video. The cumulative number of partial frames lost. The measurement begins when the receiver is created and is a cumulative metric as defined in Appendix A (j) of [[!RFC7004]]. This metric is incremented when the frame is sent to the decoder. If the partial frame is received and recovered via retransmission or FEC before decoding, the framesReceived counter is incremented.

fullFramesLost of type unsigned long

Only exists for video. The cumulative number of full frames lost. The measurement begins when the receiver is created and is a cumulative metric as defined in Appendix A (i) of [[!RFC7004]].

RTCInboundRtpStreamStats dictionary non-standardized members

partial dictionary RTCInboundRtpStreamStats {
      DOMString            contentType;
      unsigned long        frameBitDepth;
      boolean              voiceActivityFlag;
      double               averageRtcpInterval;
      unsigned long long   packetsFailedDecryption;
      unsigned long long   packetsDuplicated;
      record<USVString, unsigned long long> perDscpPacketsReceived;
      unsigned long        sliCount;
      unsigned long long   totalSamplesDecoded;
      unsigned long long   samplesDecodedWithSilk;
      unsigned long long   samplesDecodedWithCelt;
};
contentType of type DOMString

This metric exposes the video-content-type of the last key frame received. This value is updated every time the last packet of a key frame is received, and it is updated as follows: if this packet contained the video-content-type RTP header extension value 0x00, contentType is "unspecified", if it is 0x01, contentType is "screenshare". In all other cases, such as if the header extension is missing, its value is invalid or no last packet of a key frame has been received yet, contentType is missing.

frameBitDepth of type unsigned long

Only exists for video. Represents the bit depth per pixel of the last decoded frame. Typical values are 24, 30, or 36 bits. Before the first frame is decoded this member does not exist.

voiceActivityFlag of type boolean

Only exists for audio. Whether the last RTP packet whose frame was delivered to the RTCRtpReceiver's MediaStreamTrack for playout contained voice activity or not based on the presence of the V bit in the extension header, as defined in [[RFC6464]]. This is the stats-equivalent of RTCRtpSynchronizationSource.voiceActivityFlag in [[WEBRTC].

averageRtcpInterval of type double

The average RTCP interval between two consecutive compound RTCP packets. This is calculated by the sending endpoint when sending compound RTCP reports. Compound packets must contain at least a RTCP RR or SR block and an SDES packet with the CNAME item.

packetsFailedDecryption of type unsigned long long

The cumulative number of RTP packets that failed to be decrypted according to the procedures in [[!RFC3711]]. These packets are not counted by packetsDiscarded.

packetsDuplicated of type unsigned long long
The cumulative number of packets discarded because they are duplicated. Duplicate packets are not counted in RTCReceivedRtpStreamStats/packetsDiscarded.
Duplicated packets have the same RTP sequence number and content as a previously received packet. If multiple duplicates of a packet are received, all of them are counted.
An improved estimate of lost packets can be calculated by adding {{packetsDuplicated}} to RTCReceivedRtpStreamStats/packetsLost; this will always result in a positive number, but not the same number as RFC 3550 would calculate.
perDscpPacketsReceived of type record<USVString, unsigned long long>

Total number of packets received for this SSRC, per Differentiated Services code point (DSCP) [[RFC2474]]. DSCPs are identified as decimal integers in string form. Note that due to network remapping and bleaching, these numbers are not expected to match the numbers seen on sending. Not all OSes make this information available.

sliCount of type unsigned long

Only exists for video. Count the total number of Slice Loss Indication (SLI) packets sent by this receiver. Calculated as defined in [[!RFC4585]] section 6.3.2.

totalSamplesDecoded of type unsigned long long

Only exists for audio. The total number of samples that have been decoded on this RTP stream.

samplesDecodedWithSilk of type unsigned long long

Only exists for audio and when the audio codec is Opus. The total number of samples decoded by the SILK portion of the Opus codec.

samplesDecodedWithCelt of type unsigned long long

Only exists for audio and when the audio codec is Opus. The total number of samples decoded by the CELT portion of the Opus codec.

RTCRemoteInboundRtpStreamStats dictionary non-standardized members

partial dictionary RTCRemoteInboundRtpStreamStats {
      unsigned long long reportsReceived;
      unsigned long long packetsDiscarded;
};
reportsReceived of type unsigned long long

Represents the total number of RTCP RR blocks received for this SSRC.

packetsDiscarded of type unsigned long long

The cumulative number of RTP packets discarded by the jitter buffer due to late or early-arrival, i.e., these packets are not played out. RTP packets discarded due to packet duplication are not reported in this metric [[XRBLOCK-STATS]]. Calculated as defined in [[!RFC7002]] section 3.2 and Appendix A.a.

RTCAudioReceiverStats dictionary non-standardized members

partial dictionary RTCAudioReceiverStats {
      unsigned long long jitterBufferFlushes;
};
jitterBufferFlushes of type unsigned long long

Experimental stat which is available under origin trial in Chromium starting from M72 version. Counts the total number of times the jitter buffer reaches its maximum capacity and gets flushed.

RTCVideoReceiverStats dictionary non-standardized members

partial dictionary RTCVideoReceiverStats {
      double totalFramesDuration;
      double sumOfSquaredFramesDuration;
};
totalFramesDuration of type double

Total duration of all rendered video frames, in seconds. This value is updated when a frame is rendered.

sumOfSquaredFramesDuration of type double

Sum of squared duration of all rendered frames. It can be used to calculate harmonic frame rate:

{{ RTCVideoReceiverStats/totalFramesDuration}} / sumOfSquaredFrameDurations

This value is updated when a frame is rendered.

RTCIceServerStats dictionary non-standardized members

partial dictionary RTCIceServerStats {
       RTCNetworkType       networkType;
       required DOMString   url;
       long                 port;
       DOMString            relayProtocol;
       unsigned long        totalRequestsSent;
       unsigned long        totalResponsesReceived;
       double               totalRoundTripTime;
};
networkType of type RTCNetworkType
This member is included in this document for historical reasons. Additional work is needed to reach consensus on the privacy model.

Represents the type of network interface used.

url of type DOMString

The URL of the ICE server (e.g. TURN or STUN server).

port of type long

It is the port number used by the client.

relayProtocol of type DOMString

It is the protocol used by the endpoint to communicate with the ICE server. Valid values are udp, tcp, or tls as defined in {{RTCIceCandidateStats}}. This is the same value that is used for the relay protocol of local ICE candidates.

totalRequestsSent of type unsigned long

The total amount of requests that have been sent to this server.

totalResponsesReceived of type unsigned long

The total amount of responses received from this server.

totalRoundTripTime of type double

The sum of RTTs for all requests that have been sent where a response has been received.

RTCIceCandidateStats dictionary non-standardized members

partial dictionary RTCIceCandidateStats {
       RTCNetworkType networkType;
};
networkType of type RTCNetworkType
This member is included in this document for historical reasons. Additional work is needed to reach consensus on the privacy model.

Represents the type of network interface used by the base of a local candidate (the address the ICE agent sends from). Only present for local candidates; it's not possible to know what type of network interface a remote candidate is using.

This stat only tells you about the network interface used by the first "hop"; it's possible that a connection will be bottlenecked by another type of network. For example, when using Wi-Fi tethering, the networkType of the relevant candidate would be "wifi", even when the next hop is over a cellular connection.

This reveals information that would otherwise not be available to web pages, which increases the fingerprint surface.

RTCIceCandidatePairStats dictionary non-standardized members

partial dictionary RTCIceCandidatePairStats {
      DOMHighResTimeStamp   firstRequestTimestamp;
      DOMHighResTimeStamp   lastRequestTimestamp;
      DOMHighResTimeStamp   lastResponseTimestamp;
      unsigned long         circuitBreakerTriggerCount;
      unsigned long long    retransmissionsReceived;
      unsigned long long    retransmissionsSent;
      DOMHighResTimeStamp   consentExpiredTimestamp;
      unsigned long long    requestBytesSent;
      unsigned long long    consentRequestBytesSent;
      unsigned long long    responseBytesSent;
};
firstRequestTimestamp of type DOMHighResTimeStamp

Represents the timestamp at which the first STUN request was sent on this particular candidate pair.

lastRequestTimestamp of type DOMHighResTimeStamp

Represents the timestamp at which the last STUN request was sent on this particular candidate pair. The average interval between two consecutive connectivity checks sent can be calculated with (lastRequestTimestamp - firstRequestTimestamp) / requestsSent.

lastResponseTimestamp of type DOMHighResTimeStamp

Represents the timestamp at which the last STUN response was received on this particular candidate pair.

circuitBreakerTriggerCount of type unsigned long

Represents the number of times the circuit breaker is triggered for this particular 5-tuple. Ceasing transmission when a circuit breaker is triggered is defined in Section 4.5 of [[!RFC8083]]. The field MUST return undefined for user-agents that do not implement the circuit-breaker algorithm.

retransmissionsReceived of type unsigned long long

Represents the total number of connectivity check request retransmissions received. Retransmissions are defined as connectivity check requests with a TRANSACTION_TRANSMIT_COUNTER attribute where the "req" field is larger than 1, as defined in [[!RFC7982]].

retransmissionsSent of type unsigned long long

Represents the total number of connectivity check request retransmissions sent.

consentExpiredTimestamp of type DOMHighResTimeStamp

Represents the timestamp at which the latest valid STUN binding response expired, as defined in [[!RFC7675]] section 5.1. If a valid STUN binding response has not been made responsesReceived is zero) or the latest one has not expired this value must be undefined.

requestBytesSent of type unsigned long long

Total number of bytes sent for connectivity checks.

consentRequestBytesSent of type unsigned long long

Total number of bytes sent for consent requests.

responseBytesSent of type unsigned long long

Total number of bytes sent for connectivity check responses.

RTCTransportStats dictionary non-standardized members

partial dictionary RTCTransportStats {
      DOMString rtcpTransportStatsId;
      DOMString tlsGroup;
};
rtcpTransportStatsId of type DOMString

If RTP and RTCP are not multiplexed, this is the {{RTCStats/id}} of the transport that gives stats for the RTCP component, and this record has only the RTP component stats.

tlsGroup of type DOMString

Descriptive name of the group used for the encryption, as defined in the "Description" column of the IANA TLS Supported Groups registry [[!IANA-TLS-GROUPS]].

RTCSctpTransportStats dictionary non-standardized members

An {{RTCSctpTransportStats}} object represents the stats corresponding to an {{RTCSctpTransport}} described in [[!WEBRTC]].

There is only one {{RTCSctpTransportStats}} object, since the PeerConnection can only have one SCTP transport.

dictionary RTCSctpTransportStats : RTCStats {
        DOMString transportId;
        double smoothedRoundTripTime;
        unsigned long congestionWindow;
        unsigned long receiverWindow;
        unsigned long mtu;
        unsigned long unackData;
};
transportId of type DOMString

The identifier of the object that was inspected to produce the {{RTCTransportStats}} for the DTLSTransport and ICETransport supporting the SCTP transport.

smoothedRoundTripTime of type double

The latest smoothed round-trip time value, corresponding to spinfo_srtt defined in [[RFC6458]] but converted to seconds. If there has been no round-trip time measurements yet, this value is undefined.

congestionWindow of type unsigned long

The latest congestion window, corresponding to spinfo_cwnd defined in [[RFC6458]].

receiverWindow of type unsigned long

The latest receiver window, corresponding to sstat_rwnd defined in [[RFC6458]].

mtu of type unsigned long

The latest maximum transmission unit, corresponding to spinfo_mtu defined in [[RFC6458]].

unackData of type unsigned long

The number of unacknowledged DATA chunks, corresponding to sstat_unackdata defined in [[RFC6458]].

RTCPeerConnectionStats dictionary non-standardized members

partial dictionary RTCPeerConnectionStats {
      unsigned long dataChannelsRequested;
      unsigned long dataChannelsAccepted;
};
dataChannelsRequested of type unsigned long

Represents the number of unique RTCDataChannels returned from a successful RTCPeerConnection/createDataChannel() call on the RTCPeerConnection. If the underlying data transport is not established, these may be in the "connecting" state.

dataChannelsAccepted of type unsigned long

Represents the number of unique RTCDataChannels signaled in a RTCPeerConnection.ondatachannel event on the RTCPeerConnection.

The sum of dataChannelsRequested and dataChannelsAccepted is always greater than or equal to dataChannelsOpened - the difference is equal to the number of channels that have been requested, but have not reached the "open" state.

RTCRtpContributingSourceStats dictionary non-standardized members

The {{RTCRtpContributingSourceStats}} dictionary represents the measurement metrics for a contributing source (CSRC) that is contributing to an incoming RTP stream. Each contributing source produces a stream of RTP packets, which are combined by a mixer into a single stream of RTP packets that is ultimately received by the WebRTC endpoint. Information about the sources that contributed to this combined stream may be provided in the CSRC list or [[RFC6465]] header extension of received RTP packets. The {{RTCStats/timestamp}} of this stats object is the most recent time an RTP packet the source contributed to was received and counted by {{RTCRtpContributingSourceStats/packetsContributedTo}}.

dictionary RTCRtpContributingSourceStats : RTCStats {
      required unsigned long   contributorSsrc;
      required DOMString       inboundRtpStreamId;
      unsigned long            packetsContributedTo;
      double                   audioLevel;
};
contributorSsrc of type unsigned long

The SSRC identifier of the contributing source represented by this stats object, as defined by [[!RFC3550]]. It is a 32-bit unsigned integer that appears in the CSRC list of any packets the relevant source contributed to.

inboundRtpStreamId of type DOMString

The ID of the {{RTCInboundRtpStreamStats}} object representing the inbound RTP stream that this contributing source is contributing to.

packetsContributedTo of type unsigned long

The total number of RTP packets that this contributing source contributed to. This value is incremented each time a packet is counted by {{RTCInboundRtpStreamStats}}.{{RTCReceivedRtpStreamStats/packetsReceived}}, and the packet's CSRC list (as defined by [[!RFC3550]] section 5.1) contains the SSRC identifier of this contributing source, {{contributorSsrc}}.

audioLevel of type double

Present if the last received RTP packet that this source contributed to contained an [[!RFC6465]] mixer-to-client audio level header extension. The value of {{audioLevel}} is between 0..1 (linear), where 1.0 represents 0 dBov, 0 represents silence, and 0.5 represents approximately 6 dBSPL change in the sound pressure level from 0 dBov.

The [[!RFC6465]] header extension contains values in the range 0..127, in units of -dBov, where 127 represents silence. To convert these values to the linear 0..1 range of {{audioLevel}}, a value of 127 is converted to 0, and all other values are converted using the equation: f(rfc6465_level) = 10^(-rfc6465_level/20).

RTCNetworkType enum

This enum is included in this document for historical reasons. Additional work is needed to reach consensus on the privacy model.
enum RTCNetworkType {
    "bluetooth",
    "cellular",
    "ethernet",
    "wifi",
    "wimax",
    "vpn",
    "unknown"
};
Enumeration description
bluetooth

A Bluetooth connection.

cellular

A cellular connection (e.g., EDGE, HSPA, LTE, etc.).

ethernet

An Ethernet connection.

wifi

A Wi-Fi connection.

wimax

A WiMAX connection.

vpn

The connection runs over a VPN. The underlying network type is not available.

unknown

The user agent is unable or unwilling to identify the underlying connection technology.