multisocketsink

This plugin writes incoming data to a set of sockets. The sockets can be added to multisocketsink by emitting the add signal. For each descriptor added, the client-added signal will be called.

A client can also be added with the add-full signal that allows for more control over what and how much data a client initially receives.

Clients can be removed from multisocketsink by emitting the remove signal. For each descriptor removed, the client-removed signal will be called. The client-removed signal can also be fired when multisocketsink decides that a client is not active anymore or, depending on the value of the recover-policy property, if the client is reading too slowly. In all cases, multisocketsink will never close a socket itself. The user of multisocketsink is responsible for closing all sockets. This can for example be done in response to the client-socket-removed signal. Note that multisocketsink still has a reference to the socket when the client-removed signal is emitted, so that "get-stats" can be performed on the descriptor; it is therefore not safe to close the socket in the client-removed signal handler, and you should use the client-socket-removed signal to safely close the socket.

Multisocketsink internally keeps a queue of the incoming buffers and uses a separate thread to send the buffers to the clients. This ensures that no client write can block the pipeline and that clients can read with different speeds.

When adding a client to multisocketsink, the sync-method property will define which buffer in the queued buffers will be sent first to the client. Clients can be sent the most recent buffer (which might not be decodable by the client if it is not a keyframe), the next keyframe received in multisocketsink (which can take some time depending on the keyframe rate), or the last received keyframe (which will cause a simple burst-on-connect). Multisocketsink will always keep at least one keyframe in its internal buffers when the sync-mode is set to latest-keyframe.

There are additional values for the sync-method property to allow finer control over burst-on-connect behaviour. By selecting the 'burst' method a minimum burst size can be chosen, 'burst-keyframe' additionally requires that the burst begin with a keyframe, and 'burst-with-keyframe' attempts to burst beginning with a keyframe, but will prefer a minimum burst size even if it requires not starting with a keyframe.

Multisocketsink can be instructed to keep at least a minimum amount of data expressed in time or byte units in its internal queues with the time-min and bytes-min properties respectively. These properties are useful if the application adds clients with the add-full signal to make sure that a burst connect can actually be honored.

When streaming data, clients are allowed to read at a different rate than the rate at which multisocketsink receives data. If the client is reading too fast, no data will be send to the client until multisocketsink receives more data. If the client, however, reads too slowly, data for that client will be queued up in multisocketsink. Two properties control the amount of data (buffers) that is queued in multisocketsink: buffers-max and buffers-soft-max. A client that falls behind by buffers-max is removed from multisocketsink forcibly.

A client with a lag of at least buffers-soft-max enters the recovery procedure which is controlled with the recover-policy property. A recover policy of NONE will do nothing, RESYNC_LATEST will send the most recently received buffer as the next buffer for the client, RESYNC_SOFT_LIMIT positions the client to the soft limit in the buffer queue and RESYNC_KEYFRAME positions the client at the most recent keyframe in the buffer queue.

multisocketsink will by default synchronize on the clock before serving the buffers to the clients. This behaviour can be disabled by setting the sync property to FALSE. Multisocketsink will by default not do QoS and will never drop late buffers.

Hierarchy

GObject
    ╰──GInitiallyUnowned
        ╰──GstObject
            ╰──GstElement
                ╰──GstBaseSink
                    ╰──GstMultiHandleSink
                        ╰──GstMultiSocketSink

Factory details

Authors: – Thomas Vander Stichele , Wim Taymans , Sebastian Dröge

Classification:Sink/Network

Rank – none

Plugin – gsttcp

Package – GStreamer Base Plug-ins git

Pad Templates

sink

ANY

Presencealways

Directionsink


Signals

add

add_callback (GstElement * gstmultisocketsink,
              GSocket * socket,
              gpointer udata)
def add_callback (gstmultisocketsink, socket, udata):
    #python callback for the 'add' signal
function add_callback(gstmultisocketsink: GstElement * gstmultisocketsink, socket: GSocket * socket, udata: gpointer udata): {
    // javascript callback for the 'add' signal
}

Hand the given open socket to multisocketsink to write to.

Parameters:

gstmultisocketsink

the multisocketsink element to emit this signal on

socket

the socket to add to multisocketsink

udata
No description available

add-full

add_full_callback (GstElement * gstmultisocketsink,
                   GSocket * socket,
                   GstMultiHandleSinkSyncMethod * sync,
                   GstFormat * format_min,
                   guint64 value_min,
                   GstFormat * format_max,
                   guint64 value_max,
                   gpointer udata)
def add_full_callback (gstmultisocketsink, socket, sync, format_min, value_min, format_max, value_max, udata):
    #python callback for the 'add-full' signal
function add_full_callback(gstmultisocketsink: GstElement * gstmultisocketsink, socket: GSocket * socket, sync: GstMultiHandleSinkSyncMethod * sync, format_min: GstFormat * format_min, value_min: guint64 value_min, format_max: GstFormat * format_max, value_max: guint64 value_max, udata: gpointer udata): {
    // javascript callback for the 'add-full' signal
}

Hand the given open socket to multisocketsink to write to and specify the burst parameters for the new connection.

Parameters:

gstmultisocketsink

the multisocketsink element to emit this signal on

socket

the socket to add to multisocketsink

sync

the sync method to use

format_min

the format of value_min

value_min

the minimum amount of data to burst expressed in format_min units.

format_max

the format of value_max

value_max

the maximum amount of data to burst expressed in format_max units.

udata
No description available

clear

clear_callback (GstElement * param_0,
                gpointer udata)
def clear_callback (param_0, udata):
    #python callback for the 'clear' signal
function clear_callback(param_0: GstElement * param_0, udata: gpointer udata): {
    // javascript callback for the 'clear' signal
}

Parameters:

param_0
No description available
udata
No description available

client-added

client_added_callback (GstElement * gstmultisocketsink,
                       GObject * socket,
                       gpointer udata)
def client_added_callback (gstmultisocketsink, socket, udata):
    #python callback for the 'client-added' signal
function client_added_callback(gstmultisocketsink: GstElement * gstmultisocketsink, socket: GObject * socket, udata: gpointer udata): {
    // javascript callback for the 'client-added' signal
}

The given socket was added to multisocketsink. This signal will be emitted from the streaming thread so application should be prepared for that.

Parameters:

gstmultisocketsink

the multisocketsink element that emitted this signal

socket

the socket that was added to multisocketsink

udata
No description available

client-removed

client_removed_callback (GstElement * gstmultisocketsink,
                         GSocket * socket,
                         GstMultiHandleSinkClientStatus* status,
                         gpointer udata)
def client_removed_callback (gstmultisocketsink, socket, status, udata):
    #python callback for the 'client-removed' signal
function client_removed_callback(gstmultisocketsink: GstElement * gstmultisocketsink, socket: GSocket * socket, status: GstMultiHandleSinkClientStatus* status, udata: gpointer udata): {
    // javascript callback for the 'client-removed' signal
}

The given socket is about to be removed from multisocketsink. This signal will be emitted from the streaming thread so applications should be prepared for that.

gstmultisocketsink still holds a handle to socket so it is possible to call the get-stats signal from this callback. For the same reason it is not safe to close() and reuse socket in this callback.

Parameters:

gstmultisocketsink

the multisocketsink element that emitted this signal

socket

the socket that is to be removed from multisocketsink

status

the reason why the client was removed

udata
No description available

client-socket-removed

client_socket_removed_callback (GstElement * gstmultisocketsink,
                                GSocket * socket,
                                gpointer udata)
def client_socket_removed_callback (gstmultisocketsink, socket, udata):
    #python callback for the 'client-socket-removed' signal
function client_socket_removed_callback(gstmultisocketsink: GstElement * gstmultisocketsink, socket: GSocket * socket, udata: gpointer udata): {
    // javascript callback for the 'client-socket-removed' signal
}

The given socket was removed from multisocketsink. This signal will be emitted from the streaming thread so applications should be prepared for that.

In this callback, gstmultisocketsink has removed all the information associated with socket and it is therefore not possible to call get-stats with socket. It is however safe to close() and reuse fd in the callback.

Parameters:

gstmultisocketsink

the multisocketsink element that emitted this signal

socket

the socket that was removed from multisocketsink

udata
No description available

get-stats

GstStructure *
get_stats_callback (GstElement * gstmultisocketsink,
                    GSocket * socket,
                    gpointer udata)
def get_stats_callback (gstmultisocketsink, socket, udata):
    #python callback for the 'get-stats' signal
function get_stats_callback(gstmultisocketsink: GstElement * gstmultisocketsink, socket: GSocket * socket, udata: gpointer udata): {
    // javascript callback for the 'get-stats' signal
}

Get statistics about socket. This function returns a GstStructure.

Parameters:

gstmultisocketsink

the multisocketsink element to emit this signal on

socket

the socket to get stats of from multisocketsink

udata
No description available
Returns ( GstStructure * ) –

a GstStructure with the statistics. The structure contains values that represent: total number of bytes sent, time when the client was added, time when the client was disconnected/removed, time the client is/was active, last activity time (in epoch seconds), number of buffers dropped. All times are expressed in nanoseconds (GstClockTime).


remove

remove_callback (GstElement * gstmultisocketsink,
                 GSocket * socket,
                 gpointer udata)
def remove_callback (gstmultisocketsink, socket, udata):
    #python callback for the 'remove' signal
function remove_callback(gstmultisocketsink: GstElement * gstmultisocketsink, socket: GSocket * socket, udata: gpointer udata): {
    // javascript callback for the 'remove' signal
}

Remove the given open socket from multisocketsink.

Parameters:

gstmultisocketsink

the multisocketsink element to emit this signal on

socket

the socket to remove from multisocketsink

udata
No description available

remove-flush

remove_flush_callback (GstElement * gstmultisocketsink,
                       GSocket * socket,
                       gpointer udata)
def remove_flush_callback (gstmultisocketsink, socket, udata):
    #python callback for the 'remove-flush' signal
function remove_flush_callback(gstmultisocketsink: GstElement * gstmultisocketsink, socket: GSocket * socket, udata: gpointer udata): {
    // javascript callback for the 'remove-flush' signal
}

Remove the given open socket from multisocketsink after flushing all the pending data to the socket.

Parameters:

gstmultisocketsink

the multisocketsink element to emit this signal on

socket

the socket to remove from multisocketsink

udata
No description available

Properties

async

“async” gboolean

Go asynchronously to PAUSED

Flags : Read / Write

Default value : true


blocksize

“blocksize” guint

Size in bytes to pull per buffer (0 = default)

Flags : Read / Write

Default value : 4096


buffers-max

“buffers-max” gint

max number of buffers to queue for a client (-1 = no limit)

Flags : Read / Write

Default value : -1


buffers-min

“buffers-min” gint

min number of buffers to queue (-1 = as few as possible)

Flags : Read / Write

Default value : -1


buffers-queued

“buffers-queued” guint

Number of buffers currently queued

Flags : Read

Default value : 0


buffers-soft-max

“buffers-soft-max” gint

Recover client when going over this limit (-1 = no limit)

Flags : Read / Write

Default value : -1


burst-format

“burst-format” Format

The format of the burst units (when sync-method is burst[[-with]-keyframe])

Flags : Read / Write

Default value : undefined (0)


burst-value

“burst-value” guint64

The amount of burst expressed in burst-format

Flags : Read / Write

Default value : 0


bytes-min

“bytes-min” gint

min number of bytes to queue (-1 = as little as possible)

Flags : Read / Write

Default value : -1


bytes-served

“bytes-served” guint64

Total number of bytes send to all clients

Flags : Read

Default value : 0


bytes-to-serve

“bytes-to-serve” guint64

Number of bytes received to serve to clients

Flags : Read

Default value : 0


enable-last-sample

“enable-last-sample” gboolean

Enable the last-sample property

Flags : Read / Write

Default value : true


last-sample

“last-sample” GstSample *

The last sample received in the sink

Flags : Read


max-bitrate

“max-bitrate” guint64

The maximum bits per second to render (0 = disabled)

Flags : Read / Write

Default value : 0


max-lateness

“max-lateness” gint64

Maximum number of nanoseconds that a buffer can be late before it is dropped (-1 unlimited)

Flags : Read / Write

Default value : 18446744073709551615


name

“name” gchararray

The name of the object

Flags : Read / Write / Construct

Default value : NULL


num-handles

“num-handles” guint

The current number of client handles

Flags : Read

Default value : 0


parent

“parent” GstObject *

The parent of the object

Flags : Read / Write


processing-deadline

“processing-deadline” guint64

Maximum processing deadline in nanoseconds

Flags : Read / Write

Default value : 20000000


qos

“qos” gboolean

Generate Quality-of-Service events upstream

Flags : Read / Write

Default value : false


qos-dscp

“qos-dscp” gint

Quality of Service, differentiated services code point (-1 default)

Flags : Read / Write

Default value : -1


recover-policy

“recover-policy” Multi-handle-sink-recover-policy

How to recover when client reaches the soft max

Flags : Read / Write

Default value : none (0)


render-delay

“render-delay” guint64

Additional render delay of the sink in nanoseconds

Flags : Read / Write

Default value : 0


resend-streamheader

“resend-streamheader” gboolean

Resend the streamheader if it changes in the caps

Flags : Read / Write

Default value : true


send-dispatched

“send-dispatched” gboolean

Sends a GstNetworkMessageDispatched event upstream whenever a buffer is sent to a client. The event is a CUSTOM event name GstNetworkMessageDispatched and contains:

"object" G_TYPE_OBJECT : the object identifying the client "buffer" GST_TYPE_BUFFER : the buffer sent to the client

Flags : Read / Write

Default value : false


send-messages

“send-messages” gboolean

Sends a GstNetworkMessage event upstream whenever a buffer is received from a client. The event is a CUSTOM event name GstNetworkMessage and contains:

"object" G_TYPE_OBJECT : the object identifying the client "buffer" GST_TYPE_BUFFER : the buffer with data received from the client

Flags : Read / Write

Default value : false


stats

“stats” GstStructure *

Sink Statistics

Flags : Read

Default value :

application/x-gst-base-sink-stats, average-rate=(double)0, dropped=(guint64)0, rendered=(guint64)0;

sync

“sync” gboolean

Sync on the clock

Flags : Read / Write

Default value : true


sync-method

“sync-method” Multi-handle-sink-sync-method

How to sync new clients to the stream

Flags : Read / Write

Default value : latest (0)


throttle-time

“throttle-time” guint64

The time to keep between rendered buffers (0 = disabled)

Flags : Read / Write

Default value : 0


time-min

“time-min” gint64

min amount of time to queue (in nanoseconds) (-1 = as little as possible)

Flags : Read / Write

Default value : 18446744073709551615


timeout

“timeout” guint64

Maximum inactivity timeout in nanoseconds for a client (0 = no limit)

Flags : Read / Write

Default value : 0


ts-offset

“ts-offset” gint64

Timestamp offset in nanoseconds

Flags : Read / Write

Default value : 0


unit-format

“unit-format” Format

The unit to measure the max/soft-max/queued properties

Flags : Read / Write

Default value : buffers (4)


units-max

“units-max” gint64

max number of units to queue (-1 = no limit)

Flags : Read / Write

Default value : 18446744073709551615


units-soft-max

“units-soft-max” gint64

Recover client when going over this limit (-1 = no limit)

Flags : Read / Write

Default value : 18446744073709551615


Named constants

Format

Members

undefined (0) – GST_FORMAT_UNDEFINED
default (1) – GST_FORMAT_DEFAULT
bytes (2) – GST_FORMAT_BYTES
time (3) – GST_FORMAT_TIME
buffers (4) – GST_FORMAT_BUFFERS
percent (5) – GST_FORMAT_PERCENT

Multi-handle-sink-recover-policy

Members

none (0) – Do not try to recover
latest (1) – Resync client to latest buffer
soft-limit (2) – Resync client to soft limit
keyframe (3) – Resync client to most recent keyframe

Multi-handle-sink-sync-method

Members

latest (0) – Serve starting from the latest buffer
next-keyframe (1) – Serve starting from the next keyframe
latest-keyframe (2) – Serve everything since the latest keyframe (burst)
burst (3) – Serve burst-value data to client
burst-keyframe (4) – Serve burst-value data starting on a keyframe
burst-with-keyframe (5) – Serve burst-value data preferably starting on a keyframe

The results of the search are