mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
*decodebin*: don't leak pad templates set on ghostpads
https://bugzilla.gnome.org/show_bug.cgi?id=635067
This commit is contained in:
parent
8f039997f0
commit
7c5e39664e
3 changed files with 20 additions and 7 deletions
|
@ -392,6 +392,7 @@ gst_decode_bin_init (GstDecodeBin * decode_bin)
|
||||||
g_warning ("can't find typefind element, decodebin will not work");
|
g_warning ("can't find typefind element, decodebin will not work");
|
||||||
} else {
|
} else {
|
||||||
GstPad *pad, *gpad;
|
GstPad *pad, *gpad;
|
||||||
|
GstPadTemplate *pad_tmpl;
|
||||||
|
|
||||||
/* add the typefind element */
|
/* add the typefind element */
|
||||||
if (!gst_bin_add (GST_BIN (decode_bin), decode_bin->typefind)) {
|
if (!gst_bin_add (GST_BIN (decode_bin), decode_bin->typefind)) {
|
||||||
|
@ -403,12 +404,15 @@ gst_decode_bin_init (GstDecodeBin * decode_bin)
|
||||||
/* get the sinkpad */
|
/* get the sinkpad */
|
||||||
pad = gst_element_get_static_pad (decode_bin->typefind, "sink");
|
pad = gst_element_get_static_pad (decode_bin->typefind, "sink");
|
||||||
|
|
||||||
|
/* get the pad template */
|
||||||
|
pad_tmpl = gst_static_pad_template_get (&decoder_bin_sink_template);
|
||||||
|
|
||||||
/* ghost the sink pad to ourself */
|
/* ghost the sink pad to ourself */
|
||||||
gpad = gst_ghost_pad_new_from_template ("sink", pad,
|
gpad = gst_ghost_pad_new_from_template ("sink", pad, pad_tmpl);
|
||||||
gst_static_pad_template_get (&decoder_bin_sink_template));
|
|
||||||
gst_pad_set_active (gpad, TRUE);
|
gst_pad_set_active (gpad, TRUE);
|
||||||
gst_element_add_pad (GST_ELEMENT (decode_bin), gpad);
|
gst_element_add_pad (GST_ELEMENT (decode_bin), gpad);
|
||||||
|
|
||||||
|
gst_object_unref (pad_tmpl);
|
||||||
gst_object_unref (pad);
|
gst_object_unref (pad);
|
||||||
|
|
||||||
/* connect a signal to find out when the typefind element found
|
/* connect a signal to find out when the typefind element found
|
||||||
|
|
|
@ -919,6 +919,7 @@ gst_decode_bin_init (GstDecodeBin * decode_bin)
|
||||||
} else {
|
} else {
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
GstPad *gpad;
|
GstPad *gpad;
|
||||||
|
GstPadTemplate *pad_tmpl;
|
||||||
|
|
||||||
/* add the typefind element */
|
/* add the typefind element */
|
||||||
if (!gst_bin_add (GST_BIN (decode_bin), decode_bin->typefind)) {
|
if (!gst_bin_add (GST_BIN (decode_bin), decode_bin->typefind)) {
|
||||||
|
@ -930,12 +931,15 @@ gst_decode_bin_init (GstDecodeBin * decode_bin)
|
||||||
/* get the sinkpad */
|
/* get the sinkpad */
|
||||||
pad = gst_element_get_static_pad (decode_bin->typefind, "sink");
|
pad = gst_element_get_static_pad (decode_bin->typefind, "sink");
|
||||||
|
|
||||||
|
/* get the pad template */
|
||||||
|
pad_tmpl = gst_static_pad_template_get (&decoder_bin_sink_template);
|
||||||
|
|
||||||
/* ghost the sink pad to ourself */
|
/* ghost the sink pad to ourself */
|
||||||
gpad = gst_ghost_pad_new_from_template ("sink", pad,
|
gpad = gst_ghost_pad_new_from_template ("sink", pad, pad_tmpl);
|
||||||
gst_static_pad_template_get (&decoder_bin_sink_template));
|
|
||||||
gst_pad_set_active (gpad, TRUE);
|
gst_pad_set_active (gpad, TRUE);
|
||||||
gst_element_add_pad (GST_ELEMENT (decode_bin), gpad);
|
gst_element_add_pad (GST_ELEMENT (decode_bin), gpad);
|
||||||
|
|
||||||
|
gst_object_unref (pad_tmpl);
|
||||||
gst_object_unref (pad);
|
gst_object_unref (pad);
|
||||||
|
|
||||||
/* connect a signal to find out when the typefind element found
|
/* connect a signal to find out when the typefind element found
|
||||||
|
@ -3406,16 +3410,19 @@ static GstDecodePad *
|
||||||
gst_decode_pad_new (GstDecodeBin * dbin, GstPad * pad, GstDecodeChain * chain)
|
gst_decode_pad_new (GstDecodeBin * dbin, GstPad * pad, GstDecodeChain * chain)
|
||||||
{
|
{
|
||||||
GstDecodePad *dpad;
|
GstDecodePad *dpad;
|
||||||
|
GstPadTemplate *pad_tmpl;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (dbin, "making new decodepad");
|
GST_DEBUG_OBJECT (dbin, "making new decodepad");
|
||||||
|
pad_tmpl = gst_static_pad_template_get (&decoder_bin_src_template);
|
||||||
dpad =
|
dpad =
|
||||||
g_object_new (GST_TYPE_DECODE_PAD, "direction", GST_PAD_DIRECTION (pad),
|
g_object_new (GST_TYPE_DECODE_PAD, "direction", GST_PAD_DIRECTION (pad),
|
||||||
"template", gst_static_pad_template_get (&decoder_bin_src_template),
|
"template", pad_tmpl,
|
||||||
NULL);
|
NULL);
|
||||||
gst_ghost_pad_construct (GST_GHOST_PAD_CAST (dpad));
|
gst_ghost_pad_construct (GST_GHOST_PAD_CAST (dpad));
|
||||||
gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (dpad), pad);
|
gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (dpad), pad);
|
||||||
dpad->chain = chain;
|
dpad->chain = chain;
|
||||||
dpad->dbin = dbin;
|
dpad->dbin = dbin;
|
||||||
|
gst_object_unref (pad_tmpl);
|
||||||
|
|
||||||
return dpad;
|
return dpad;
|
||||||
}
|
}
|
||||||
|
|
|
@ -832,6 +832,7 @@ new_decoded_pad_cb (GstElement * element, GstPad * pad, gboolean last,
|
||||||
GstURIDecodeBin * decoder)
|
GstURIDecodeBin * decoder)
|
||||||
{
|
{
|
||||||
GstPad *newpad;
|
GstPad *newpad;
|
||||||
|
GstPadTemplate *pad_tmpl;
|
||||||
gchar *padname;
|
gchar *padname;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (element, "new decoded pad, name: <%s>. Last: %d",
|
GST_DEBUG_OBJECT (element, "new decoded pad, name: <%s>. Last: %d",
|
||||||
|
@ -842,8 +843,9 @@ new_decoded_pad_cb (GstElement * element, GstPad * pad, gboolean last,
|
||||||
decoder->numpads++;
|
decoder->numpads++;
|
||||||
GST_URI_DECODE_BIN_UNLOCK (decoder);
|
GST_URI_DECODE_BIN_UNLOCK (decoder);
|
||||||
|
|
||||||
newpad = gst_ghost_pad_new_from_template (padname, pad,
|
pad_tmpl = gst_static_pad_template_get (&srctemplate);
|
||||||
gst_static_pad_template_get (&srctemplate));
|
newpad = gst_ghost_pad_new_from_template (padname, pad, pad_tmpl);
|
||||||
|
gst_object_unref (pad_tmpl);
|
||||||
g_free (padname);
|
g_free (padname);
|
||||||
|
|
||||||
/* store ref to the ghostpad so we can remove it */
|
/* store ref to the ghostpad so we can remove it */
|
||||||
|
|
Loading…
Reference in a new issue