From 2faef82b9ae79fbd249c1eb5d30236d55d3930a7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 22 Nov 2012 13:06:14 +0100 Subject: [PATCH] decodebin: Check if the element really accepts the caps after setting it to READY It might know the caps constraints for sure only after opening a decoder. --- gst/playback/gstdecodebin2.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index c26887e..9d40db5 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -2009,6 +2009,16 @@ connect_pad (GstDecodeBin * dbin, GstElement * src, GstDecodePad * dpad, /* Stop filtering errors. */ remove_error_filter (dbin, element); + /* check if we still accept the caps on the pad after setting + * the element to READY */ + if (!gst_pad_query_accept_caps (sinkpad, caps)) { + GST_WARNING_OBJECT (dbin, "Element %s does not accept caps", + GST_ELEMENT_NAME (element)); + gst_object_unref (sinkpad); + gst_bin_remove (GST_BIN (dbin), element); + continue; + } + gst_object_unref (sinkpad); GST_LOG_OBJECT (dbin, "linked on pad %s:%s", GST_DEBUG_PAD_NAME (pad)); @@ -3285,7 +3295,7 @@ drain_and_switch_chains (GstDecodeChain * chain, GstDecodePad * drainpad, if (G_UNLIKELY (chain->drained)) { goto beach; } - + if (chain->endpad) { /* Check if we're reached the target endchain */ if (chain == drainpad->chain) { @@ -3326,7 +3336,7 @@ drain_and_switch_chains (GstDecodeChain * chain, GstDecodePad * drainpad, } else { GST_DEBUG ("Group %p was the last in chain %p", chain->active_group, chain); - chain->drained = TRUE; + chain->drained = TRUE; /* We're drained ! */ } } -- 2.7.4