decodebin: Only continue autoplugging once the pad has final caps
authorSebastian Dröge <sebastian@centricular.com>
Thu, 10 Jul 2014 10:17:52 +0000 (12:17 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 21 Jul 2014 07:35:05 +0000 (09:35 +0200)
If the caps query returned us fixed caps this doesn't mean yet
that these caps are actually complete (fields might be missing).

It allows to do us some decisions, but the selection of the next
element should be delayed as only complete caps allow proper selection
of the next element.

gst/playback/gstdecodebin2.c

index f1920a2..623aac4 100644 (file)
@@ -1577,8 +1577,16 @@ analyze_new_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
 
   /* 1.c when the caps are not fixed yet, we can't be sure what element to
    * connect. We delay autoplugging until the caps are fixed */
-  if (!is_parser_converter && !gst_caps_is_fixed (caps))
+  if (!is_parser_converter && !gst_caps_is_fixed (caps)) {
     goto non_fixed;
+  } else if (!is_parser_converter) {
+    gst_caps_unref (caps);
+    caps = gst_pad_get_current_caps (pad);
+    if (!caps) {
+      GST_DEBUG_OBJECT (dbin, "No final caps set yet, delaying autoplugging");
+      goto setup_caps_delay;
+    }
+  }
 
   /* 1.d else get the factories and if there's no compatible factory goto
    * unknown_type */
@@ -1734,11 +1742,11 @@ analyze_new_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
     pad = p;
 
     gst_caps_unref (caps);
-    caps = get_pad_caps (pad);
 
-    if (!gst_caps_is_fixed (caps)) {
-      g_value_array_free (factories);
-      goto non_fixed;
+    caps = gst_pad_get_current_caps (pad);
+    if (!caps) {
+      GST_DEBUG_OBJECT (dbin, "No final caps set yet, delaying autoplugging");
+      goto setup_caps_delay;
     }
   }