base{sink,src}: Don't try to fixate ANY caps
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 18 Apr 2011 16:19:24 +0000 (18:19 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 19 Apr 2011 09:45:36 +0000 (11:45 +0200)
libs/gst/base/gstbasesink.c
libs/gst/base/gstbasesrc.c

index 6a340c4..a5feebd 100644 (file)
@@ -4313,10 +4313,8 @@ gst_base_sink_negotiate_pull (GstBaseSink * basesink)
   caps = gst_caps_make_writable (caps);
   /* get the first (prefered) format */
   gst_caps_truncate (caps);
-  /* try to fixate */
-  gst_pad_fixate_caps (GST_BASE_SINK_PAD (basesink), caps);
 
-  GST_DEBUG_OBJECT (basesink, "fixated to: %" GST_PTR_FORMAT, caps);
+  GST_DEBUG_OBJECT (basesink, "have caps: %" GST_PTR_FORMAT, caps);
 
   if (gst_caps_is_any (caps)) {
     GST_DEBUG_OBJECT (basesink, "caps were ANY after fixating, "
@@ -4324,15 +4322,21 @@ gst_base_sink_negotiate_pull (GstBaseSink * basesink)
     /* neither side has template caps in this case, so they are prepared for
        pull() without setcaps() */
     result = TRUE;
-  } else if (gst_caps_is_fixed (caps)) {
-    if (!gst_pad_set_caps (GST_BASE_SINK_PAD (basesink), caps))
-      goto could_not_set_caps;
+  } else {
+    /* try to fixate */
+    gst_pad_fixate_caps (GST_BASE_SINK_PAD (basesink), caps);
+    GST_DEBUG_OBJECT (basesink, "fixated to: %" GST_PTR_FORMAT, caps);
 
-    GST_OBJECT_LOCK (basesink);
-    gst_caps_replace (&basesink->priv->pull_caps, caps);
-    GST_OBJECT_UNLOCK (basesink);
+    if (gst_caps_is_fixed (caps)) {
+      if (!gst_pad_set_caps (GST_BASE_SINK_PAD (basesink), caps))
+        goto could_not_set_caps;
 
-    result = TRUE;
+      GST_OBJECT_LOCK (basesink);
+      gst_caps_replace (&basesink->priv->pull_caps, caps);
+      GST_OBJECT_UNLOCK (basesink);
+
+      result = TRUE;
+    }
   }
 
   gst_caps_unref (caps);
index d130502..7f12b41 100644 (file)
@@ -2632,17 +2632,19 @@ gst_base_src_default_negotiate (GstBaseSrc * basesrc)
 
     /* now fixate */
     if (!gst_caps_is_empty (caps)) {
-      gst_pad_fixate_caps (GST_BASE_SRC_PAD (basesrc), caps);
-      GST_DEBUG_OBJECT (basesrc, "fixated to: %" GST_PTR_FORMAT, caps);
-
+      GST_DEBUG_OBJECT (basesrc, "have caps: %" GST_PTR_FORMAT, caps);
       if (gst_caps_is_any (caps)) {
         /* hmm, still anything, so element can do anything and
          * nego is not needed */
         result = TRUE;
-      } else if (gst_caps_is_fixed (caps)) {
-        /* yay, fixed caps, use those then, it's possible that the subclass does
-         * not accept this caps after all and we have to fail. */
-        result = gst_pad_set_caps (GST_BASE_SRC_PAD (basesrc), caps);
+      } else {
+        gst_pad_fixate_caps (GST_BASE_SRC_PAD (basesrc), caps);
+        GST_DEBUG_OBJECT (basesrc, "fixated to: %" GST_PTR_FORMAT, caps);
+        if (gst_caps_is_fixed (caps)) {
+          /* yay, fixed caps, use those then, it's possible that the subclass does
+           * not accept this caps after all and we have to fail. */
+          result = gst_pad_set_caps (GST_BASE_SRC_PAD (basesrc), caps);
+        }
       }
     }
     gst_caps_unref (caps);