# GstRTPBaseAudioPayload

Provides a base class for audio RTP payloaders for frame or sample based audio codecs (constant bitrate)

This class derives from GstRTPBasePayload. It can be used for payloading audio codecs. It will only work with constant bitrate codecs. It supports both frame based and sample based codecs. It takes care of packing up the audio data into RTP packets and filling up the headers accordingly. The payloading is done based on the maximum MTU (mtu) and the maximum time per packet (max-ptime). The general idea is to divide large data buffers into smaller RTP packets. The RTP packet size is the minimum of either the MTU, max-ptime (if set) or available data. The RTP packet size is always larger or equal to min-ptime (if set). If min-ptime is not set, any residual data is sent in a last RTP packet. In the case of frame based codecs, the resulting RTP packets always contain full frames.

## Usage

To use this base class, your child element needs to call either gst_rtp_base_audio_payload_set_frame_based or gst_rtp_base_audio_payload_set_sample_based. This is usually done in the element's `_init()` function. Then, the child element must call either gst_rtp_base_audio_payload_set_frame_options, gst_rtp_base_audio_payload_set_sample_options or gst_rtp_base_audio_payload_set_samplebits_options. Since GstRTPBaseAudioPayload derives from GstRTPBasePayload, the child element must set any variables or call/override any functions required by that base class. The child element does not need to override any other functions specific to GstRTPBaseAudioPayload.

## GstRTPBaseAudioPayload

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstElement
                    ╰──GstRTPBasePayload
                        ╰──GstRTPBaseAudioPayload

### Members

`payload` (GstRTPBasePayload) –
No description available
`priv` (GstRTPBaseAudioPayloadPrivate*) –
No description available
`base_ts` (GstClockTime) –
No description available
`frame_size` (gint) –
No description available
`frame_duration` (gint) –
No description available
`sample_size` (gint) –
No description available

### Class structure

#### GstRTPBaseAudioPayloadClass

Base class for audio RTP payloader.

##### Fields

`parent_class` (GstRTPBasePayloadClass) –

the parent class

### GstRtp.RTPBaseAudioPayloadClass

Base class for audio RTP payloader.

##### Attributes

`parent_class` (GstRtp.RTPBasePayloadClass) –

the parent class

### GstRtp.RTPBaseAudioPayloadClass

Base class for audio RTP payloader.

##### Attributes

`parent_class` (GstRtp.RTPBasePayloadClass) –

the parent class

## GstRtp.RTPBaseAudioPayload

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Element
                    ╰──GstRtp.RTPBasePayload
                        ╰──GstRtp.RTPBaseAudioPayload

### Members

`payload` (GstRtp.RTPBasePayload) –
No description available
`priv` (GstRtp.RTPBaseAudioPayloadPrivate) –
No description available
`base_ts` (Number) –
No description available
`frame_size` (Number) –
No description available
`frame_duration` (Number) –
No description available
`sample_size` (Number) –
No description available

## GstRtp.RTPBaseAudioPayload

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Element
                    ╰──GstRtp.RTPBasePayload
                        ╰──GstRtp.RTPBaseAudioPayload

### Members

`payload` (GstRtp.RTPBasePayload) –
No description available
`priv` (GstRtp.RTPBaseAudioPayloadPrivate) –
No description available
`base_ts` (int) –
No description available
`frame_size` (int) –
No description available
`frame_duration` (int) –
No description available
`sample_size` (int) –
No description available

### Methods

#### gst_rtp_base_audio_payload_flush

    GstFlowReturn
    gst_rtp_base_audio_payload_flush (GstRTPBaseAudioPayload * baseaudiopayload,
                                      guint payload_len,
                                      GstClockTime timestamp)

Create an RTP buffer and store payload_len bytes of the adapter as the payload. Set the timestamp on the new buffer to timestamp before pushing the buffer downstream.

If payload_len is -1, all pending bytes will be flushed. If timestamp is -1, the timestamp will be calculated automatically.

Parameters:

`baseaudiopayload` –

a GstRTPBasePayload

`payload_len` –

length of payload

`timestamp` –

a GstClockTime

Returns –

a GstFlowReturn

#### GstRtp.RTPBaseAudioPayload.prototype.flush

    function GstRtp.RTPBaseAudioPayload.prototype.flush(payload_len: Number, timestamp: Number): {
        // javascript wrapper for 'gst_rtp_base_audio_payload_flush'
    }

Create an RTP buffer and store payload_len bytes of the adapter as the payload. Set the timestamp on the new buffer to timestamp before pushing the buffer downstream.

If payload_len is -1, all pending bytes will be flushed. If timestamp is -1, the timestamp will be calculated automatically.

Parameters:

`baseaudiopayload` ( GstRtp.RTPBaseAudioPayload ) –

a GstRtp.RTPBasePayload

`payload_len` ( Number ) –

length of payload

`timestamp` ( Number ) –

a Number

Returns ( Gst.FlowReturn ) –

a Gst.FlowReturn

#### GstRtp.RTPBaseAudioPayload.flush

    def GstRtp.RTPBaseAudioPayload.flush (self, payload_len, timestamp):
        #python wrapper for 'gst_rtp_base_audio_payload_flush'

Create an RTP buffer and store payload_len bytes of the adapter as the payload. Set the timestamp on the new buffer to timestamp before pushing the buffer downstream.

If payload_len is -1, all pending bytes will be flushed. If timestamp is -1, the timestamp will be calculated automatically.

Parameters:

`baseaudiopayload` ( GstRtp.RTPBaseAudioPayload ) –

a GstRtp.RTPBasePayload

`payload_len` ( int ) –

length of payload

`timestamp` ( int ) –

a int

Returns ( Gst.FlowReturn ) –

a Gst.FlowReturn

#### gst_rtp_base_audio_payload_get_adapter

    GstAdapter *
    gst_rtp_base_audio_payload_get_adapter (GstRTPBaseAudioPayload * rtpbaseaudiopayload)

Gets the internal adapter used by the depayloader.

Parameters:

`rtpbaseaudiopayload` –

a GstRTPBaseAudioPayload

Returns ( [transfer: full] ) –

a GstAdapter.

#### GstRtp.RTPBaseAudioPayload.prototype.get_adapter

    function GstRtp.RTPBaseAudioPayload.prototype.get_adapter(): {
        // javascript wrapper for 'gst_rtp_base_audio_payload_get_adapter'
    }

Gets the internal adapter used by the depayloader.

Parameters:

`rtpbaseaudiopayload` ( GstRtp.RTPBaseAudioPayload ) –

a GstRtp.RTPBaseAudioPayload

Returns ( GstBase.Adapter ) –

a GstBase.Adapter.

#### GstRtp.RTPBaseAudioPayload.get_adapter

    def GstRtp.RTPBaseAudioPayload.get_adapter (self):
        #python wrapper for 'gst_rtp_base_audio_payload_get_adapter'

Gets the internal adapter used by the depayloader.

Parameters:

`rtpbaseaudiopayload` ( GstRtp.RTPBaseAudioPayload ) –

a GstRtp.RTPBaseAudioPayload

Returns ( GstBase.Adapter ) –

a GstBase.Adapter.

#### gst_rtp_base_audio_payload_push

    GstFlowReturn
    gst_rtp_base_audio_payload_push (GstRTPBaseAudioPayload * baseaudiopayload,
                                     const guint8 * data,
                                     guint payload_len,
                                     GstClockTime timestamp)

Create an RTP buffer and store payload_len bytes of data as the payload. Set the timestamp on the new buffer to timestamp before pushing the buffer downstream.

Parameters:

`baseaudiopayload` –

a GstRTPBasePayload

`data` ( [arraylength=payload_len] ) –

data to set as payload

`payload_len` –

length of payload

`timestamp` –

a GstClockTime

Returns –

a GstFlowReturn

#### GstRtp.RTPBaseAudioPayload.prototype.push

    function GstRtp.RTPBaseAudioPayload.prototype.push(data: [ Number ], payload_len: Number, timestamp: Number): {
        // javascript wrapper for 'gst_rtp_base_audio_payload_push'
    }

Create an RTP buffer and store payload_len bytes of data as the payload. Set the timestamp on the new buffer to timestamp before pushing the buffer downstream.

Parameters:

`baseaudiopayload` ( GstRtp.RTPBaseAudioPayload ) –

a GstRtp.RTPBasePayload

`data` ( [ Number ] ) –

data to set as payload

`payload_len` ( Number ) –

length of payload

`timestamp` ( Number ) –

a Number

Returns ( Gst.FlowReturn ) –

a Gst.FlowReturn

#### GstRtp.RTPBaseAudioPayload.push

    def GstRtp.RTPBaseAudioPayload.push (self, data, payload_len, timestamp):
        #python wrapper for 'gst_rtp_base_audio_payload_push'

Create an RTP buffer and store payload_len bytes of data as the payload. Set the timestamp on the new buffer to timestamp before pushing the buffer downstream.

Parameters:

`baseaudiopayload` ( GstRtp.RTPBaseAudioPayload ) –

a GstRtp.RTPBasePayload

`data` ( [ int ] ) –

data to set as payload

`payload_len` ( int ) –

length of payload

`timestamp` ( int ) –

a int

Returns ( Gst.FlowReturn ) –

a Gst.FlowReturn

#### gst_rtp_base_audio_payload_set_frame_based

    gst_rtp_base_audio_payload_set_frame_based (GstRTPBaseAudioPayload * rtpbaseaudiopayload)

Tells GstRTPBaseAudioPayload that the child element is for a frame based audio codec

Parameters:

`rtpbaseaudiopayload` –

a pointer to the element.

#### GstRtp.RTPBaseAudioPayload.prototype.set_frame_based

    function GstRtp.RTPBaseAudioPayload.prototype.set_frame_based(): {
        // javascript wrapper for 'gst_rtp_base_audio_payload_set_frame_based'
    }

Tells GstRtp.RTPBaseAudioPayload that the child element is for a frame based audio codec

Parameters:

`rtpbaseaudiopayload` ( GstRtp.RTPBaseAudioPayload ) –

a pointer to the element.

#### GstRtp.RTPBaseAudioPayload.set_frame_based

    def GstRtp.RTPBaseAudioPayload.set_frame_based (self):
        #python wrapper for 'gst_rtp_base_audio_payload_set_frame_based'

Tells GstRtp.RTPBaseAudioPayload that the child element is for a frame based audio codec

Parameters:

`rtpbaseaudiopayload` ( GstRtp.RTPBaseAudioPayload ) –

a pointer to the element.

#### gst_rtp_base_audio_payload_set_frame_options

    gst_rtp_base_audio_payload_set_frame_options (GstRTPBaseAudioPayload * rtpbaseaudiopayload,
                                                  gint frame_duration,
                                                  gint frame_size)

Sets the options for frame based audio codecs.

Parameters:

`rtpbaseaudiopayload` –

a pointer to the element.

`frame_duration` –

The duraction of an audio frame in milliseconds.

`frame_size` –

The size of an audio frame in bytes.

#### GstRtp.RTPBaseAudioPayload.prototype.set_frame_options

    function GstRtp.RTPBaseAudioPayload.prototype.set_frame_options(frame_duration: Number, frame_size: Number): {
        // javascript wrapper for 'gst_rtp_base_audio_payload_set_frame_options'
    }

Sets the options for frame based audio codecs.

Parameters:

`rtpbaseaudiopayload` ( GstRtp.RTPBaseAudioPayload ) –

a pointer to the element.

`frame_duration` ( Number ) –

The duraction of an audio frame in milliseconds.

`frame_size` ( Number ) –

The size of an audio frame in bytes.

#### GstRtp.RTPBaseAudioPayload.set_frame_options

    def GstRtp.RTPBaseAudioPayload.set_frame_options (self, frame_duration, frame_size):
        #python wrapper for 'gst_rtp_base_audio_payload_set_frame_options'

Sets the options for frame based audio codecs.

Parameters:

`rtpbaseaudiopayload` ( GstRtp.RTPBaseAudioPayload ) –

a pointer to the element.

`frame_duration` ( int ) –

The duraction of an audio frame in milliseconds.

`frame_size` ( int ) –

The size of an audio frame in bytes.

#### gst_rtp_base_audio_payload_set_sample_based

    gst_rtp_base_audio_payload_set_sample_based (GstRTPBaseAudioPayload * rtpbaseaudiopayload)

Tells GstRTPBaseAudioPayload that the child element is for a sample based audio codec

Parameters:

`rtpbaseaudiopayload` –

a pointer to the element.

#### GstRtp.RTPBaseAudioPayload.prototype.set_sample_based

    function GstRtp.RTPBaseAudioPayload.prototype.set_sample_based(): {
        // javascript wrapper for 'gst_rtp_base_audio_payload_set_sample_based'
    }

Tells GstRtp.RTPBaseAudioPayload that the child element is for a sample based audio codec

Parameters:

`rtpbaseaudiopayload` ( GstRtp.RTPBaseAudioPayload ) –

a pointer to the element.

#### GstRtp.RTPBaseAudioPayload.set_sample_based

    def GstRtp.RTPBaseAudioPayload.set_sample_based (self):
        #python wrapper for 'gst_rtp_base_audio_payload_set_sample_based'

Tells GstRtp.RTPBaseAudioPayload that the child element is for a sample based audio codec

Parameters:

`rtpbaseaudiopayload` ( GstRtp.RTPBaseAudioPayload ) –

a pointer to the element.

#### gst_rtp_base_audio_payload_set_sample_options

    gst_rtp_base_audio_payload_set_sample_options (GstRTPBaseAudioPayload * rtpbaseaudiopayload,
                                                   gint sample_size)

Sets the options for sample based audio codecs.

Parameters:

`rtpbaseaudiopayload` –

a pointer to the element.

`sample_size` –

Size per sample in bytes.

#### GstRtp.RTPBaseAudioPayload.prototype.set_sample_options

    function GstRtp.RTPBaseAudioPayload.prototype.set_sample_options(sample_size: Number): {
        // javascript wrapper for 'gst_rtp_base_audio_payload_set_sample_options'
    }

Sets the options for sample based audio codecs.

Parameters:

`rtpbaseaudiopayload` ( GstRtp.RTPBaseAudioPayload ) –

a pointer to the element.

`sample_size` ( Number ) –

Size per sample in bytes.

#### GstRtp.RTPBaseAudioPayload.set_sample_options

    def GstRtp.RTPBaseAudioPayload.set_sample_options (self, sample_size):
        #python wrapper for 'gst_rtp_base_audio_payload_set_sample_options'

Sets the options for sample based audio codecs.

Parameters:

`rtpbaseaudiopayload` ( GstRtp.RTPBaseAudioPayload ) –

a pointer to the element.

`sample_size` ( int ) –

Size per sample in bytes.

#### gst_rtp_base_audio_payload_set_samplebits_options

    gst_rtp_base_audio_payload_set_samplebits_options (GstRTPBaseAudioPayload * rtpbaseaudiopayload,
                                                       gint sample_size)

Sets the options for sample based audio codecs.

Parameters:

`rtpbaseaudiopayload` –

a pointer to the element.

`sample_size` –

Size per sample in bits.

#### GstRtp.RTPBaseAudioPayload.prototype.set_samplebits_options

    function GstRtp.RTPBaseAudioPayload.prototype.set_samplebits_options(sample_size: Number): {
        // javascript wrapper for 'gst_rtp_base_audio_payload_set_samplebits_options'
    }

Sets the options for sample based audio codecs.

Parameters:

`rtpbaseaudiopayload` ( GstRtp.RTPBaseAudioPayload ) –

a pointer to the element.

`sample_size` ( Number ) –

Size per sample in bits.

#### GstRtp.RTPBaseAudioPayload.set_samplebits_options

    def GstRtp.RTPBaseAudioPayload.set_samplebits_options (self, sample_size):
        #python wrapper for 'gst_rtp_base_audio_payload_set_samplebits_options'

Sets the options for sample based audio codecs.

Parameters:

`rtpbaseaudiopayload` ( GstRtp.RTPBaseAudioPayload ) –

a pointer to the element.

`sample_size` ( int ) –

Size per sample in bits.

### Properties

#### buffer-list

    “buffer-list” gboolean

Flags : Read / Write

#### buffer-list

    “buffer-list” Number

Flags : Read / Write

#### buffer_list

    “self.props.buffer_list” bool

Flags : Read / Write

## Function Macros

### GST_RTP_BASE_AUDIO_PAYLOAD_CAST

    #define GST_RTP_BASE_AUDIO_PAYLOAD_CAST(obj) \
      ((GstRTPBaseAudioPayload *) (obj))

## Constants

### GST_TYPE_RTP_BASE_AUDIO_PAYLOAD

    #define GST_TYPE_RTP_BASE_AUDIO_PAYLOAD \
      (gst_rtp_base_audio_payload_get_type())

The results of the search are