mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
gst/: Leak fixes, the fold functions need to unref the passed object and _get_parent_*() returns ref to parent.
Original commit message from CVS: * gst/elements/gsttee.c: (gst_tee_init), (gst_tee_do_push): * gst/gstutils.c: (intersect_caps_func), (gst_pad_proxy_getcaps), (link_fold_func), (gst_pad_proxy_setcaps): Leak fixes, the fold functions need to unref the passed object and _get_parent_*() returns ref to parent.
This commit is contained in:
parent
7d1cb339da
commit
590a0cfb57
4 changed files with 44 additions and 12 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2005-09-27 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* gst/elements/gsttee.c: (gst_tee_init), (gst_tee_do_push):
|
||||||
|
* gst/gstutils.c: (intersect_caps_func), (gst_pad_proxy_getcaps),
|
||||||
|
(link_fold_func), (gst_pad_proxy_setcaps):
|
||||||
|
Leak fixes, the fold functions need to unref the passed object and
|
||||||
|
_get_parent_*() returns ref to parent.
|
||||||
|
|
||||||
2005-09-27 Tim-Philipp Müller <tim at centricular dot net>
|
2005-09-27 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* check/gst/gstbuffer.c: (test_make_writable):
|
* check/gst/gstbuffer.c: (test_make_writable):
|
||||||
|
|
|
@ -142,11 +142,11 @@ gst_tee_init (GstTee * tee, GstTeeClass * g_class)
|
||||||
tee->sinkpad =
|
tee->sinkpad =
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate),
|
gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate),
|
||||||
"sink");
|
"sink");
|
||||||
gst_element_add_pad (GST_ELEMENT (tee), tee->sinkpad);
|
|
||||||
gst_pad_set_setcaps_function (tee->sinkpad,
|
gst_pad_set_setcaps_function (tee->sinkpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_pad_proxy_setcaps));
|
GST_DEBUG_FUNCPTR (gst_pad_proxy_setcaps));
|
||||||
gst_pad_set_getcaps_function (tee->sinkpad,
|
gst_pad_set_getcaps_function (tee->sinkpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
|
GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
|
||||||
|
gst_element_add_pad (GST_ELEMENT (tee), tee->sinkpad);
|
||||||
|
|
||||||
tee->last_message = NULL;
|
tee->last_message = NULL;
|
||||||
}
|
}
|
||||||
|
@ -276,6 +276,8 @@ gst_tee_do_push (GstPad * pad, GValue * ret, PushData * data)
|
||||||
|
|
||||||
res = gst_pad_push (pad, gst_buffer_ref (data->buffer));
|
res = gst_pad_push (pad, gst_buffer_ref (data->buffer));
|
||||||
g_value_set_enum (ret, res);
|
g_value_set_enum (ret, res);
|
||||||
|
gst_object_unref (pad);
|
||||||
|
|
||||||
return (res == GST_FLOW_OK);
|
return (res == GST_FLOW_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2212,6 +2212,7 @@ intersect_caps_func (GstPad * pad, GValue * ret, GstPad * orig)
|
||||||
gst_caps_unref (existing);
|
gst_caps_unref (existing);
|
||||||
gst_caps_unref (peercaps);
|
gst_caps_unref (peercaps);
|
||||||
}
|
}
|
||||||
|
gst_object_unref (pad);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2254,11 +2255,10 @@ gst_pad_proxy_getcaps (GstPad * pad)
|
||||||
&ret, pad);
|
&ret, pad);
|
||||||
gst_iterator_free (iter);
|
gst_iterator_free (iter);
|
||||||
|
|
||||||
if (res != GST_ITERATOR_DONE) {
|
if (res != GST_ITERATOR_DONE)
|
||||||
g_warning ("Pad list changed during capsnego for element %s",
|
goto pads_changed;
|
||||||
GST_ELEMENT_NAME (element));
|
|
||||||
return NULL;
|
gst_object_unref (element);
|
||||||
}
|
|
||||||
|
|
||||||
caps = g_value_get_pointer (&ret);
|
caps = g_value_get_pointer (&ret);
|
||||||
g_value_unset (&ret);
|
g_value_unset (&ret);
|
||||||
|
@ -2267,6 +2267,15 @@ gst_pad_proxy_getcaps (GstPad * pad)
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
return intersected;
|
return intersected;
|
||||||
|
|
||||||
|
/* ERRORS */
|
||||||
|
pads_changed:
|
||||||
|
{
|
||||||
|
g_warning ("Pad list changed during capsnego for element %s",
|
||||||
|
GST_ELEMENT_NAME (element));
|
||||||
|
gst_object_unref (element);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -2284,6 +2293,7 @@ link_fold_func (GstPad * pad, GValue * ret, LinkData * data)
|
||||||
success = gst_pad_set_caps (pad, data->caps);
|
success = gst_pad_set_caps (pad, data->caps);
|
||||||
g_value_set_boolean (ret, success);
|
g_value_set_boolean (ret, success);
|
||||||
}
|
}
|
||||||
|
gst_object_unref (pad);
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
@ -2314,6 +2324,8 @@ gst_pad_proxy_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
GST_DEBUG ("proxying pad link for %s:%s", GST_DEBUG_PAD_NAME (pad));
|
GST_DEBUG ("proxying pad link for %s:%s", GST_DEBUG_PAD_NAME (pad));
|
||||||
|
|
||||||
element = gst_pad_get_parent_element (pad);
|
element = gst_pad_get_parent_element (pad);
|
||||||
|
if (element == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
iter = gst_element_iterate_pads (element);
|
iter = gst_element_iterate_pads (element);
|
||||||
|
|
||||||
|
@ -2326,14 +2338,22 @@ gst_pad_proxy_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
&ret, &data);
|
&ret, &data);
|
||||||
gst_iterator_free (iter);
|
gst_iterator_free (iter);
|
||||||
|
|
||||||
if (res != GST_ITERATOR_DONE) {
|
if (res != GST_ITERATOR_DONE)
|
||||||
g_warning ("Pad list changed during proxy_pad_link for element %s",
|
goto pads_changed;
|
||||||
GST_ELEMENT_NAME (element));
|
|
||||||
return FALSE;
|
gst_object_unref (element);
|
||||||
}
|
|
||||||
|
|
||||||
/* ok not to unset the gvalue */
|
/* ok not to unset the gvalue */
|
||||||
return g_value_get_boolean (&ret);
|
return g_value_get_boolean (&ret);
|
||||||
|
|
||||||
|
/* ERRORS */
|
||||||
|
pads_changed:
|
||||||
|
{
|
||||||
|
g_warning ("Pad list changed during proxy_pad_link for element %s",
|
||||||
|
GST_ELEMENT_NAME (element));
|
||||||
|
gst_object_unref (element);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -142,11 +142,11 @@ gst_tee_init (GstTee * tee, GstTeeClass * g_class)
|
||||||
tee->sinkpad =
|
tee->sinkpad =
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate),
|
gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate),
|
||||||
"sink");
|
"sink");
|
||||||
gst_element_add_pad (GST_ELEMENT (tee), tee->sinkpad);
|
|
||||||
gst_pad_set_setcaps_function (tee->sinkpad,
|
gst_pad_set_setcaps_function (tee->sinkpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_pad_proxy_setcaps));
|
GST_DEBUG_FUNCPTR (gst_pad_proxy_setcaps));
|
||||||
gst_pad_set_getcaps_function (tee->sinkpad,
|
gst_pad_set_getcaps_function (tee->sinkpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
|
GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
|
||||||
|
gst_element_add_pad (GST_ELEMENT (tee), tee->sinkpad);
|
||||||
|
|
||||||
tee->last_message = NULL;
|
tee->last_message = NULL;
|
||||||
}
|
}
|
||||||
|
@ -276,6 +276,8 @@ gst_tee_do_push (GstPad * pad, GValue * ret, PushData * data)
|
||||||
|
|
||||||
res = gst_pad_push (pad, gst_buffer_ref (data->buffer));
|
res = gst_pad_push (pad, gst_buffer_ref (data->buffer));
|
||||||
g_value_set_enum (ret, res);
|
g_value_set_enum (ret, res);
|
||||||
|
gst_object_unref (pad);
|
||||||
|
|
||||||
return (res == GST_FLOW_OK);
|
return (res == GST_FLOW_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue