GstRtp.RTPBaseDepayload

g GObject.InitiallyUnowned GObject.InitiallyUnowned Gst.Object Gst.Object GObject.InitiallyUnowned->Gst.Object GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gst.Element Gst.Element GstRtp.RTPBaseDepayload GstRtp.RTPBaseDepayload Gst.Element->GstRtp.RTPBaseDepayload Gst.Object->Gst.Element

Subclasses:

None

Methods

Inherited:

Gst.Element (82), Gst.Object (27), GObject.Object (37)

Structs:

Gst.ElementClass (10), GObject.ObjectClass (5)

delayed ()

dropped ()

flush (keep_current)

is_aggregate_hdrext_enabled ()

is_source_info_enabled ()

push (out_buf)

push_list (out_list)

set_aggregate_hdrext_enabled (enable)

set_source_info_enabled (enable)

Virtual Methods

Inherited:

Gst.Element (16), Gst.Object (1), GObject.Object (7)

do_handle_event (event)

do_packet_lost (event)

do_process (in_)

do_process_rtp_packet (rtp_buffer)

do_set_caps (caps)

Properties

Inherited:

Gst.Object (2)

Name

Type

Flags

Short Description

auto-header-extension

bool

r/w

Whether RTP header extensions should be automatically enabled, if an implementation is available

extensions

Gst.ValueArray

r

A list of already enabled RTP header extensions

max-reorder

int

r/w

Max seqnum reorder before assuming sender has restarted

source-info

bool

r/w

Add RTP source information as buffer meta

stats

Gst.Structure

r

Various statistics

Signals

Inherited:

Gst.Element (3), Gst.Object (1), GObject.Object (1)

Name

Short Description

add-extension

Add ext as an extension for reading part of an RTP header extension from incoming RTP packets.

clear-extensions

Clear all RTP header extensions used by this depayloader.

request-extension

The returned ext must be configured with the correct ext_id and with the necessary attributes as required by the extension implementation.

Fields

Inherited:

Gst.Element (3), Gst.Object (1), GObject.Object (1)

Name

Type

Access

Description

clock_rate

int

r

need_newsegment

bool

r

parent

Gst.Element

r

segment

Gst.Segment

r

sinkpad

Gst.Pad

r

srcpad

Gst.Pad

r

Class Details

class GstRtp.RTPBaseDepayload(**kwargs)
Bases:

Gst.Element

Abstract:

Yes

Structure:

GstRtp.RTPBaseDepayloadClass

Provides a base class for RTP depayloaders

In order to handle RTP header extensions correctly if the depayloader aggregates multiple RTP packet payloads into one output buffer this class provides the function GstRtp.RTPBaseDepayload.set_aggregate_hdrext_enabled(). If the aggregation is enabled the virtual functions GstRTPBaseDepayload.process or GstRTPBaseDepayload.process_rtp_packet must tell the base class what happens to the current RTP packet. By default the base class assumes that the packet payload is used with the next output buffer.

If the RTP packet will not be used with an output buffer GstRtp.RTPBaseDepayload.dropped() must be called. A typical situation would be if we are waiting for a keyframe.

If the RTP packet will be used but not with the current output buffer but with the next one GstRtp.RTPBaseDepayload.delayed() must be called. This may happen if the current RTP packet signals the start of a new output buffer and the currently processed output buffer will be pushed first. The undelay happens implicitly once the current buffer has been pushed or GstRtp.RTPBaseDepayload.flush() has been called.

If GstRtp.RTPBaseDepayload.flush() is called all RTP packets that have not been dropped since the last output buffer are dropped, e.g. if an output buffer is discarded due to malformed data. This may or may not include the current RTP packet depending on the 2nd parameter keep_current.

Be aware that in case GstRtp.RTPBaseDepayload.push_list() is used each buffer will see the same list of RTP header extensions.

delayed()[source]

Called from GstRTPBaseDepayload.process or GstRTPBaseDepayload.process_rtp_packet when the depayloader needs to keep the current input RTP header for use with the next output buffer.

The delayed buffer will remain until the end of processing the current output buffer and then enqueued for processing with the next output buffer.

A typical use-case is when the depayloader implementation will start a new output buffer for the current input RTP buffer but push the current output buffer first.

Must be called with the stream lock held.

New in version 1.24.

dropped()[source]

Called from GstRTPBaseDepayload.process or GstRTPBaseDepayload.process_rtp_packet if the depayloader does not use the current buffer for the output buffer. This will either drop the delayed buffer or the last buffer from the header extension cache.

A typical use-case is when the depayloader implementation is dropping an input RTP buffer while waiting for the first keyframe.

Must be called with the stream lock held.

New in version 1.24.

flush(keep_current)[source]
Parameters:

keep_current (bool) – if the current RTP buffer shall be kept

If GstRTPBaseDepayload.process or GstRTPBaseDepayload.process_rtp_packet drop an output buffer this function tells the base class to flush header extension cache as well.

This will not drop an input RTP header marked as delayed from GstRtp.RTPBaseDepayload.delayed().

If keep_current is True the current input RTP header will be kept and enqueued after flushing the previous input RTP headers.

A typical use-case for keep_current is when the depayloader implementation invalidates the current output buffer and starts a new one with the current RTP input buffer.

Must be called with the stream lock held.

New in version 1.24.

is_aggregate_hdrext_enabled()[source]
Returns:

True if aggregate-header-extension is enabled.

Return type:

bool

Queries whether header extensions will be aggregated per depayloaded buffers.

New in version 1.24.

is_source_info_enabled()[source]
Returns:

True if source-info is enabled.

Return type:

bool

Queries whether GstRtp.RTPSourceMeta will be added to depayloaded buffers.

New in version 1.16.

push(out_buf)[source]
Parameters:

out_buf (Gst.Buffer) – a Gst.Buffer

Returns:

a Gst.FlowReturn.

Return type:

Gst.FlowReturn

Push out_buf to the peer of self. This function takes ownership of out_buf.

This function will by default apply the last incoming timestamp on the outgoing buffer when it didn’t have a timestamp already.

push_list(out_list)[source]
Parameters:

out_list (Gst.BufferList) – a Gst.BufferList

Returns:

a Gst.FlowReturn.

Return type:

Gst.FlowReturn

Push out_list to the peer of self. This function takes ownership of out_list.

set_aggregate_hdrext_enabled(enable)[source]
Parameters:

enable (bool) – whether to aggregate header extensions per output buffer

Enable or disable aggregating header extensions.

New in version 1.24.

set_source_info_enabled(enable)[source]
Parameters:

enable (bool) – whether to add meta about RTP sources to buffer

Enable or disable adding GstRtp.RTPSourceMeta to depayloaded buffers.

New in version 1.16.

do_handle_event(event) virtual
Parameters:

event (Gst.Event) –

Return type:

bool

custom event handling

do_packet_lost(event) virtual
Parameters:

event (Gst.Event) –

Return type:

bool

signal the depayloader about packet loss

do_process(in_) virtual
Parameters:

in (Gst.Buffer) –

Return type:

Gst.Buffer

process incoming rtp packets. Subclass must implement either this method or process_rtp_packet to process incoming rtp packets. If the child returns a buffer without a valid timestamp, the timestamp of the provided buffer will be applied to the result buffer and the buffer will be pushed. If this function returns None, nothing is pushed.

do_process_rtp_packet(rtp_buffer) virtual
Parameters:

rtp_buffer (GstRtp.RTPBuffer) –

Return type:

Gst.Buffer

Same as the process virtual function, but slightly more efficient, since it is passed the rtp buffer structure that has already been mapped (with Gst.MapFlags.READ) by the base class and thus does not have to be mapped again by the subclass. Can be used by the subclass to process incoming rtp packets. If the subclass returns a buffer without a valid timestamp, the timestamp of the input buffer will be applied to the result buffer and the output buffer will be pushed out. If this function returns None, nothing is pushed out.

New in version 1.6.

do_set_caps(caps) virtual
Parameters:

caps (Gst.Caps) –

Return type:

bool

configure the depayloader

Signal Details

GstRtp.RTPBaseDepayload.signals.add_extension(r_t_p_base_depayload, ext)
Signal Name:

add-extension

Flags:

RUN_LAST, ACTION

Parameters:

Add ext as an extension for reading part of an RTP header extension from incoming RTP packets.

New in version 1.20.

GstRtp.RTPBaseDepayload.signals.clear_extensions(r_t_p_base_depayload)
Signal Name:

clear-extensions

Flags:

RUN_LAST, ACTION

Parameters:

r_t_p_base_depayload (GstRtp.RTPBaseDepayload) – The object which received the signal

Clear all RTP header extensions used by this depayloader.

New in version 1.20.

GstRtp.RTPBaseDepayload.signals.request_extension(r_t_p_base_depayload, ext_id, ext_uri)
Signal Name:

request-extension

Flags:

RUN_LAST

Parameters:
  • r_t_p_base_depayload (GstRtp.RTPBaseDepayload) – The object which received the signal

  • ext_id (int) – the extension id being requested

  • ext_uri (str or None) – the extension URI being requested

Returns:

the GstRtp.RTPHeaderExtension for ext_id, or None

Return type:

GstRtp.RTPHeaderExtension or None

The returned ext must be configured with the correct ext_id and with the necessary attributes as required by the extension implementation.

New in version 1.20.

Property Details

GstRtp.RTPBaseDepayload.props.auto_header_extension
Name:

auto-header-extension

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

If enabled, the depayloader will automatically try to enable all the RTP header extensions provided in the sink caps, saving the application the need to handle these extensions manually using the GstRtp.RTPBaseDepayload ::request-extension: signal.

New in version 1.20.

GstRtp.RTPBaseDepayload.props.extensions
Name:

extensions

Type:

Gst.ValueArray

Default Value:

None

Flags:

READABLE

A list of already enabled RTP header extensions. This may be useful for finding out which extensions are already enabled (with add-extension signal) and picking a non-conflicting ID for a new extension that needs to be added on top of the existing ones.

Note that the value returned by reading this property is not dynamically updated when the set of enabled extensions changes by any of existing action signals. Rather, it represents the current state at the time the property is read.

Dynamic updates of this property can be received by subscribing to its corresponding “notify” signal, i.e. “notify::extensions”.

New in version 1.24.

GstRtp.RTPBaseDepayload.props.max_reorder
Name:

max-reorder

Type:

int

Default Value:

100

Flags:

READABLE, WRITABLE

Max seqnum reorder before the sender is assumed to have restarted.

When max-reorder is set to 0 all reordered/duplicate packets are considered coming from a restarted sender.

New in version 1.18.

GstRtp.RTPBaseDepayload.props.source_info
Name:

source-info

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Add RTP source information found in RTP header as meta to output buffer.

New in version 1.16.

GstRtp.RTPBaseDepayload.props.stats
Name:

stats

Type:

Gst.Structure

Default Value:

None

Flags:

READABLE

Various depayloader statistics retrieved atomically (and are therefore synchroized with each other). This property return a Gst.Structure named application/x-rtp-depayload-stats containing the following fields relating to the last processed buffer and current state of the stream being depayloaded: