utils: return real error in compatible link check
authorChen Rui <rui.chen@tieto.com>
Wed, 26 Jan 2011 08:46:25 +0000 (16:46 +0800)
committerStefan Kost <ensonic@users.sf.net>
Mon, 14 Feb 2011 20:45:50 +0000 (22:45 +0200)
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 <rui.chen@tieto.com>
gst/gstutils.c

index 7986613..097daff 100644 (file)
@@ -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;