RTP parameters

RTP parameters and capabilities of senders, receivers and transceivers.

class webrtc.models.rtp_parameters.RTCRtpCodec(mime_type, clock_rate, channels=None, sdp_fmtp_line=None)

A codec a sender or a receiver supports, or the one an encoding sends with.

Codecs given to the library match a supported one by MIME type (ignoring case), clock rate, channels and fmtp parameters (in any order).

See MDN: RTCRtpSender/getCapabilities_static.

Parameters:
  • mime_type (str) – The type and subtype of the codec, like 'audio/opus'.

  • clock_rate (int) – The RTP clock rate in Hz.

  • channels (int, optional) – The number of audio channels. It’s None for video.

  • sdp_fmtp_line (str, optional) – The codec parameters, as in the a=fmtp line of SDP, like 'minptime=10;useinbandfec=1'.

class webrtc.models.rtp_parameters.RTCRtpCodecParameters(payload_type, mime_type, clock_rate, channels=None, sdp_fmtp_line=None)

A codec negotiated for a sender or a receiver, with its payload type.

See MDN: RTCRtpSender/getParameters.

Parameters:
  • payload_type (int) – The RTP payload type the codec is negotiated with.

  • mime_type (str) – The type and subtype of the codec, like 'audio/opus'.

  • clock_rate (int) – The RTP clock rate in Hz.

  • channels (int, optional) – The number of audio channels. It’s None for video.

  • sdp_fmtp_line (str, optional) – The codec parameters, as in the a=fmtp line of SDP.

class webrtc.models.rtp_parameters.RTCRtpHeaderExtensionParameters(uri, id, encrypted=False)

An RTP header extension negotiated for a sender or a receiver.

See MDN: RTCRtpSender/getParameters.

Parameters:
  • uri (str) – The URI that names the extension.

  • id (int) – The id that marks the extension in RTP packets.

  • encrypted (bool, optional) – Whether the extension is encrypted.

class webrtc.models.rtp_parameters.RTCRtcpParameters(cname=None, reduced_size=None)

The RTCP parameters of a sender or a receiver.

See MDN: RTCRtpSender/getParameters.

Parameters:
  • cname (str, optional) – The canonical name sent in RTCP. It’s None for receivers.

  • reduced_size (bool, optional) – Whether reduced-size RTCP is negotiated.

class webrtc.models.rtp_parameters.RTCRtpCodingParameters(rid=None)

The member of an encoding that identifies it.

See MDN: RTCRtpSender/getParameters.

Parameters:

rid (str, optional) – The RTP stream id of a simulcast layer. It can’t be changed once set.

class webrtc.models.rtp_parameters.RTCRtpEncodingParameters(rid=None, active=True, max_bitrate=None, max_framerate=None, scale_resolution_down_by=None, priority=RTCPriorityType.low, network_priority=RTCPriorityType.low, scalability_mode=None, adaptive_ptime=False, codec=None)

An encoding of a sender. A sender has one per simulcast layer, or a single one.

For audio senders, max_framerate and scale_resolution_down_by are ignored.

See MDN: RTCRtpSender/setParameters.

Parameters:
  • rid (str, optional) – The RTP stream id of a simulcast layer. It can’t be changed once set.

  • active (bool, optional) – Whether the encoding is sent.

  • max_bitrate (int, optional) – The bitrate cap in bits per second.

  • max_framerate (float, optional) – The frame rate cap of video.

  • scale_resolution_down_by (float, optional) – The factor video is scaled down by, at least 1.

  • priority (webrtc.RTCPriorityType, optional) – The relative share of the bitrate the encoding gets. It’s read back as the level closest to what the encoder uses.

  • network_priority (webrtc.RTCPriorityType, optional) – The DSCP marking of its packets.

  • scalability_mode (str, optional) – The SVC mode of video, like 'L1T3'.

  • adaptive_ptime (bool, optional) – Whether audio may use longer packets when bandwidth is low.

  • codec (webrtc.RTCRtpCodec, optional) – The codec to send with. The first negotiated one is used by default.

class webrtc.models.rtp_parameters.RTCRtpParameters(header_extensions, rtcp, codecs)

The parameters a sender and a receiver share.

See MDN: RTCRtpSender/getParameters.

Parameters:
class webrtc.models.rtp_parameters.RTCRtpReceiveParameters(header_extensions, rtcp, codecs)

The parameters a receiver receives with, from webrtc.RTCRtpReceiver.get_parameters().

See MDN: RTCRtpReceiver/getParameters.

Parameters:
class webrtc.models.rtp_parameters.RTCRtpSendParameters(header_extensions, rtcp, codecs, transaction_id, encodings, degradation_preference=None)

The parameters a sender sends with, from webrtc.RTCRtpSender.get_parameters().

Only encodings (all but their rid) and degradation_preference can be changed with webrtc.RTCRtpSender.set_parameters().

See MDN: RTCRtpSender/getParameters.

Parameters:
class webrtc.models.rtp_parameters.RTCRtpHeaderExtensionCapability(uri, direction=RTCRtpTransceiverDirection.sendrecv)

An RTP header extension that can be negotiated.

In webrtc.RTCRtpCapabilities only the URI is meaningful, since the direction is set per transceiver.

See MDN: RTCRtpSender/getCapabilities_static.

Parameters:
class webrtc.models.rtp_parameters.RTCRtpCapabilities(codecs, header_extensions)

The codecs and header extensions a sender or a receiver supports.

See MDN: RTCRtpSender/getCapabilities_static.

Parameters:
class webrtc.models.rtp_parameters.RTCEncodingOptions(key_frame=False)

How webrtc.RTCRtpSender.set_parameters() changes one encoding, from WebRTC Extensions.

Parameters:

key_frame (bool, optional) – Whether the encoding sends a key frame right away.

class webrtc.models.rtp_parameters.RTCSetParameterOptions(encoding_options=<factory>)

The options of webrtc.RTCRtpSender.set_parameters(), from WebRTC Extensions.

Parameters:

encoding_options (list of webrtc.RTCEncodingOptions, optional) – One per encoding, in order, or empty for none.