sapsrc

sapsrc is a network source that receives RTP sessions announced with the Session Announcement Protocol (SAP). It can be combined with RTP depayloaders to receive multicast RTP sessions without any out-of-band configuration.

SAP announcers periodically multicast an SDP session description to port 9875 of the SAP multicast groups. sapsrc listens on the global and administratively scoped SAP groups, and on the groups listed in the comma-separated GST_SAP_ADDRESSES environment variable. For the first matching session it sets up an RTP receiver for every receivable media line and exposes them as dynamic source pads.

Sessions are selected with the session-id and originating-source properties, at least one of which has to be set. originating-source matches the originating source field of the SAP packet: for a session announced by sapsink that is its source-address or the address derived from it, so usually the LAN address of the sender and not 127.0.0.1. The sapdeviceprovider device provider can be used to discover all announced sessions and to create a sapsrc for a selected one.

The source pads are named src_%u, where %u is the index of the media line in the SDP, and have application/x-rtp caps. They are sometimes pads, so applications have to connect to the pad-added signal. The stream ID of each pad is derived from the SDP origin and the media line.

The internal rtprecv and rtpsend elements and the per-stream UDP elements (udpsrc2-rtp-<id>, udpsrc2-rtcp-<id>, udpsink2-rtcp-<id>) are added to the bin with stable names, depending on the RTCP mode, and can be retrieved with gst_bin_get_by_name or the GstChildProxy interface.

By default RTCP is not received. With rtcp-mode set to recvonly or sendrecv, RTCP is received on the port from the SDP, or on RTP port + 1 if the SDP has no a=rtcp attribute. An RTCP BYE or a source timeout sends EOS on the corresponding pad, but the pad is kept and re-targeted if the stream restarts with a new source. If the announced session is deleted or expires, EOS is sent on all pads, but they are kept until the element is stopped or a session is announced, which then removes them. If the announced session changes incompatibly, EOS is sent on all pads and then all pads are removed and rebuilt.

The latency property sets the jitter buffer latency, and timeout makes the element post a warning if no data is received for the given time. Multicast reception can be restricted to specific interfaces with multicast-iface.

By default multicast loopback is disabled, so local senders on the same host do not receive the RTCP sent by this element. Set multicast-loopback to true for local testing. SAP announcements are always looped back locally so that multiple SAP listeners on the same host can see each other.

Examples

 gst-launch-1.0 -v sapsrc multicast-loopback=true session-id=1234 ! rtpopusdepay2 ! opusdec ! autoaudiosink

A pipeline to receive an Opus session announced with sapsink session-id=1234, e.g. by the sap-send example.

Hierarchy

GObject
    ╰──GInitiallyUnowned
        ╰──GstObject
            ╰──GstElement
                ╰──GstBin
                    ╰──sapsrc

Implemented interfaces

Factory details

Authors: – Sebastian Dröge

Classification: – Source/Network

Rank – none

Plugin – sdp

Package – gst-plugin-sdp

Pad Templates

src_%u

application/x-rtp:

Presence – sometimes

Direction – src

Object type – GstPad


Properties

latency

“latency” guint

RTP jitterbuffer latency in ms

Flags : Read / Write

Default value : 200


multicast-iface

“multicast-iface” gchararray

Comma-separated list of network interfaces to use for multicast

Flags : Read / Write

Default value : NULL


multicast-loopback

“multicast-loopback” gboolean

Enable multicast loopback so that local senders on the same host receive RTCP; needed for local testing

Flags : Read / Write

Default value : false


originating-source

“originating-source” gchararray

Originating source address to filter for, i.e. the IP address of the SAP announcer

Flags : Read / Write

Default value : NULL


rtcp-mode

“rtcp-mode” GstSapRtcpMode *

Whether to send and/or receive RTCP

Flags : Read / Write

Default value : inactive (0)


session-id

“session-id” gchararray

Session ID to filter for, i.e. the session ID of the SDP o= line

Flags : Read / Write

Default value : NULL


timeout

“timeout” guint64

Post a warning after this many nanoseconds without receiving data (0 = disabled)

Flags : Read / Write

Default value : 0


Named constants

GstSapRtcpMode

Members

inactive (0) – Inactive
recvonly (1) – Only receive RTCP
sendonly (2) – Only send RTCP
sendrecv (3) – Send and receive RTCP

The results of the search are