playbin2/3: autoplug/caps: don't expand caps to ANY
authorMatthew Waters <matthew@centricular.com>
Fri, 24 Sep 2021 05:02:27 +0000 (15:02 +1000)
committerMatthew Waters <matthew@centricular.com>
Thu, 14 Oct 2021 06:04:26 +0000 (17:04 +1100)
Retrieving the pad template caps from a ghost pad returns ANY which when
merged with any other caps will return ANY.  ANY is not very specific
and may cause suboptimal code paths in e.g. decoders that assume the
lowest common denominator when presented with ANY caps.

Fixes negotiating dma-buf with vaapidecodebin between glupload in the
video sink element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1144>

subprojects/gst-plugins-base/gst/playback/gstplaybin2.c
subprojects/gst-plugins-base/gst/playback/gstplaybin3.c

index 9d32c6e..bcbfc20 100644 (file)
@@ -5137,11 +5137,8 @@ done:
           }
         }
         gst_caps_unref (target_caps);
-        target_caps = tmp;
+        result = gst_caps_merge (result, tmp);
       }
-
-
-      result = gst_caps_merge (result, target_caps);
       gst_object_unref (target);
     }
   }
index 70a19fe..e86eb62 100644 (file)
@@ -4309,7 +4309,8 @@ done:
     if (target) {
       GstCaps *target_caps = gst_pad_get_pad_template_caps (target);
       GST_PLAY_BIN3_FILTER_CAPS (filter, target_caps);
-      result = gst_caps_merge (result, target_caps);
+      if (!gst_caps_is_any (target_caps))
+        result = gst_caps_merge (result, target_caps);
       gst_object_unref (target);
     }
   }