pad: return ANY for a pad without template
authorWim Taymans <wim.taymans@collabora.co.uk>
Thu, 8 Mar 2012 08:45:06 +0000 (09:45 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Thu, 8 Mar 2012 09:34:42 +0000 (10:34 +0100)
Because gst_pad_get_pad_template_caps() returns ANY when there is no template,
the query caps function should also return ANY when there is no template (and no
pad current caps) instead of EMPTY.

gst/gstpad.c
tests/check/gst/gstpad.c

index 1c33abb..d7ce22c 100644 (file)
@@ -2722,13 +2722,10 @@ gst_pad_query_caps_default (GstPad * pad, GstQuery * query)
     if ((result = get_pad_caps (pad)))
       goto filter_done_unlock;
   }
-  GST_OBJECT_UNLOCK (pad);
 
   /* this almost never happens */
   GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, pad, "pad has no caps");
-  result = gst_caps_new_empty ();
-
-  goto done;
+  result = GST_CAPS_ANY;
 
 filter_done_unlock:
   GST_OBJECT_UNLOCK (pad);
@@ -2748,7 +2745,6 @@ filter_done:
     result = gst_caps_ref (result);
   }
 
-done:
   gst_query_set_caps_result (query, result);
   gst_caps_unref (result);
 
index 073a2ca..59e88d5 100644 (file)
@@ -41,11 +41,11 @@ GST_START_TEST (test_link)
   sink = gst_pad_new ("sink", GST_PAD_SINK);
   fail_if (sink == NULL);
 
-  /* linking without templates or caps should fail */
+  /* linking without templates or caps should work */
   ret = gst_pad_link (src, sink);
   ASSERT_OBJECT_REFCOUNT (src, "source pad", 1);
   ASSERT_OBJECT_REFCOUNT (sink, "sink pad", 1);
-  fail_unless (ret == GST_PAD_LINK_NOFORMAT);
+  fail_unless (ret == GST_PAD_LINK_OK);
 
   ASSERT_CRITICAL (gst_pad_get_pad_template (NULL));