From b164a8232a0c3f27b9904912f7fff39a26bedadd Mon Sep 17 00:00:00 2001 From: Chen Rui Date: Wed, 26 Jan 2011 16:46:25 +0800 Subject: [PATCH] utils: return real error in compatible link check We need to ensure we call gst_pad_check_link() with the two pads in the correct order. The order depends on wheter we iterate src or sink pads. Signed-off-by: Chen Rui --- gst/gstutils.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gst/gstutils.c b/gst/gstutils.c index 7986613c35..097daff1d0 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -1117,15 +1117,24 @@ gst_element_get_compatible_pad (GstElement * element, GstPad * pad, { GstPad *peer; GstPad *current; + GstPad *srcpad; + GstPad *sinkpad; current = GST_PAD (padptr); GST_CAT_LOG (GST_CAT_ELEMENT_PADS, "examining pad %s:%s", GST_DEBUG_PAD_NAME (current)); + if (GST_PAD_IS_SRC (current)) { + srcpad = current; + sinkpad = pad; + } else { + srcpad = pad; + sinkpad = current; + } peer = gst_pad_get_peer (current); - if (peer == NULL && gst_pad_check_link (pad, current)) { + if (peer == NULL && gst_pad_check_link (srcpad, sinkpad)) { GstCaps *temp, *intersection; gboolean compatible;