# 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](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/getCapabilities_static).

* **Parameters:**
  * **mime_type** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – The type and subtype of the codec, like `'audio/opus'`.
  * **clock_rate** ([`int`](https://docs.python.org/3/builtins/functions.html#int)) – The RTP clock rate in Hz.
  * **channels** ([`int`](https://docs.python.org/3/builtins/functions.html#int), optional) – The number of audio channels. It’s [`None`](https://docs.python.org/3/builtins/constants.html#None) for video.
  * **sdp_fmtp_line** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#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](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/getParameters).

* **Parameters:**
  * **payload_type** ([`int`](https://docs.python.org/3/builtins/functions.html#int)) – The RTP payload type the codec is negotiated with.
  * **mime_type** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – The type and subtype of the codec, like `'audio/opus'`.
  * **clock_rate** ([`int`](https://docs.python.org/3/builtins/functions.html#int)) – The RTP clock rate in Hz.
  * **channels** ([`int`](https://docs.python.org/3/builtins/functions.html#int), optional) – The number of audio channels. It’s [`None`](https://docs.python.org/3/builtins/constants.html#None) for video.
  * **sdp_fmtp_line** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#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](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/getParameters).

* **Parameters:**
  * **uri** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – The URI that names the extension.
  * **id** ([`int`](https://docs.python.org/3/builtins/functions.html#int)) – The id that marks the extension in RTP packets.
  * **encrypted** ([`bool`](https://docs.python.org/3/builtins/functions.html#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](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/getParameters).

* **Parameters:**
  * **cname** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str), optional) – The canonical name sent in RTCP. It’s [`None`](https://docs.python.org/3/builtins/constants.html#None) for receivers.
  * **reduced_size** ([`bool`](https://docs.python.org/3/builtins/functions.html#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](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/getParameters).

* **Parameters:**
  **rid** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#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](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/setParameters).

* **Parameters:**
  * **rid** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str), optional) – The RTP stream id of a simulcast layer. It can’t be changed once set.
  * **active** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), optional) – Whether the encoding is sent.
  * **max_bitrate** ([`int`](https://docs.python.org/3/builtins/functions.html#int), optional) – The bitrate cap in bits per second.
  * **max_framerate** ([`float`](https://docs.python.org/3/builtins/functions.html#float), optional) – The frame rate cap of video.
  * **scale_resolution_down_by** ([`float`](https://docs.python.org/3/builtins/functions.html#float), optional) – The factor video is scaled down by, at least 1.
  * **priority** ([`webrtc.RTCPriorityType`](../enums.md#webrtc.enums.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`](../enums.md#webrtc.enums.RTCPriorityType), optional) – The DSCP marking of its packets.
  * **scalability_mode** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str), optional) – The SVC mode of video, like `'L1T3'`.
  * **adaptive_ptime** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), optional) – Whether audio may use longer packets when bandwidth is low.
  * **codec** ([`webrtc.RTCRtpCodec`](#webrtc.models.rtp_parameters.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](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/getParameters).

* **Parameters:**
  * **header_extensions** ([`list`](https://docs.python.org/3/builtins/stdtypes.html#list) of [`webrtc.RTCRtpHeaderExtensionParameters`](#webrtc.models.rtp_parameters.RTCRtpHeaderExtensionParameters)) – The header extensions.
  * **rtcp** ([`webrtc.RTCRtcpParameters`](#webrtc.models.rtp_parameters.RTCRtcpParameters)) – The RTCP parameters.
  * **codecs** ([`list`](https://docs.python.org/3/builtins/stdtypes.html#list) of [`webrtc.RTCRtpCodecParameters`](#webrtc.models.rtp_parameters.RTCRtpCodecParameters)) – The negotiated codecs.

### *class* webrtc.models.rtp_parameters.RTCRtpReceiveParameters(header_extensions, rtcp, codecs)

The parameters a receiver receives with, from [`webrtc.RTCRtpReceiver.get_parameters()`](../interfaces/rtc_rtp_receiver.md#webrtc.interfaces.rtc_rtp_receiver.RTCRtpReceiver.get_parameters).

See [MDN: RTCRtpReceiver/getParameters](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpReceiver/getParameters).

* **Parameters:**
  * **header_extensions** ([`list`](https://docs.python.org/3/builtins/stdtypes.html#list) of [`webrtc.RTCRtpHeaderExtensionParameters`](#webrtc.models.rtp_parameters.RTCRtpHeaderExtensionParameters)) – The header extensions.
  * **rtcp** ([`webrtc.RTCRtcpParameters`](#webrtc.models.rtp_parameters.RTCRtcpParameters)) – The RTCP parameters.
  * **codecs** ([`list`](https://docs.python.org/3/builtins/stdtypes.html#list) of [`webrtc.RTCRtpCodecParameters`](#webrtc.models.rtp_parameters.RTCRtpCodecParameters)) – The codecs it can receive.

### *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()`](../interfaces/rtc_rtp_sender.md#webrtc.interfaces.rtc_rtp_sender.RTCRtpSender.get_parameters).

Only `encodings` (all but their `rid`) and `degradation_preference` can be changed with
[`webrtc.RTCRtpSender.set_parameters()`](../interfaces/rtc_rtp_sender.md#webrtc.interfaces.rtc_rtp_sender.RTCRtpSender.set_parameters).

See [MDN: RTCRtpSender/getParameters](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/getParameters).

* **Parameters:**
  * **header_extensions** ([`list`](https://docs.python.org/3/builtins/stdtypes.html#list) of [`webrtc.RTCRtpHeaderExtensionParameters`](#webrtc.models.rtp_parameters.RTCRtpHeaderExtensionParameters)) – The header extensions.
  * **rtcp** ([`webrtc.RTCRtcpParameters`](#webrtc.models.rtp_parameters.RTCRtcpParameters)) – The RTCP parameters.
  * **codecs** ([`list`](https://docs.python.org/3/builtins/stdtypes.html#list) of [`webrtc.RTCRtpCodecParameters`](#webrtc.models.rtp_parameters.RTCRtpCodecParameters)) – The negotiated codecs.
  * **transaction_id** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Identifies the `get_parameters` call the parameters come from.
  * **encodings** ([`list`](https://docs.python.org/3/builtins/stdtypes.html#list) of [`webrtc.RTCRtpEncodingParameters`](#webrtc.models.rtp_parameters.RTCRtpEncodingParameters)) – The encodings.
  * **degradation_preference** ([`webrtc.RTCDegradationPreference`](../enums.md#webrtc.enums.RTCDegradationPreference), optional) – Whether video drops frame
    rate or resolution first when bandwidth or CPU is short.

### *class* webrtc.models.rtp_parameters.RTCRtpHeaderExtensionCapability(uri, direction=RTCRtpTransceiverDirection.sendrecv)

An RTP header extension that can be negotiated.

In [`webrtc.RTCRtpCapabilities`](#webrtc.models.rtp_parameters.RTCRtpCapabilities) only the URI is meaningful, since the direction is set per transceiver.

See [MDN: RTCRtpSender/getCapabilities_static](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/getCapabilities_static).

* **Parameters:**
  * **uri** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – The URI that names the extension.
  * **direction** ([`webrtc.RTCRtpTransceiverDirection`](../enums.md#webrtc.enums.RTCRtpTransceiverDirection), optional) – The directions it’s negotiated in.
    It’s [`webrtc.RTCRtpTransceiverDirection.stopped`](../enums.md#webrtc.enums.RTCRtpTransceiverDirection.stopped) for none.

### *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](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/getCapabilities_static).

* **Parameters:**
  * **codecs** ([`list`](https://docs.python.org/3/builtins/stdtypes.html#list) of [`webrtc.RTCRtpCodec`](#webrtc.models.rtp_parameters.RTCRtpCodec)) – The codecs.
  * **header_extensions** ([`list`](https://docs.python.org/3/builtins/stdtypes.html#list) of [`webrtc.RTCRtpHeaderExtensionCapability`](#webrtc.models.rtp_parameters.RTCRtpHeaderExtensionCapability)) – The header extensions.

### *class* webrtc.models.rtp_parameters.RTCEncodingOptions(key_frame=False)

How [`webrtc.RTCRtpSender.set_parameters()`](../interfaces/rtc_rtp_sender.md#webrtc.interfaces.rtc_rtp_sender.RTCRtpSender.set_parameters) changes one encoding, from WebRTC Extensions.

* **Parameters:**
  **key_frame** ([`bool`](https://docs.python.org/3/builtins/functions.html#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()`](../interfaces/rtc_rtp_sender.md#webrtc.interfaces.rtc_rtp_sender.RTCRtpSender.set_parameters), from WebRTC Extensions.

* **Parameters:**
  **encoding_options** ([`list`](https://docs.python.org/3/builtins/stdtypes.html#list) of [`webrtc.RTCEncodingOptions`](#webrtc.models.rtp_parameters.RTCEncodingOptions), optional) – One per encoding, in order,
  or empty for none.
