From 9084bc151be66c7271a5b3679e0e3dc653e96fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 21 Mar 2013 13:33:44 +0100 Subject: [PATCH] playsinkconvertbin: Make sure to return all allowed caps in the GET_CAPS query Add all the caps that we can convert to to the filter caps, otherwise downstream might just return EMPTY caps because it doesn't handle the filter caps but we could still convert to these caps, causing us to return EMPTY caps although conversion would be possible. https://bugzilla.gnome.org/show_bug.cgi?id=688803 --- gst/playback/gstplaysinkconvertbin.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/gst/playback/gstplaysinkconvertbin.c b/gst/playback/gstplaysinkconvertbin.c index a5e03f077f..76cb095f50 100644 --- a/gst/playback/gstplaysinkconvertbin.c +++ b/gst/playback/gstplaysinkconvertbin.c @@ -398,7 +398,21 @@ gst_play_sink_convert_bin_getcaps (GstPad * pad, GstCaps * filter) if (otherpad) { peer = gst_pad_get_peer (otherpad); if (peer) { - GstCaps *peer_caps = gst_pad_query_caps (peer, filter); + GstCaps *peer_caps; + GstCaps *downstream_filter = NULL; + + /* Add all the caps that we can convert to to the filter caps, + * otherwise downstream might just return EMPTY caps because + * it doesn't handle the filter caps but we could still convert + * to these caps */ + if (filter) { + downstream_filter = gst_caps_copy (filter); + downstream_filter = + gst_caps_merge (downstream_filter, + gst_caps_ref (self->converter_caps)); + } + + peer_caps = gst_pad_query_caps (peer, downstream_filter); gst_object_unref (peer); if (self->converter_caps && is_raw_caps (peer_caps, self->audio)) { ret = gst_caps_merge (peer_caps, gst_caps_ref (self->converter_caps)); @@ -415,6 +429,13 @@ gst_play_sink_convert_bin_getcaps (GstPad * pad, GstCaps * filter) gst_object_unref (self); + if (filter) { + GstCaps *intersection = + gst_caps_intersect_full (filter, ret, GST_CAPS_INTERSECT_FIRST); + gst_caps_unref (ret); + ret = intersection; + } + GST_DEBUG_OBJECT (pad, "Returning caps %" GST_PTR_FORMAT, ret); return ret;