Draft
This page is not complete.
The RTCStatsReport interface is used to provide statistics data about WebRTC connections as returned by the RTCPeerConnection.getStats(), RTCRtpReceiver.getStats(), and RTCRtpSender.getStats() methods. This object consists of a mapping of strings which identify a category of statistics to objects which contains the various measured values for each.
Calling getStats() on an RTCPeerConnection lets you specifiy whether you wish to obtain statistics for outbound, inbound, or all streams on the connection. The RTCRtpReceiver and RTCRtpSender versions of getStats() specifically only return the incoming and outgoing streams, respectively.
The full RTCStatsReport interface is made up of a mapping of strings to subdictionaries which contain the statistics for each category, such as ICE candidate or media stream statistics. Each of these subdictionaries has in common the following values:
timestampDOMHighResTimeStamp object which indicates the time at which the data was handled by the local WebRTC layer; for example, for statistics related to received RCTP packets, this would indicate the time at which the data was received by the local endpoint (the remote timestamp is available as well in one of the fields defined within one of the other subdictionaries. The time is specified relative to the UNIX epoch (the first moment of January 1, 1970, UTC).typeRTCStatsType,idDOMString which uniquely identifies the object which was inspected to produce this object based on RTCStats. This allows any two RTCStats-based objects which were produced from the same data to be correlated to one another. The format of this ID is not defined by the specification, so it cannot be relied upon to have any particular format, structure, or meaning beyond that.From a definition standpoint, these values are defined in the RTCStats dictionary in RTCStatsReport's WebIDL file.
RTCRTPStreamStats is the base class for all RTP-related statistics reports. It's based on RTCStats and adds the following additional fields.
ssrcRTCRTPStreamStats object covers. This value is generated per the RFC 3550 specification.mediaTypeDOMString which identifies the type of media being carried on the associated MediaStreamTrack. This must be either "audio" or "video", and will match the media type included in RTCCodecStats.codec.trackIdDOMString which uniquely identifies the RTCMediaStreamTrackStats object representing the associated MediaStreamTrack. This is not the same as the value of MediaStreamTrack.id.transportIdDOMString uniquely identifying the object which was inspected to produce the RTCTransportStats object associated with this RTP stream.codecIdDOMString which uniquely identifies the object which was inspected to produce the RTCCodecStats object associated with this RTP stream.These properties are computed locally, and are only available to the device receiving the media stream. Their primary purpose is to examine the error resiliency of the connection, as they provide information about lost packets, lost frames, and how heavily compressed the data is.
firCountpliCountnackCountsliCountqpSumRTCStats object. In general, the higher this number is, the more heavily compressed the video track was. Combined with RTCReceivedRTPStreamStats.framesDecoded or RTCSentRTPStreamStats.framesEncoded, you can approximate the average QP over those frames, keeping in mind that codecs often vary the quantizer values even within frames. Also keep in mind that the values of QP can vary from codec to codec, so this value is only potentially useful when compared against the same codec.Contains statistics about inbound RTP streaming. The RTCInboundRTPStreamStats dictionary is based upon both RTCStats and RTCRTPStreamStats and includes all properties from those dictionaries, as well as the following:
bytesReceivedjitterpacketsDiscardedpacketsLostpacketsReceivedContains statistics about outbound RTP streaming. The RTCOutboundRTPStreamStats dictionary is based upon both RTCStats and RTCRTPStreamStats and includes all properties from those dictionaries, as well as the following:
packetsSentbytesSenttargetBitratedroppedFramesframesEncoded| Specification | Status | Comment |
|---|---|---|
| WebRTC 1.0: Real-time Communication Between Browsers The definition of 'RTCPeerConnection.currentRemoteDescription' in that specification. | Working Draft | Initial specification. |
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | No support | No support | No support | No support | No support |
| Feature | Android Webview | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Basic support | No support | No support | No support | No support | No support | No support |
The addition of currentRemoteDescription and pendingLocalDescription to the WebRTC spec is relatively recent. In browsers which don't support them, just use remoteDescription.
RTCPeerConnectionRTCPeerConnection.getStats(), RTCRtpReceiver.getStats(), and RTCRtpSender.getStats()
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/RTCStatsReport