do no use gst_element_link but gst_pad_link in pad-added callbacks to prevent situations where

on multiple incoming streams they might not get linked correctly and leave a stream unconnected
This commit is contained in:
Bernhard Jung 2019-05-09 18:39:28 +02:00 committed by Sebastian Dröge
parent d74e2ac147
commit 92050d6a59
2 changed files with 8 additions and 2 deletions

View file

@ -171,6 +171,7 @@ static void
on_incoming_stream (GstElement * webrtc, GstPad * pad, GstElement * pipe)
{
GstElement *decodebin;
GstPad *sinkpad;
if (GST_PAD_DIRECTION (pad) != GST_PAD_SRC)
return;
@ -180,7 +181,9 @@ on_incoming_stream (GstElement * webrtc, GstPad * pad, GstElement * pipe)
G_CALLBACK (on_incoming_decodebin_stream), pipe);
gst_bin_add (GST_BIN (pipe), decodebin);
gst_element_sync_state_with_parent (decodebin);
gst_element_link (webrtc, decodebin);
sinkpad = gst_element_get_static_pad (decodebin, "sink");
gst_pad_link (pad, sinkpad);
}
static void

View file

@ -172,6 +172,7 @@ static void
on_incoming_stream (GstElement * webrtc, GstPad * pad, GstElement * pipe)
{
GstElement *decodebin;
GstPad *sinkpad;
if (GST_PAD_DIRECTION (pad) != GST_PAD_SRC)
return;
@ -181,7 +182,9 @@ on_incoming_stream (GstElement * webrtc, GstPad * pad, GstElement * pipe)
G_CALLBACK (on_incoming_decodebin_stream), pipe);
gst_bin_add (GST_BIN (pipe), decodebin);
gst_element_sync_state_with_parent (decodebin);
gst_element_link (webrtc, decodebin);
sinkpad = gst_element_get_static_pad (decodebin, "sink");
gst_pad_link (pad, sinkpad);
}
static void