mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
rtsp-stream: avoid pushing data on unlinked udpsrc pad during setup
Fix race when setting up source elements. Since we set the source element(s) to PLAYING state before hooking them up to the downstream funnel, it's possible for the source element to receive packets before we actually get to linking it to the funnel, in which case buffers would be pushed out on an unlinked pad, causing it to error out and stop receiving more data. We fix this by blocking the source's srcpad until we have linked it. https://bugzilla.gnome.org/show_bug.cgi?id=796160
This commit is contained in:
parent
f110016ac6
commit
c1fab570d8
1 changed files with 7 additions and 1 deletions
|
@ -3002,10 +3002,15 @@ plug_src (GstRTSPStream * stream, GstBin * bin, GstElement * src,
|
|||
{
|
||||
GstRTSPStreamPrivate *priv;
|
||||
GstPad *pad, *selpad;
|
||||
gulong id = 0;
|
||||
|
||||
priv = stream->priv;
|
||||
|
||||
pad = gst_element_get_static_pad (src, "src");
|
||||
if (priv->srcpad) {
|
||||
/* block pad so src can't push data while it's not yet linked */
|
||||
id = gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_BLOCK |
|
||||
GST_PAD_PROBE_TYPE_BUFFER, NULL, NULL, NULL);
|
||||
/* we set and keep these to playing so that they don't cause NO_PREROLL return
|
||||
* values. This is only relevant for PLAY pipelines */
|
||||
gst_element_set_state (src, GST_STATE_PLAYING);
|
||||
|
@ -3017,8 +3022,9 @@ plug_src (GstRTSPStream * stream, GstBin * bin, GstElement * src,
|
|||
|
||||
/* and link to the funnel */
|
||||
selpad = gst_element_get_request_pad (funnel, "sink_%u");
|
||||
pad = gst_element_get_static_pad (src, "src");
|
||||
gst_pad_link (pad, selpad);
|
||||
if (id != 0)
|
||||
gst_pad_remove_probe (pad, id);
|
||||
gst_object_unref (pad);
|
||||
gst_object_unref (selpad);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue