multiudpsink2

multiudpsink2 is a network sink that sends UDP packets to multiple clients. It can be combined with RTP payloaders to implement RTP streaming.

The clients property is a comma-separated list of host:port pairs with the destinations. Every packet is sent to each of the listed destinations. Hostnames are resolved when a destination is added, and IPv6 addresses must be enclosed in brackets, for example [::1]:5000.

When a destination/port pair is listed multiple times, the packet is sent multiple times as well. This behaviour can be disabled with the send-duplicates property.

The list of destinations can be managed at runtime with the add, remove, clear and get-stats action signals. add and remove take a host and a port and add or remove a destination, while clear removes all destinations. The get-stats signal takes a host and a port and returns a structure with the per-destination statistics:

  • guint64 bytes-sent: the total number of bytes sent to the destination
  • guint64 packets-sent: the total number of packets sent to the destination
  • guint64 connect-time: the time in nanoseconds when the destination was added
  • guint64 disconnect-time: the time in nanoseconds when the destination was removed

The client-added and client-removed signals are emitted whenever a destination is added or removed and contain the host and port of the affected destination.

multiudpsink2 can send to multicast groups by adding a multicast address with the clients property. It automatically joins and leaves the multicast groups as destinations are added and removed, unless disabled with the auto-multicast property. The interface used to join the group can be set with the multicast-iface property. The multicast TTL and loopback behaviour are controlled with the ttl-mc and loop properties, and the unicast TTL with the ttl property.

Alternatively one can provide a custom socket to multiudpsink2 with the socket property. In that case multiudpsink2 will not allocate a socket itself but use the provided one. A second socket for IPv6 can be provided with the socket-v6 property. The sockets currently in use can be read back with the read-only used-socket and used-socket-v6 properties. A provided socket is closed when setting the element to READY by default. This behaviour can be overridden with the close-socket property, in which case the application is responsible for closing the socket.

The buffer-size property is used to change the default kernel send buffer size used for sending packets. The buffer size may be increased for high-volume connections, or may be decreased to limit the possible backlog of outgoing data. The system places an absolute limit on these values, on Linux, for example, the default buffer size is typically 50K and can be increased to maximally 100K.

The socket can be bound to a specific address and port with the bind-address and bind-port properties. The Quality of Service differentiated services code point can be set with the qos-dscp property.

The bytes-served and bytes-to-serve properties report the total number of bytes sent to all clients and the number of bytes received to serve to clients.

Examples

 gst-launch-1.0 -v audiotestsrc ! multiudpsink2 clients=127.0.0.1:5000,127.0.0.1:5001

Send audio to two UDP destinations.

 gst-launch-1.0 -v audiotestsrc ! multiudpsink2 clients=239.255.0.1:5000

Send audio to a multicast group.

To actually receive the packets sent by the above pipeline one can use the udpsrc2 element. When running the following pipeline in another terminal, the above mentioned pipeline should send packets to it.

 gst-launch-1.0 -v udpsrc2 port=5000 ! fakesink dump=1

Hierarchy

GObject
    ╰──GInitiallyUnowned
        ╰──GstObject
            ╰──GstElement
                ╰──GstBaseSink
                    ╰──GstBaseUdpSink2
                        ╰──multiudpsink2

Factory details

Authors: – Sebastian Dröge

Classification:Sink/Network

Rank – none

Plugin – rsudp

Package – gst-plugin-udp

Pad Templates

sink

ANY

Presencealways

Directionsink

Object typeGstPad


Signals

client-added

client_added_callback (GstElement * param_0,
                       gchararray arg0,
                       gint arg1,
                       gpointer udata)
def client_added_callback (param_0, arg0, arg1, udata):
    #python callback for the 'client-added' signal
function client_added_callback(param_0: GstElement * param_0, arg0: gchararray arg0, arg1: gint arg1, udata: gpointer udata): {
    // javascript callback for the 'client-added' signal
}

Parameters:

param_0
No description available
arg0
No description available
arg1
No description available
udata
No description available

Flags: Run Last


client-removed

client_removed_callback (GstElement * param_0,
                         gchararray arg0,
                         gint arg1,
                         gpointer udata)
def client_removed_callback (param_0, arg0, arg1, udata):
    #python callback for the 'client-removed' signal
function client_removed_callback(param_0: GstElement * param_0, arg0: gchararray arg0, arg1: gint arg1, udata: gpointer udata): {
    // javascript callback for the 'client-removed' signal
}

Parameters:

param_0
No description available
arg0
No description available
arg1
No description available
udata
No description available

Flags: Run Last


Action Signals

add

g_signal_emit_by_name (param_0, "add", arg0, arg1);
ret = param_0.emit ("add", arg0, arg1)
let ret = param_0.emit ("add", arg0, arg1);

Parameters:

param_0 (GstElement *)
No description available
arg0 (gchararray)
No description available
arg1 (gint)
No description available

Flags: Run Last / Action


clear

g_signal_emit_by_name (param_0, "clear");
ret = param_0.emit ("clear")
let ret = param_0.emit ("clear");

Parameters:

param_0 (GstElement *)
No description available

Flags: Run Last / Action


get-stats

g_signal_emit_by_name (param_0, "get-stats", arg0, arg1, &ret);
ret = param_0.emit ("get-stats", arg0, arg1)
let ret = param_0.emit ("get-stats", arg0, arg1);

Parameters:

param_0 (GstElement *)
No description available
arg0 (gchararray)
No description available
arg1 (gint)
No description available
Returns (GstStructure *)
No description available

Flags: Run Last / Action


remove

g_signal_emit_by_name (param_0, "remove", arg0, arg1);
ret = param_0.emit ("remove", arg0, arg1)
let ret = param_0.emit ("remove", arg0, arg1);

Parameters:

param_0 (GstElement *)
No description available
arg0 (gchararray)
No description available
arg1 (gint)
No description available

Flags: Run Last / Action


Properties

clients

“clients” gchararray

A comma-separated list of host:port pairs with destinations

Flags : Read / Write

Default value : NULL


send-duplicates

“send-duplicates” gboolean

When a destination/port pair is added multiple times, send packets multiple times as well

Flags : Read / Write

Default value : true


The results of the search are