From: Edward Hervey Date: Tue, 24 Jul 2012 08:45:58 +0000 (+0200) Subject: decodebin2: Mark streams as complete on CAPS event but don't block X-Git-Tag: 1.19.3~511^2~6127 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2f37ba60a2838f072150b4443184ef0a3047a497;p=platform%2Fupstream%2Fgstreamer.git decodebin2: Mark streams as complete on CAPS event but don't block This allows the following use-cases to expose the group and pads before an ALLOCATION query comes through: * Single stream use-cases * Multi stream use-cases where all streams sent the CAPS event before the first ALLOCATION query Some cases will still make the initial ALLOCATION query fail though, which isn't optimal, but not fatal (it will recover when pads are exposed, a RECONFIGURE event is sent upstream and elements can re-send an ALLOCATION query which will reach downstream elements). https://bugzilla.gnome.org/show_bug.cgi?id=680262 --- diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index e4198e6..146143c 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -3865,15 +3865,18 @@ source_pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data) GstDecodeChain *chain; GstDecodeBin *dbin; - if ((GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) && - (GST_EVENT_TYPE (GST_PAD_PROBE_INFO_EVENT (info)) != GST_EVENT_CAPS) && - (GST_EVENT_IS_STICKY (GST_PAD_PROBE_INFO_EVENT (info)) - || !GST_EVENT_IS_SERIALIZED (GST_PAD_PROBE_INFO_EVENT (info)))) { - /* do not block on sticky or out of band events otherwise the allocation query - from demuxer might block the loop thread */ - return GST_PAD_PROBE_PASS; + if (GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) { + GST_LOG_OBJECT (pad, "Seeing event '%s'", + GST_EVENT_TYPE_NAME (GST_PAD_PROBE_INFO_EVENT (info))); + if ((GST_EVENT_TYPE (GST_PAD_PROBE_INFO_EVENT (info)) != GST_EVENT_CAPS) + && (GST_EVENT_IS_STICKY (GST_PAD_PROBE_INFO_EVENT (info)) + || !GST_EVENT_IS_SERIALIZED (GST_PAD_PROBE_INFO_EVENT (info)))) { + /* do not block on sticky or out of band events otherwise the allocation query + from demuxer might block the loop thread */ + GST_LOG_OBJECT (pad, "Letting event through"); + return GST_PAD_PROBE_PASS; + } } - chain = dpad->chain; dbin = chain->dbin; @@ -3888,6 +3891,11 @@ source_pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data) } EXPOSE_UNLOCK (dbin); + /* If we unblocked due to a caps event, let it go through */ + if ((GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) && + (GST_EVENT_TYPE (GST_PAD_PROBE_INFO_EVENT (info)) == GST_EVENT_CAPS)) + return GST_PAD_PROBE_PASS; + return GST_PAD_PROBE_OK; }