From: Sebastian Dröge Date: Thu, 2 Jan 2014 12:33:20 +0000 (+0100) Subject: pad: Check if new probes need to be called when adding/removing some X-Git-Tag: 1.3.1~247 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=93ce90f83320e845867d28b9cbeea5b596a1ef04;p=platform%2Fupstream%2Fgstreamer.git pad: Check if new probes need to be called when adding/removing some This allows blocking a pad, add a new blocking probe, removing the first probe and then having the second probe called. Which could then decide that data-flow should actually continue instead of blocking now. https://bugzilla.gnome.org/show_bug.cgi?id=721289 --- diff --git a/gst/gstpad.c b/gst/gstpad.c index db96d5f..248a609 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -1195,10 +1195,13 @@ cleanup_hook (GstPad * pad, GHook * hook) pad->num_blocked--; GST_DEBUG_OBJECT (pad, "remove blocking probe, now %d left", pad->num_blocked); + + /* Might have new probes now that want to be called */ + GST_PAD_BLOCK_BROADCAST (pad); + if (pad->num_blocked == 0) { GST_DEBUG_OBJECT (pad, "last blocking probe removed, unblocking"); GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_BLOCKED); - GST_PAD_BLOCK_BROADCAST (pad); } } g_hook_destroy_link (&pad->probes, hook); @@ -1273,6 +1276,9 @@ gst_pad_add_probe (GstPad * pad, GstPadProbeType mask, GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_BLOCKED); GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, "added blocking probe, " "now %d blocking probes", pad->num_blocked); + + /* Might have new probes now that want to be called */ + GST_PAD_BLOCK_BROADCAST (pad); } /* call the callback if we need to be called for idle callbacks */ @@ -3237,6 +3243,14 @@ again: GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_BLOCKING); GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, "We got unblocked"); + /* if the list changed, call the new callbacks (they will not have their + * cookie set to data.cookie */ + if (cookie != pad->priv->probe_list_cookie) { + GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, + "probe list changed, restarting"); + goto again; + } + if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad))) goto flushing; }