interleave: intersect result with filter caps in caps query
authorTim-Philipp Müller <tim@centricular.com>
Fri, 24 Oct 2014 22:48:30 +0000 (23:48 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 25 Oct 2014 10:08:48 +0000 (11:08 +0100)
Fixes crash in audiotestsrc because of an unsupported format
getting negotiated on big-endian systems with
audiotestsrc ! interleave ! audioconvert ! wavenc

gst/interleave/interleave.c

index cb2cd0f..2a2fd6e 100644 (file)
@@ -750,6 +750,16 @@ gst_interleave_sink_getcaps (GstPad * pad, GstInterleave * self,
 
   GST_OBJECT_UNLOCK (self);
 
+  if (filter != NULL) {
+    GstCaps *caps = result;
+
+    GST_LOG_OBJECT (pad, "intersecting filter caps %" GST_PTR_FORMAT " with "
+        "preliminary result %" GST_PTR_FORMAT, filter, caps);
+
+    result = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (caps);
+  }
+
   GST_DEBUG_OBJECT (pad, "Returning caps %" GST_PTR_FORMAT, result);
 
   return result;