decodebin2: Do not fail if one of the decoders isn't able to output the requested...
authorThibault Saunier <tsaunier@igalia.com>
Fri, 9 Sep 2022 20:57:18 +0000 (16:57 -0400)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 15 Sep 2022 21:03:14 +0000 (21:03 +0000)
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>

subprojects/gst-plugins-base/gst/playback/gstdecodebin2.c

index bc2e339..532824f 100644 (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);
         }