diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2009-12-23 15:46:25 +0100 |
---|---|---|
committer | Wim Taymans <wim@metal.(none)> | 2009-12-23 15:46:25 +0100 |
commit | d4e1ff012d285d055598a4b66570c6a33c08dcaa (patch) | |
tree | 42121756e59d6bd3da5d6a7fbdc9e17b3ac1ca9b | |
parent | 138c85117356ad7a558595d168c937461985cad1 (diff) |
uridecodebin: avoid leaking queue and typefind
Don't leak the queue and typefind elements that we might link after the
source element.
-rw-r--r-- | gst/playback/gsturidecodebin.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gst/playback/gsturidecodebin.c b/gst/playback/gsturidecodebin.c index d9f71155..28b98502 100644 --- a/gst/playback/gsturidecodebin.c +++ b/gst/playback/gsturidecodebin.c @@ -86,6 +86,7 @@ struct _GstURIDecodeBin gboolean use_buffering; GstElement *source; + GstElement *queue; GstElement *typefind; guint have_type_id; /* have-type signal id from typefind */ GSList *decodebins; @@ -1084,6 +1085,9 @@ analyse_source (GstURIDecodeBin * decoder, gboolean * is_raw, gst_object_unref (sinkpad); gst_object_unref (pad); + /* save queue pointer so we can remove it later */ + decoder->queue = outelem; + /* get the new raw srcpad */ pad = gst_element_get_static_pad (outelem, "src"); } else { @@ -1482,10 +1486,12 @@ could_not_link: { GST_ELEMENT_ERROR (decoder, CORE, NEGOTIATION, (NULL), ("Can't link source to typefind element")); + gst_bin_remove (GST_BIN_CAST (decoder), typefind); return FALSE; } } +/* remove source and all related elements */ static void remove_source (GstURIDecodeBin * bin) { @@ -1506,6 +1512,18 @@ remove_source (GstURIDecodeBin * bin) } bin->source = NULL; } + if (bin->queue) { + GST_DEBUG_OBJECT (bin, "removing old queue element"); + gst_element_set_state (bin->queue, GST_STATE_NULL); + gst_bin_remove (GST_BIN_CAST (bin), bin->queue); + bin->queue = NULL; + } + if (bin->typefind) { + GST_DEBUG_OBJECT (bin, "removing old typefind element"); + gst_element_set_state (bin->typefind, GST_STATE_NULL); + gst_bin_remove (GST_BIN_CAST (bin), bin->typefind); + bin->typefind = NULL; + } } /* is called when a dynamic source element created a new pad. */ |