caps: No need to require writable caps for _append/_merge second caps
authorThiago Santos <thiago.sousa.santos@collabora.com>
Fri, 21 Oct 2011 13:23:04 +0000 (10:23 -0300)
committerThiago Santos <thiago.sousa.santos@collabora.com>
Fri, 21 Oct 2011 13:23:04 +0000 (10:23 -0300)
The second caps ownership is transfered, no need to require it to
be writable from the caller function. Instead, _append and _merge
make it writable on their own.

Discovered because of an assertion on encoding-profile.c in
_get_input_caps using _merge but not passing writable caps.

gst/gstcaps.c

index 002694d..3652a44 100644 (file)
@@ -583,7 +583,8 @@ gst_caps_append (GstCaps * caps1, GstCaps * caps2)
   g_return_if_fail (GST_IS_CAPS (caps1));
   g_return_if_fail (GST_IS_CAPS (caps2));
   g_return_if_fail (IS_WRITABLE (caps1));
-  g_return_if_fail (IS_WRITABLE (caps2));
+
+  caps2 = gst_caps_make_writable (caps2);
 
 #ifdef USE_POISONING
   CAPS_POISON (caps2);
@@ -625,7 +626,8 @@ gst_caps_merge (GstCaps * caps1, GstCaps * caps2)
   g_return_if_fail (GST_IS_CAPS (caps1));
   g_return_if_fail (GST_IS_CAPS (caps2));
   g_return_if_fail (IS_WRITABLE (caps1));
-  g_return_if_fail (IS_WRITABLE (caps2));
+
+  caps2 = gst_caps_make_writable (caps2);
 
 #ifdef USE_POISONING
   CAPS_POISON (caps2);