webrtcsink
webrtcsink
is an element that can be used to serve media streams
to multiple consumers through WebRTC.
It uses a signaller that implements the protocol supported by the default signalling server we additionally provide, take a look at the subclasses of GstBaseWebRTCSink for other supported protocols, or implement your own.
See the documentation of the plugin for more information on features and usage.
Hierarchy
GObject ╰──GInitiallyUnowned ╰──GstObject ╰──GstElement ╰──GstBin ╰──GstBaseWebRTCSink ╰──webrtcsink
Implemented interfaces
Factory details
Authors: – Mathieu Duponchelle
Classification: – Sink/Network/WebRTC
Rank – none
Plugin – rswebrtc
Package – gst-plugin-webrtc
Pad Templates
audio_%u
audio/x-raw:
audio/x-opus:
video_%u
video/x-raw:
video/x-raw(memory:CUDAMemory):
video/x-raw(memory:GLMemory):
video/x-raw(memory:NVMM):
video/x-raw(memory:D3D11Memory):
video/x-vp8:
video/x-h264:
video/x-vp9:
video/x-h265:
video/x-av1:
Properties
run-signalling-server
“run-signalling-server” gboolean
Whether the element should run its own signalling server.
Flags : Read / Write
Default value : false
Since : plugins-rs-0.14.0
signalling-server-cert
“signalling-server-cert” gchararray
Path to TLS certificate to use when run-signalling-server is TRUE.
The certificate should be formatted as PKCS 12.
Flags : Read / Write
Default value : NULL
Since : plugins-rs-0.14.0
signalling-server-cert-password
“signalling-server-cert-password” gchararray
The password for the certificate provided through signalling-server-cert.
Flags : Read / Write
Default value : NULL
Since : plugins-rs-0.14.0
signalling-server-host
“signalling-server-host” gchararray
The address to listen on when run-signalling-server is TRUE.
Flags : Read / Write
Default value : 0.0.0.0
Since : plugins-rs-0.14.0
signalling-server-port
“signalling-server-port” guint
The port to listen on when run-signalling-server is TRUE.
Flags : Read / Write
Default value : 8443
Since : plugins-rs-0.14.0
GstBaseWebRTCSink
GObject ╰──GInitiallyUnowned ╰──GstObject ╰──GstElement ╰──GstBin ╰──GstBaseWebRTCSink
Base class for WebRTC sinks to implement and provide their own protocol for.
Signals
consumer-added
consumer_added_callback (GstElement * consumer_id, gchararray webrtcbin, GstElement * arg1, gpointer udata)
def consumer_added_callback (consumer_id, webrtcbin, arg1, udata):
#python callback for the 'consumer-added' signal
function consumer_added_callback(consumer_id: GstElement * consumer_id, webrtcbin: gchararray webrtcbin, arg1: GstElement * arg1, udata: gpointer udata): {
// javascript callback for the 'consumer-added' signal
}
This signal can be used to tweak webrtcbin, creating a data channel for example.
Parameters:
consumer_id
–
Identifier of the consumer added
webrtcbin
–
The new webrtcbin
arg1
–
udata
–
Flags: Run Last
consumer-pipeline-created
consumer_pipeline_created_callback (GstElement * consumer_id, gchararray pipeline, GstPipeline * arg1, gpointer udata)
def consumer_pipeline_created_callback (consumer_id, pipeline, arg1, udata):
#python callback for the 'consumer-pipeline-created' signal
function consumer_pipeline_created_callback(consumer_id: GstElement * consumer_id, pipeline: gchararray pipeline, arg1: GstPipeline * arg1, udata: gpointer udata): {
// javascript callback for the 'consumer-pipeline-created' signal
}
This signal is emitted right after the pipeline for a new consumer has been created, for instance allowing handlers to connect to deep-element-added and tweak properties of any element used by the pipeline.
This provides access to the lower level components of webrtcsink, and no guarantee is made that its internals will remain stable, use with caution!
This is emitted before consumer-added .
Parameters:
consumer_id
–
Identifier of the consumer
pipeline
–
The pipeline that was just created
arg1
–
udata
–
Flags: Run Last
consumer-removed
consumer_removed_callback (GstElement * param_0, gchararray arg0, GstElement * arg1, gpointer udata)
def consumer_removed_callback (param_0, arg0, arg1, udata):
#python callback for the 'consumer-removed' signal
function consumer_removed_callback(param_0: GstElement * param_0, arg0: gchararray arg0, arg1: GstElement * arg1, udata: gpointer udata): {
// javascript callback for the 'consumer-removed' signal
}
Parameters:
param_0
–
arg0
–
arg1
–
udata
–
Flags: Run Last
define-encoder-bitrates
GstStructure * define_encoder_bitrates_callback (GstElement * consumer_id, gchararray overall_bitrate, gint structure, GstStructure * arg2, gpointer udata)
def define_encoder_bitrates_callback (consumer_id, overall_bitrate, structure, arg2, udata):
#python callback for the 'define-encoder-bitrates' signal
function define_encoder_bitrates_callback(consumer_id: GstElement * consumer_id, overall_bitrate: gchararray overall_bitrate, structure: gint structure, arg2: GstStructure * arg2, udata: gpointer udata): {
// javascript callback for the 'define-encoder-bitrates' signal
}
When a session carries multiple video streams, the congestion control mechanism will simply divide the overall allocated bitrate by the number of encoders and set the result as the bitrate for each individual encoder.
With this signal, the application can affect how the overall bitrate gets allocated.
The structure is named "webrtcsink/encoder-bitrates" and contains one gchararray to gint32 mapping per video stream name, for instance:
"video_1234": 5000i32 "video_5678": 10000i32
The total of the bitrates in the returned structure should match the overall bitrate, as it does in the input structure.
Parameters:
consumer_id
–
Identifier of the consumer
overall_bitrate
–
The total bitrate to allocate
structure
–
A structure describing the default per-encoder bitrates
arg2
–
udata
–
the updated encoder bitrates.
Flags: Run Last
Since : plugins-rs-0.14.0
encoder-setup
gboolean encoder_setup_callback (GstElement * consumer_id, gchararray pad_name, gchararray encoder, GstElement * arg2, gpointer udata)
def encoder_setup_callback (consumer_id, pad_name, encoder, arg2, udata):
#python callback for the 'encoder-setup' signal
function encoder_setup_callback(consumer_id: GstElement * consumer_id, pad_name: gchararray pad_name, encoder: gchararray encoder, arg2: GstElement * arg2, udata: gpointer udata): {
// javascript callback for the 'encoder-setup' signal
}
This signal can be used to tweak encoder properties.
Parameters:
consumer_id
–
Identifier of the consumer, or "discovery" when the encoder is used in a discovery pipeline.
pad_name
–
The name of the corresponding input pad
encoder
–
The constructed encoder
arg2
–
udata
–
True if the encoder is entirely configured, False to let other handlers run
Flags: Run Last
payloader-setup
gboolean payloader_setup_callback (GstElement * consumer_id, gchararray pad_name, gchararray payloader, GstElement * arg2, gpointer udata)
def payloader_setup_callback (consumer_id, pad_name, payloader, arg2, udata):
#python callback for the 'payloader-setup' signal
function payloader_setup_callback(consumer_id: GstElement * consumer_id, pad_name: gchararray pad_name, payloader: gchararray payloader, arg2: GstElement * arg2, udata: gpointer udata): {
// javascript callback for the 'payloader-setup' signal
}
This signal can be used to tweak payloader properties, in particular, adding additional extensions.
Note that payload type and ssrc settings are managed by webrtcsink element and trying to change them from an application handler will have no effect.
Parameters:
consumer_id
–
Identifier of the consumer, or "discovery" when the payloader is used in a discovery pipeline.
pad_name
–
The name of the corresponding input pad
payloader
–
The constructed payloader for selected codec
arg2
–
udata
–
True if the encoder is entirely configured, False to let other handlers run. Note that unless your intent is to enforce your custom settings, it's recommended to let the default handler run (by returning true), which would apply the optimal settings.
Flags: Run Last
request-encoded-filter
GstElement * request_encoded_filter_callback (GstElement * consumer_id, gchararray pad_name, gchararray encoded_caps, GstCaps * arg2, gpointer udata)
def request_encoded_filter_callback (consumer_id, pad_name, encoded_caps, arg2, udata):
#python callback for the 'request-encoded-filter' signal
function request_encoded_filter_callback(consumer_id: GstElement * consumer_id, pad_name: gchararray pad_name, encoded_caps: gchararray encoded_caps, arg2: GstCaps * arg2, udata: gpointer udata): {
// javascript callback for the 'request-encoded-filter' signal
}
This signal can be used to insert a filter element between the encoder and the payloader.
When called during Caps discovery, the consumer_id
is None
.
Parameters:
consumer_id
–
Identifier of the consumer
pad_name
–
The name of the corresponding input pad
encoded_caps
–
The Caps of the encoded stream
arg2
–
udata
–
the element to insert.
Flags: Run Last
Action Signals
get-sessions
g_signal_emit_by_name (param_0, "get-sessions", &ret);
ret = param_0.emit ("get-sessions")
let ret = param_0.emit ("get-sessions");
Parameters:
Properties
audio-caps
“audio-caps” GstCaps *
Governs what audio codecs will be proposed. Valid values: [audio/x-opus; audio/x-raw, format=(string)S24BE, layout=(string)interleaved, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]; audio/x-raw, format=(string)S16BE, layout=(string)interleaved, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]; audio/x-raw, format=(string)U8, layout=(string)interleaved, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]]
Flags : Read / Write
Default value :
audio/x-opus
congestion-control
“congestion-control” Web-rtcsink-congestion-control *
Defines how congestion is controlled, if at all
Flags : Read / Write
Default value : gcc (2)
do-clock-signalling
“do-clock-signalling” gboolean
Whether PTP or NTP clock & RTP/clock offset should be signalled according to RFC 7273
Flags : Read / Write
Default value : false
do-fec
“do-fec” gboolean
Whether the element should negotiate and send FEC data
Flags : Read / Write
Default value : true
do-retransmission
“do-retransmission” gboolean
Whether the element should offer to honor retransmission requests
Flags : Read / Write
Default value : true
enable-control-data-channel
“enable-control-data-channel” gboolean
Enable sending control requests through data channel. This includes but is not limited to the forwarding of navigation events.
Flags : Read / Write
Default value : false
Since : plugins-rs-0.14.0
forward-metas
“forward-metas” gchararray
Comma-separated list of buffer metas to forward over the control data channel, if any.
Currently supported names are:
- timecode
Flags : Read / Write
Since : plugins-rs-0.14.0
ice-transport-policy
“ice-transport-policy” GstWebRTCICETransportPolicy *
The policy to apply for ICE transport
Flags : Read / Write
Default value : all (0)
max-bitrate
“max-bitrate” guint
Maximum bitrate to use (in bit/sec) when computing it through the congestion control algorithm
Flags : Read / Write
Default value : 8192000
min-bitrate
“min-bitrate” guint
Minimal bitrate to use (in bit/sec) when computing it through the congestion control algorithm
Flags : Read / Write
Default value : 1000
run-web-server
“run-web-server” gboolean
Whether the element should use [warp] to serve the folder at web-server-directory.
Flags : Read / Write
Default value : false
Since : plugins-rs-0.14.0
signaller
“signaller” GstRSWebRTCSignallableIface *
The Signallable object to use to handle WebRTC Signalling
Flags : Read
start-bitrate
“start-bitrate” guint
Start bitrate to use (in bit/sec)
Flags : Read / Write
Default value : 2048000
stats
“stats” GstStructure *
Statistics for the current consumers
Flags : Read
Default value :
application/x-webrtcsink-stats;
stun-server
“stun-server” gchararray
The STUN server of the form stun://hostname:port
Flags : Read / Write
Default value : stun://stun.l.google.com:19302
turn-servers
“turn-servers” GstValueArray *
The TURN servers of the form <"turn(s)://username:password@host:port", "turn(s)://username1:password1@host1:port1">
Flags : Read / Write
video-caps
“video-caps” GstCaps *
Governs what video codecs will be proposed. Valid values: [video/x-vp8; video/x-h264; video/x-vp9; video/x-h265; video/x-av1; video/x-raw, format=(string){ RGB, RGBA, BGR, BGRA, AYUV, UYVY, I420, Y41B, UYVP }, width=(int)[ 1, 32767 ], height=(int)[ 1, 32767 ]]
Flags : Read / Write
Default value :
video/x-vp8; video/x-h264; video/x-vp9; video/x-h265; video/x-av1
web-server-cert
“web-server-cert” gchararray
The certificate to use when run-web-server is TRUE.
Flags : Read / Write
Default value : NULL
Since : plugins-rs-0.14.0
web-server-directory
“web-server-directory” gchararray
The directory to serve when run-web-server is TRUE.
Flags : Read / Write
Default value : gstwebrtc-api/dist
Since : plugins-rs-0.14.0
web-server-host-addr
“web-server-host-addr” gchararray
The address to listen on when run-web-server is TRUE.
Flags : Read / Write
Default value : http://127.0.0.1:8080/
Since : plugins-rs-0.14.0
web-server-key
“web-server-key” gchararray
The root path for the web server when run-web-server is TRUE.
Flags : Read / Write
Default value : NULL
Since : plugins-rs-0.14.0
web-server-path
“web-server-path” gchararray
The root path for the web server
Flags : Read / Write
Default value : NULL
Named constants
Web-rtcsink-congestion-control
Members
disabled
(0) – Disabled: no congestion control is applied
homegrown
(1) – Homegrown: simple sender-side heuristic
gcc
(2) – Google Congestion Control algorithm
GstRSWebRTCSignallableIface
GInterface ╰──GstRSWebRTCSignallableIface
Interface that WebRTC elements can implement their own protocol with.
Signals
consumer-added
consumer_added_callback (GstElement * self, gchararray peer_id, GstElement * webrtcbin, gpointer udata)
def consumer_added_callback (self, peer_id, webrtcbin, udata):
#python callback for the 'consumer-added' signal
function consumer_added_callback(self: GstElement * self, peer_id: gchararray peer_id, webrtcbin: GstElement * webrtcbin, udata: gpointer udata): {
// javascript callback for the 'consumer-added' signal
}
This signal can be used to tweak webrtcbin, creating a data channel for example.
Parameters:
self
–
The object implementing GstRSWebRTCSignallableIface
peer_id
–
Id of the consumer
webrtcbin
–
The internal WebRTCBin element
udata
–
Flags: Run Last
deprecated :
1.24: Use webrtcbin-ready
instead
consumer-removed
consumer_removed_callback (GstElement * consumer_id, gchararray webrtcbin, GstElement * arg1, gpointer udata)
def consumer_removed_callback (consumer_id, webrtcbin, arg1, udata):
#python callback for the 'consumer-removed' signal
function consumer_removed_callback(consumer_id: GstElement * consumer_id, webrtcbin: gchararray webrtcbin, arg1: GstElement * arg1, udata: gpointer udata): {
// javascript callback for the 'consumer-removed' signal
}
This signal is emitted right after the connection with a consumer has been dropped.
Parameters:
consumer_id
–
Identifier of the consumer that was removed
webrtcbin
–
The webrtcbin connected to the newly removed consumer
arg1
–
udata
–
Flags: Run Last
end-session
gboolean end_session_callback (GstElement * self, gchararray session-id, gpointer udata)
def end_session_callback (self, session-id, udata):
#python callback for the 'end-session' signal
function end_session_callback(self: GstElement * self, session-id: gchararray session-id, udata: gpointer udata): {
// javascript callback for the 'end-session' signal
}
Notify the signaller that a session should be ended.
Parameters:
self
–
The object implementing GstRSWebRTCSignallableIface
session-id
–
The ID of the session that should be ended
udata
–
Flags: Run Last
error
error_callback (GstElement * self, gchararray error, gpointer udata)
def error_callback (self, error, udata):
#python callback for the 'error' signal
function error_callback(self: GstElement * self, error: gchararray error, udata: gpointer udata): {
// javascript callback for the 'error' signal
}
Parameters:
self
–
The object implementing GstRSWebRTCSignallableIface
error
–
The error message as a string
udata
–
Flags: Run Last
munge-session-description
GstWebRTCSessionDescription * munge_session_description_callback (GstElement * self, gchararray session_id, GstWebRTCSessionDescription * description, gpointer udata)
def munge_session_description_callback (self, session_id, description, udata):
#python callback for the 'munge-session-description' signal
function munge_session_description_callback(self: GstElement * self, session_id: gchararray session_id, description: GstWebRTCSessionDescription * description, udata: gpointer udata): {
// javascript callback for the 'munge-session-description' signal
}
For special-case handling, a callback can be registered to modify the session description before the signaller sends it to the peer. Only the first connected handler has any effect.
Parameters:
self
–
The object implementing GstRSWebRTCSignallableIface
session_id
–
Id of the session being described
description
–
The WebRTC session description to modify
udata
–
A modified session description
Flags: Run Last
producer-added
producer_added_callback (GstElement * self, gchararray producer_id, GstStructure * meta, gboolean new_connection, gpointer udata)
def producer_added_callback (self, producer_id, meta, new_connection, udata):
#python callback for the 'producer-added' signal
function producer_added_callback(self: GstElement * self, producer_id: gchararray producer_id, meta: GstStructure * meta, new_connection: gboolean new_connection, udata: gpointer udata): {
// javascript callback for the 'producer-added' signal
}
Some producing peer is available to produce a WebRTC stream.
Parameters:
self
–
The object implementing GstRSWebRTCSignallableIface
producer_id
–
The ID of the available producer
meta
–
The metadata structure of the producer
new_connection
–
true if the producer has just connected to the signalling server or false if it was already running before starting the client
udata
–
Flags: Run Last
producer-removed
producer_removed_callback (GstElement * self, gchararray producer_id, GstStructure * meta, gpointer udata)
def producer_removed_callback (self, producer_id, meta, udata):
#python callback for the 'producer-removed' signal
function producer_removed_callback(self: GstElement * self, producer_id: gchararray producer_id, meta: GstStructure * meta, udata: gpointer udata): {
// javascript callback for the 'producer-removed' signal
}
Some producing peer has stopped producing streams.
Parameters:
self
–
The object implementing GstRSWebRTCSignallableIface
producer_id
–
The ID of the producer that is not available anymore
meta
–
The metadata structure of the producer
udata
–
Flags: Run Last
request-meta
GstStructure * request_meta_callback (GstElement * self, gpointer udata)
def request_meta_callback (self, udata):
#python callback for the 'request-meta' signal
function request_meta_callback(self: GstElement * self, udata: gpointer udata): {
// javascript callback for the 'request-meta' signal
}
The signaller requests a meta about the peer using it
Parameters:
self
–
The object implementing GstRSWebRTCSignallableIface
udata
–
The metadata about the peer represented by the signaller
Flags: Run Last
send-ice
gboolean send_ice_callback (GstElement * self, gchararray session_id, gchararray candidate, guint sdp_m_line_index, gchararray sdp_mid, gpointer udata)
def send_ice_callback (self, session_id, candidate, sdp_m_line_index, sdp_mid, udata):
#python callback for the 'send-ice' signal
function send_ice_callback(self: GstElement * self, session_id: gchararray session_id, candidate: gchararray candidate, sdp_m_line_index: guint sdp_m_line_index, sdp_mid: gchararray sdp_mid, udata: gpointer udata): {
// javascript callback for the 'send-ice' signal
}
Send candidate to the peer.
Parameters:
self
–
The object implementing GstRSWebRTCSignallableIface
session_id
–
Id of the session being described
candidate
–
The ICE candidate description to send to the peer
sdp_m_line_index
–
The M-line of the session description this candidate applies to
sdp_mid
–
The MID this candidate applies to
udata
–
Flags: Run Last
send-session-description
gboolean send_session_description_callback (GstElement * self, gchararray session_id, GstWebRTCSessionDescription * description, gpointer udata)
def send_session_description_callback (self, session_id, description, udata):
#python callback for the 'send-session-description' signal
function send_session_description_callback(self: GstElement * self, session_id: gchararray session_id, description: GstWebRTCSessionDescription * description, udata: gpointer udata): {
// javascript callback for the 'send-session-description' signal
}
Send description to the peer.
Parameters:
self
–
The object implementing GstRSWebRTCSignallableIface
session_id
–
Id of the session being described
description
–
The WebRTC session description to send to the peer
udata
–
Flags: Run Last
session-requested
session_requested_callback (GstElement * self, gchararray session_id, gchararray peer_id, GstWebRTCSessionDescription * arg2, gpointer udata)
def session_requested_callback (self, session_id, peer_id, arg2, udata):
#python callback for the 'session-requested' signal
function session_requested_callback(self: GstElement * self, session_id: gchararray session_id, peer_id: gchararray peer_id, arg2: GstWebRTCSessionDescription * arg2, udata: gpointer udata): {
// javascript callback for the 'session-requested' signal
}
Notify the underlying webrtc object that a session has been requested from the peer.
Parameters:
self
–
The object implementing GstRSWebRTCSignallableIface
session_id
–
The ID of the producer that was added
peer_id
–
The ID of the consumer peer who wants to initiate a session
arg2
–
udata
–
Flags: Run Last
session-started
session_started_callback (GstElement * self, gchararray arg0, gchararray arg1, gpointer udata)
def session_started_callback (self, arg0, arg1, udata):
#python callback for the 'session-started' signal
function session_started_callback(self: GstElement * self, arg0: gchararray arg0, arg1: gchararray arg1, udata: gpointer udata): {
// javascript callback for the 'session-started' signal
}
Notify the underlying webrtc object that a session has started.
Parameters:
self
–
The object implementing GstRSWebRTCSignallableIface
arg0
–
arg1
–
udata
–
Flags: Run Last
webrtcbin-ready
webrtcbin_ready_callback (GstElement * self, gchararray peer_id, GstElement * webrtcbin, gpointer udata)
def webrtcbin_ready_callback (self, peer_id, webrtcbin, udata):
#python callback for the 'webrtcbin-ready' signal
function webrtcbin_ready_callback(self: GstElement * self, peer_id: gchararray peer_id, webrtcbin: GstElement * webrtcbin, udata: gpointer udata): {
// javascript callback for the 'webrtcbin-ready' signal
}
This signal can be used to tweak webrtcbin, creating a data channel for example.
Parameters:
self
–
The object implementing GstRSWebRTCSignallableIface
peer_id
–
Id of the consumer/producer
webrtcbin
–
The internal WebRTCBin element
udata
–
Flags: Run Last
Action Signals
handle-ice
g_signal_emit_by_name (self, "handle-ice", session_id, sdp_m_line_index, sdp_mid, candidate);
ret = self.emit ("handle-ice", session_id, sdp_m_line_index, sdp_mid, candidate)
let ret = self.emit ("handle-ice", session_id, sdp_m_line_index, sdp_mid, candidate);
Notify the underlying webrtc object of an ICE candidate.
Parameters:
The object implementing GstRSWebRTCSignallableIface
Id of the session the ice information is about
The mlineindex of the ice candidate
Media ID of the ice candidate
Information about the candidate
session-description
g_signal_emit_by_name (self, "session-description", session_id, description);
ret = self.emit ("session-description", session_id, description)
let ret = self.emit ("session-description", session_id, description);
Notify the underlying webrtc object of a received session description
Parameters:
The object implementing GstRSWebRTCSignallableIface
Id of the session being described
The WebRTC session description
session-ended
g_signal_emit_by_name (self, "session-ended", session-id, &ret);
ret = self.emit ("session-ended", session-id)
let ret = self.emit ("session-ended", session-id);
Notify the underlying webrtc object that a session has ended.
shutdown
g_signal_emit_by_name (self, "shutdown");
ret = self.emit ("shutdown")
let ret = self.emit ("shutdown");
Parameters:
The object implementing GstRSWebRTCSignallableIface
start
g_signal_emit_by_name (self, "start", &ret);
ret = self.emit ("start")
let ret = self.emit ("start");
Starts the signaller, connecting it to the signalling server.
Parameters:
The object implementing GstRSWebRTCSignallableIface
stop
g_signal_emit_by_name (self, "stop", &ret);
ret = self.emit ("stop")
let ret = self.emit ("stop");
Stops the signaller, disconnecting it to the signalling server.
Parameters:
The object implementing GstRSWebRTCSignallableIface
The results of the search are