udpsink2

udpsink2 is a network sink that sends UDP packets to a single client. It can be combined with RTP payloaders to implement RTP streaming.

The destination is configured with the host and port properties, which default to 127.0.0.1 and 5004. Hostnames are resolved when the destination is set, and IP addresses can be given directly, including IPv6 literals such as ::1.

The destination can also be set with the uri property. udpsink2 implements a GstURIHandler interface that handles udp://host:port type URIs. IPv6 addresses must be enclosed in brackets within the URI, for example udp://[::1]:5004.

udpsink2 can send to multicast groups by setting the host property to a multicast address. It automatically joins and leaves the multicast group as the destination is changed, 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 udpsink2 with the socket property. In that case udpsink2 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 the client and the number of bytes received to serve to the client.

Examples

 gst-launch-1.0 -v audiotestsrc ! udpsink2 host=127.0.0.1 port=5000

Send audio to a UDP destination.

 gst-launch-1.0 -v audiotestsrc ! udpsink2 uri=udp://239.255.0.1:5000

Send audio to a multicast group using a URI.

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
                        ╰──udpsink2

Implemented interfaces

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


Properties

host

“host” gchararray

Host to send packets to

Flags : Read / Write

Default value : 127.0.0.1


port

“port” guint

Port to send packets to

Flags : Read / Write

Default value : 5004


uri

“uri” gchararray

URI in the form of udp://host:port

Flags : Read / Write

Default value : udp://127.0.0.1:5004


The results of the search are