mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 18:50:48 +00:00
webrtcbin: support adding TURN servers after pipeline start
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1680 When a TURN server is added for the first time, propagate the change to all nice streams that already exist. This lets us add servers after the pipeline has been started (and streams have been added). Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3217>
This commit is contained in:
parent
698503f5a7
commit
4810008afa
1 changed files with 27 additions and 1 deletions
|
@ -932,17 +932,43 @@ gst_webrtc_nice_set_remote_credentials (GstWebRTCICE * ice,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GstWebRTCNice *ice;
|
||||
GstUri *turn_server;
|
||||
} AddTurnServerToStreamData;
|
||||
|
||||
static gboolean
|
||||
_add_turn_server_foreach_stream_func (struct NiceStreamItem *item,
|
||||
gpointer data)
|
||||
{
|
||||
AddTurnServerToStreamData *add_data = (AddTurnServerToStreamData *) data;
|
||||
_add_turn_server (add_data->ice, item, add_data->turn_server);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_webrtc_nice_add_turn_server (GstWebRTCICE * ice, const gchar * uri)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GstUri *valid_uri;
|
||||
GstWebRTCNice *nice = GST_WEBRTC_NICE (ice);
|
||||
gboolean inserted;
|
||||
AddTurnServerToStreamData add_data;
|
||||
|
||||
if (!(valid_uri = _validate_turn_server (nice, uri)))
|
||||
goto done;
|
||||
|
||||
g_hash_table_insert (nice->priv->turn_servers, g_strdup (uri), valid_uri);
|
||||
inserted =
|
||||
g_hash_table_insert (nice->priv->turn_servers, g_strdup (uri), valid_uri);
|
||||
|
||||
/* add the turn server to any streams that were already created */
|
||||
if (inserted) {
|
||||
add_data.ice = nice;
|
||||
add_data.turn_server = valid_uri;
|
||||
_nice_stream_item_foreach (nice, _add_turn_server_foreach_stream_func,
|
||||
&add_data);
|
||||
}
|
||||
|
||||
ret = TRUE;
|
||||
|
||||
|
|
Loading…
Reference in a new issue