From be34d4c78ef9f31f5c7e3a58a546855e7e30dfae Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Thu, 19 Jan 2012 16:32:37 +0100 Subject: [PATCH] playsink: verify linking to overlay element --- gst/playback/gstplaysink.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c index a757b2d..d02ec60 100644 --- a/gst/playback/gstplaysink.c +++ b/gst/playback/gstplaysink.c @@ -1603,10 +1603,18 @@ gen_text_chain (GstPlaySink * playsink) "max-size-bytes", 0, "max-size-time", (gint64) 0, "silent", TRUE, NULL); gst_bin_add (bin, element); - gst_element_link_pads_full (element, "src", chain->overlay, - "subtitle_sink", GST_PAD_LINK_CHECK_TEMPLATE_CAPS); - textsinkpad = gst_element_get_static_pad (element, "sink"); - srcpad = gst_element_get_static_pad (chain->overlay, "src"); + if (gst_element_link_pads_full (element, "src", chain->overlay, + "subtitle_sink", GST_PAD_LINK_CHECK_TEMPLATE_CAPS)) { + textsinkpad = gst_element_get_static_pad (element, "sink"); + srcpad = gst_element_get_static_pad (chain->overlay, "src"); + } else { + gst_bin_remove (bin, chain->sink); + gst_bin_remove (bin, chain->overlay); + chain->sink = NULL; + chain->overlay = NULL; + gst_object_unref (videosinkpad); + videosinkpad = NULL; + } } } } -- 2.7.4