sapsink

sapsink is a network sink that sends RTP streams and announces them as a session with the Session Announcement Protocol (SAP). It can be combined with RTP payloaders to send multicast RTP sessions.

sapsink is a bin with request sink pads named sink_%u, one per RTP stream. The destination of a stream is configured with the dest-ip and dest-port pad properties. dest-port is required. If dest-ip is unset, the stream is sent to the default multicast group 239.1.2.1. The first caps on a pad define the media line of the session. The session is announced once all pads have caps.

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

The session description is built from the session-name, session-description, session-id and session-version properties. The source-address property is used as the SDP origin address and the SAP originating source. If unset it is derived automatically: an address of one of the multicast-iface interfaces, or the source address the routing gives for the stream destinations.

Announcements are sent every few minutes, with the first one as soon as all pads have caps after the element reaches PAUSED, to the SAP groups selected by sap-addresses. If unset, the SAP multicast group matching the scope of the stream destination addresses is used (RFC 2365 for IPv4, RFC 3513 for IPv6). Announcements are sent on the multicast interfaces or the interface owning the source address, not once per interface. On shutdown the session is deleted with a few SAP deletion announcements.

All streams of a session have to use the same address family, as the session has a single origin address.

By default RTCP is not used. With rtcp-mode set to sendonly or sendrecv, RTCP is sent to the RTP destination port + 1, or to the same port if rtcp-mux is set. The rtp-profile property selects RTP/AVP or RTP/AVPF.

By default multicast loopback is disabled, so local receivers on the same host do not receive the streams and the sender does not receive its own RTCP. 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 audiotestsrc is-live=true ! opusenc ! rtpopuspay2 pt=96 ! sapsink multicast-loopback=true sink_0::dest-port=5004

A pipeline to send an Opus stream to the default multicast group and announce it.

Hierarchy

GObject
    ╰──GInitiallyUnowned
        ╰──GstObject
            ╰──GstElement
                ╰──GstBin
                    ╰──sapsink

Implemented interfaces

Factory details

Authors: – Sebastian Dröge

Classification: – Sink/Network

Rank – none

Plugin – sdp

Package – gst-plugin-sdp

Pad Templates

sink_%u

application/x-rtp:

Presence – request

Direction – sink

Object type – GstSapSinkPad


Properties

compress

“compress” gboolean

Whether to compress the SAP announcements with zlib

Flags : Read / Write

Default value : false


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 receivers on the same host receive the streams; needed for local testing

Flags : Read / Write

Default value : false


rtcp-mode

“rtcp-mode” GstSapRtcpMode *

Whether to send and/or receive RTCP

Flags : Read / Write

Default value : inactive (0)


rtcp-mux

“rtcp-mux” gboolean

Send and receive RTCP on the same port as RTP (a=rtcp-mux)

Flags : Read / Write

Default value : false


rtp-profile

“rtp-profile” Sap-sink-rtp-profile *

Profile of the announced RTP session

Flags : Read / Write

Default value : avp (0)


sap-addresses

“sap-addresses” gchararray

Comma-separated list of multicast group addresses to announce the session on. If unset, the SAP multicast group matching the scope of the stream destination addresses is used

Flags : Read / Write

Default value : NULL


session-description

“session-description” gchararray

Description of the announced session

Flags : Read / Write

Default value : NULL


session-id

“session-id” guint64

Session ID of the announced session, i.e. the session ID of the SDP o= line. 0 generates a random one

Flags : Read / Write

Default value : 0


session-name

“session-name” gchararray

Name of the announced session

Flags : Read / Write

Default value : GStreamer SAP session


session-version

“session-version” guint64

Session version of the announced session, i.e. the session version of the SDP o= line

Flags : Read / Write

Default value : 0


source-address

“source-address” gchararray

Source address of the session, used as the SDP origin address and the SAP originating source. If unset, it is derived from the multicast interfaces or the routing to the stream destinations

Flags : Read / Write

Default value : NULL


Named constants

Sap-sink-rtp-profile

Members

avp (0) – RTP/AVP
avpf (1) – RTP/AVPF

The results of the search are