mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 15:51:11 +00:00
uridecodebin: avoid leaking queue and typefind
Don't leak the queue and typefind elements that we might link after the source element.
This commit is contained in:
parent
138c851173
commit
d4e1ff012d
1 changed files with 18 additions and 0 deletions
|
@ -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. */
|
||||
|
|
Loading…
Reference in a new issue