gst/playback/gstplaybin2.c: Fix nasty race where multiple decodebins could start pushing data before we manage to con...

Original commit message from CVS:
* gst/playback/gstplaybin2.c: (selector_blocked), (pad_added_cb),
(no_more_pads_cb):
Fix nasty race where multiple decodebins could start pushing data before
we manage to configure the sinks, resulting in not-linked errors in
typical RTSP streaming cases.
This commit is contained in:
Wim Taymans 2008-08-27 15:30:16 +00:00
parent da76d5e7cb
commit ed11048c05
2 changed files with 31 additions and 0 deletions

View file

@ -1,3 +1,11 @@
2008-08-27 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/playback/gstplaybin2.c: (selector_blocked), (pad_added_cb),
(no_more_pads_cb):
Fix nasty race where multiple decodebins could start pushing data before
we manage to configure the sinks, resulting in not-linked errors in
typical RTSP streaming cases.
2008-08-26 Wim Taymans <wim.taymans@collabora.co.uk>
* gst-libs/gst/audio/gstaudiosink.c: (gst_audioringbuffer_stop):

View file

@ -1529,6 +1529,13 @@ gst_play_bin_handle_message (GstBin * bin, GstMessage * msg)
GST_BIN_CLASS (parent_class)->handle_message (bin, msg);
}
static void
selector_blocked (GstPad * pad, gboolean blocked, gpointer user_data)
{
/* no nothing */
GST_DEBUG_OBJECT (pad, "blocked callback, blocked: %d", blocked);
}
/* this function is called when a new pad is added to decodebin. We check the
* type of the pad and add it to the selecter element of the group.
*/
@ -1580,6 +1587,11 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
/* save source pad */
select->srcpad = gst_element_get_static_pad (select->selector, "src");
/* block the selector srcpad. It's possible that multiple decodebins start
* pushing data into the selectors before we have a chance to collect all
* streams and connect the sinks, resulting in not-linked errors. After we
* configured the sinks we will unblock them all. */
gst_pad_set_blocked_async (select->srcpad, TRUE, selector_blocked, NULL);
}
/* get sinkpad for the new stream */
@ -1755,6 +1767,17 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group)
/* signal the other decodebins that they can continue now. */
GST_SOURCE_GROUP_LOCK (group);
/* unblock all selectors */
for (i = 0; i < GST_PLAY_SINK_TYPE_LAST; i++) {
GstSourceSelect *select = &group->selector[i];
if (select->selector) {
GST_DEBUG_OBJECT (playbin, "unblocking %" GST_PTR_FORMAT,
select->srcpad);
gst_pad_set_blocked_async (select->srcpad, FALSE, selector_blocked,
NULL);
}
}
GST_DEBUG_OBJECT (playbin, "signal other decodebins");
GST_SOURCE_GROUP_BROADCAST (group);
GST_SOURCE_GROUP_UNLOCK (group);