Stats

The stats dictionaries of the WebRTC Statistics specification, and the report that holds them.

class webrtc.models.rtc_stats.RTCStats(**members)

The members every stats dictionary has, and the base of all of them.

A report holds the dictionary of the type of the stats, like webrtc.RTCOutboundRtpStreamStats. It holds this base one for a type this library doesn’t model, or when a required member is missing from the stats. Members are keyword-only. A string value that its enum lacks is kept as a plain str.

Parameters:
  • timestamp (float) – When the stats were collected, in milliseconds since the Unix epoch.

  • type (webrtc.RTCStatsType) – The type of the stats, like 'outbound-rtp'.

  • id (str) – Identifies the stats in its report.

Raises:

TypeError – If a required member is missing, or a member is unknown.

class webrtc.models.rtc_stats.RTCRtpStreamStats(**members)

Stats of an RTP stream.

It has the members of webrtc.RTCStats too.

Parameters:
class webrtc.models.rtc_stats.RTCCodecStats(**members)

Stats of a codec negotiated on a transport, of type 'codec'.

It has the members of webrtc.RTCStats too.

See MDN: RTCCodecStats.

Parameters:
class webrtc.models.rtc_stats.RTCReceivedRtpStreamStats(**members)

Stats of an RTP stream, as its receiver measures it.

It has the members of webrtc.RTCRtpStreamStats too.

Parameters:
  • packets_received (int, optional) – The packets received. See MDN: RTCInboundRtpStreamStats/packetsReceived.

  • packets_received_with_ect1 (int, optional) – The packets received with the ECT(1) ECN marking.

  • packets_received_with_ce (int, optional) – The packets received with the CE ECN marking.

  • packets_reported_as_lost (int, optional) – The packets reported lost in congestion control feedback.

  • packets_reported_as_lost_but_recovered (int, optional) – The packets reported lost that were received later.

  • packets_lost (int, optional) – The packets lost, as RTCP reports count them. See MDN: RTCInboundRtpStreamStats/packetsLost.

  • jitter (float, optional) – The packet jitter in seconds. See MDN: RTCInboundRtpStreamStats/jitter.

class webrtc.models.rtc_stats.RTCInboundRtpStreamStats(**members)

Stats of an RTP stream the connection receives, of type 'inbound-rtp'.

It has the members of webrtc.RTCReceivedRtpStreamStats too.

See MDN: RTCInboundRtpStreamStats.

Parameters:
class webrtc.models.rtc_stats.RTCRemoteInboundRtpStreamStats(**members)

Stats of a stream the connection sends, as the remote peer receives it. Its type is 'remote-inbound-rtp'.

It has the members of webrtc.RTCReceivedRtpStreamStats too.

See MDN: RTCRemoteInboundRtpStreamStats.

Parameters:
class webrtc.models.rtc_stats.RTCSentRtpStreamStats(**members)

Stats of an RTP stream, as its sender measures it.

It has the members of webrtc.RTCRtpStreamStats too.

Parameters:
class webrtc.models.rtc_stats.RTCOutboundRtpStreamStats(**members)

Stats of an RTP stream the connection sends, of type 'outbound-rtp'.

It has the members of webrtc.RTCSentRtpStreamStats too.

See MDN: RTCOutboundRtpStreamStats.

Parameters:
class webrtc.models.rtc_stats.RTCRemoteOutboundRtpStreamStats(**members)

Stats of a stream the connection receives, as the remote peer sends it. Its type is 'remote-outbound-rtp'.

It has the members of webrtc.RTCSentRtpStreamStats too.

See MDN: RTCRemoteOutboundRtpStreamStats.

Parameters:
class webrtc.models.rtc_stats.RTCMediaSourceStats(**members)

Stats of a track a sender sends, of type 'media-source'.

It has the members of webrtc.RTCStats too.

Parameters:
class webrtc.models.rtc_stats.RTCAudioSourceStats(**members)

Stats of an audio track a sender sends, of type 'media-source'.

It has the members of webrtc.RTCMediaSourceStats too.

See MDN: RTCAudioSourceStats.

Parameters:
class webrtc.models.rtc_stats.RTCVideoSourceStats(**members)

Stats of a video track a sender sends, of type 'media-source'.

It has the members of webrtc.RTCMediaSourceStats too.

See MDN: RTCVideoSourceStats.

Parameters:
class webrtc.models.rtc_stats.RTCAudioPlayoutStats(**members)

Stats of the playout of received audio, of type 'media-playout'.

It has the members of webrtc.RTCStats too.

Parameters:
  • kind (str) – The kind of the media, 'audio'.

  • synthesized_samples_duration (float, optional) – The total seconds of samples synthesized for playout.

  • synthesized_samples_events (int, optional) – The events of synthesizing samples.

  • total_samples_duration (float, optional) – The total seconds of samples played out.

  • total_playout_delay (float, optional) – The sum of the playout delays of the samples, in seconds.

  • total_samples_count (int, optional) – The samples played out.

class webrtc.models.rtc_stats.RTCPeerConnectionStats(**members)

Stats of the connection, of type 'peer-connection'.

It has the members of webrtc.RTCStats too.

See MDN: RTCPeerConnectionStats.

Parameters:
class webrtc.models.rtc_stats.RTCDataChannelStats(**members)

Stats of a data channel, of type 'data-channel'.

It has the members of webrtc.RTCStats too.

See MDN: RTCDataChannelStats.

Parameters:
class webrtc.models.rtc_stats.RTCTransportStats(**members)

Stats of a transport, of type 'transport'.

It has the members of webrtc.RTCStats too.

See MDN: RTCTransportStats.

Parameters:
class webrtc.models.rtc_stats.RTCIceCandidateStats(**members)

Stats of an ICE candidate, of type 'local-candidate' or 'remote-candidate'.

It has the members of webrtc.RTCStats too.

See MDN: RTCIceCandidateStats.

Parameters:
class webrtc.models.rtc_stats.RTCIceCandidatePairStats(**members)

Stats of an ICE candidate pair, of type 'candidate-pair'.

It has the members of webrtc.RTCStats too.

See MDN: RTCIceCandidatePairStats.

Parameters:
class webrtc.models.rtc_stats.RTCCertificateStats(**members)

Stats of a certificate, of type 'certificate'.

It has the members of webrtc.RTCStats too.

See MDN: RTCCertificateStats.

Parameters:
class webrtc.models.rtc_stats.RTCStatsReport(stats)

The stats of a connection, a sender or a receiver, as a read-only mapping of stats ids to stats.

Each value is the dictionary of its type, like webrtc.RTCInboundRtpStreamStats for 'inbound-rtp'. The track_identifier of inbound RTP stats is the webrtc.MediaStreamTrack.id of the remote track, and the address of a candidate is None when it isn’t exposed, like for peer-reflexive ones.

See MDN: RTCStatsReport.

Parameters:

stats (dict of str to webrtc.RTCStats) – The stats, by their ids.