decodebin2: Do not fail if one of the decoders isn't able to output the requested format

when expose-all=False

When trying to find an decoder in that case, we loop over the different
decoder factories, and check that it outputs a format that matches the
requested one (through the :caps property), but if we find a decoder
that do match but later on some other don't we end up failing
autopluging. This patch ensures that we still plug the decoder that can
work.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3011>
This commit is contained in:
Thibault Saunier 2022-09-09 16:57:18 -04:00 committed by GStreamer Marge Bot
parent 339e5916c6
commit e866c1d967

View file

@ -1701,7 +1701,7 @@ analyze_new_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
if (!dbin->expose_allstreams && gst_caps_is_fixed (caps)) {
guint i;
const GList *tmps;
gboolean dontuse = FALSE;
gboolean dontuse = FALSE, found_finals = FALSE;
GST_DEBUG ("Checking if we can abort early");
@ -1737,8 +1737,11 @@ analyze_new_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
gst_decode_bin_signals[SIGNAL_AUTOPLUG_CONTINUE], 0, dpad, tcaps,
&apcontinue);
/* If autoplug-continue returns TRUE and the caps are not final, don't use them */
if (apcontinue && !are_final_caps (dbin, tcaps))
/* If autoplug-continue returns TRUE and the caps are not final, and
* we haven't found any way to output finals yet, don't use them */
if (are_final_caps (dbin, tcaps))
found_finals = TRUE;
else if (apcontinue && !found_finals)
dontuse = TRUE;
gst_caps_unref (tcaps);
}