pad: get_allowed_caps() should go through both pads

The previous implementation was doing a direct call to the peer pad,
which resulted in query probes never being called on the original pad.

Instead of that, get the peer pad caps by using gst_pad_peer_query()
which will call probes in the expected fashion.
This commit is contained in:
Edward Hervey 2015-08-08 14:42:52 +02:00 committed by Edward Hervey
parent 0eb9dde1e8
commit 2499349d94

View file

@ -2645,26 +2645,25 @@ GstCaps *
gst_pad_get_allowed_caps (GstPad * pad)
{
GstCaps *mycaps;
GstCaps *caps;
GstPad *peer;
GstCaps *caps = NULL;
GstQuery *query;
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
GST_OBJECT_LOCK (pad);
peer = GST_PAD_PEER (pad);
if (G_UNLIKELY (peer == NULL))
if (G_UNLIKELY (GST_PAD_PEER (pad) == NULL))
goto no_peer;
GST_OBJECT_UNLOCK (pad);
GST_CAT_DEBUG_OBJECT (GST_CAT_PROPERTIES, pad, "getting allowed caps");
gst_object_ref (peer);
GST_OBJECT_UNLOCK (pad);
mycaps = gst_pad_query_caps (pad, NULL);
caps = gst_pad_query_caps (peer, mycaps);
gst_object_unref (peer);
gst_caps_unref (mycaps);
/* Query peer caps */
query = gst_query_new_caps (mycaps);
gst_pad_peer_query (pad, query);
gst_query_parse_caps (query, &caps);
gst_query_unref (query);
GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, pad, "allowed caps %" GST_PTR_FORMAT,
caps);