From 2b84b328b1cac2c083fb322f4abb91bf439fb944 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Fri, 7 Oct 2011 11:16:44 +0000 Subject: [PATCH] playsink: handle NULL ghost pad target For the src pad anyway. https://bugzilla.gnome.org/show_bug.cgi?id=661262 --- gst/playback/gstplaysinkaudioconvert.c | 22 ++++++++++++++++------ gst/playback/gstplaysinkvideoconvert.c | 21 ++++++++++++++++----- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/gst/playback/gstplaysinkaudioconvert.c b/gst/playback/gstplaysinkaudioconvert.c index 2c28c6eca0..d31898d723 100644 --- a/gst/playback/gstplaysinkaudioconvert.c +++ b/gst/playback/gstplaysinkaudioconvert.c @@ -352,17 +352,27 @@ gst_play_sink_audio_convert_getcaps (GstPad * pad) GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self); otherpad = gst_ghost_pad_get_target (GST_GHOST_PAD_CAST (pad)); + if (!otherpad) { + if (pad == self->srcpad) { + otherpad = self->sink_proxypad; + } + /* no equivalent for the sink pad */ + } GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self); - peer = gst_pad_get_peer (otherpad); - if (peer) { - ret = gst_pad_get_caps_reffed (peer); - gst_object_unref (peer); + if (otherpad) { + peer = gst_pad_get_peer (otherpad); + if (peer) { + ret = gst_pad_get_caps_reffed (peer); + gst_object_unref (peer); + } else { + ret = gst_caps_new_any (); + } + gst_object_unref (otherpad); } else { + GST_WARNING_OBJECT (self, "Could not traverse bin"); ret = gst_caps_new_any (); } - - gst_object_unref (otherpad); gst_object_unref (self); return ret; diff --git a/gst/playback/gstplaysinkvideoconvert.c b/gst/playback/gstplaysinkvideoconvert.c index 8b22a644e6..d003545e7b 100644 --- a/gst/playback/gstplaysinkvideoconvert.c +++ b/gst/playback/gstplaysinkvideoconvert.c @@ -332,17 +332,28 @@ gst_play_sink_video_convert_getcaps (GstPad * pad) GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self); otherpad = gst_ghost_pad_get_target (GST_GHOST_PAD_CAST (pad)); + if (!otherpad) { + if (pad == self->srcpad) { + otherpad = self->sink_proxypad; + } + /* no equivalent for the sink pad */ + } GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self); - peer = gst_pad_get_peer (otherpad); - if (peer) { - ret = gst_pad_get_caps_reffed (peer); - gst_object_unref (peer); + if (otherpad) { + peer = gst_pad_get_peer (otherpad); + if (peer) { + ret = gst_pad_get_caps_reffed (peer); + gst_object_unref (peer); + } else { + ret = gst_caps_new_any (); + } + gst_object_unref (otherpad); } else { + GST_WARNING_OBJECT (self, "Could not traverse bin"); ret = gst_caps_new_any (); } - gst_object_unref (otherpad); gst_object_unref (self); return ret;