mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
committing many nice little memleaks fixes from Iain, great work dude
Original commit message from CVS: committing many nice little memleaks fixes from Iain, great work dude
This commit is contained in:
parent
d5d1387153
commit
b9b6c6890a
13 changed files with 75 additions and 20 deletions
|
@ -17,8 +17,9 @@ Requirements
|
||||||
|
|
||||||
user/system registry
|
user/system registry
|
||||||
--------------------
|
--------------------
|
||||||
|
There are two be two registries on the system. One system registry and one user registry.
|
||||||
first query the user registry, then fall back to system registry.
|
The user registry should be queried first, then if that doesn't exist or don't contain any
|
||||||
|
plugins able to handle the mediatype it should fall back to system registry.
|
||||||
|
|
||||||
model:
|
model:
|
||||||
------
|
------
|
||||||
|
|
|
@ -24,9 +24,15 @@ make_bin (gint count)
|
||||||
{
|
{
|
||||||
GstElement *bin;
|
GstElement *bin;
|
||||||
GstElement *src;
|
GstElement *src;
|
||||||
|
char *name;
|
||||||
|
|
||||||
bin = gst_bin_new (g_strdup_printf ("bin%d", count));
|
name = g_strdup_printf ("bin%d", count);
|
||||||
src = gst_element_factory_make ("fakesrc", g_strdup_printf ("fakesrc%d", count));
|
bin = gst_bin_new (name);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
|
name = g_strdup_printf ("fakesrc%d", count);
|
||||||
|
src = gst_element_factory_make ("fakesrc", name);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
gst_bin_add (GST_BIN (bin), src);
|
gst_bin_add (GST_BIN (bin), src);
|
||||||
|
|
||||||
|
|
|
@ -362,6 +362,7 @@ static void
|
||||||
gst_spider_identity_start_type_finding (GstSpiderIdentity *ident)
|
gst_spider_identity_start_type_finding (GstSpiderIdentity *ident)
|
||||||
{
|
{
|
||||||
GstElement* typefind;
|
GstElement* typefind;
|
||||||
|
gchar *name;
|
||||||
gboolean restart = FALSE;
|
gboolean restart = FALSE;
|
||||||
|
|
||||||
GST_DEBUG (GST_CAT_AUTOPLUG, "element %s starts typefinding", GST_ELEMENT_NAME(ident));
|
GST_DEBUG (GST_CAT_AUTOPLUG, "element %s starts typefinding", GST_ELEMENT_NAME(ident));
|
||||||
|
@ -372,7 +373,10 @@ gst_spider_identity_start_type_finding (GstSpiderIdentity *ident)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create and connect typefind object */
|
/* create and connect typefind object */
|
||||||
typefind = gst_element_factory_make ("typefind", g_strdup_printf("%s%s", "typefind", GST_ELEMENT_NAME(ident)));
|
name = g_strdup_printf ("%s%s", "typefind", GST_ELEMENT_NAME(ident));
|
||||||
|
typefind = gst_element_factory_make ("typefind", name);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (typefind), "have_type",
|
g_signal_connect (G_OBJECT (typefind), "have_type",
|
||||||
G_CALLBACK (callback_type_find_have_type), ident);
|
G_CALLBACK (callback_type_find_have_type), ident);
|
||||||
gst_bin_add (GST_BIN (GST_ELEMENT_PARENT (ident)), typefind);
|
gst_bin_add (GST_BIN (GST_ELEMENT_PARENT (ident)), typefind);
|
||||||
|
|
|
@ -201,7 +201,12 @@ autoplug_dynamic_pad (GstElement *element, GstPad *pad, gpointer data)
|
||||||
pads = g_list_next (pads);
|
pads = g_list_next (pads);
|
||||||
|
|
||||||
if (gst_caps_check_compatibility (GST_PAD_TEMPLATE_CAPS (templ), info->endcap)) {
|
if (gst_caps_check_compatibility (GST_PAD_TEMPLATE_CAPS (templ), info->endcap)) {
|
||||||
gst_element_add_ghost_pad (info->result, pad, g_strdup_printf("src_%02d", info->i));
|
gchar *name;
|
||||||
|
|
||||||
|
name = g_strdup_printf ("src_%02d", info->i);
|
||||||
|
gst_element_add_ghost_pad (info->result, pad, name);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
GST_DEBUG (0,"gstpipeline: new dynamic pad %s", GST_PAD_NAME (pad));
|
GST_DEBUG (0,"gstpipeline: new dynamic pad %s", GST_PAD_NAME (pad));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -460,7 +465,12 @@ differ:
|
||||||
pads = g_list_next (pads);
|
pads = g_list_next (pads);
|
||||||
|
|
||||||
if (gst_caps_check_compatibility (GST_PAD_TEMPLATE_CAPS (templ), endcap)) {
|
if (gst_caps_check_compatibility (GST_PAD_TEMPLATE_CAPS (templ), endcap)) {
|
||||||
gst_element_add_ghost_pad (result, pad, g_strdup_printf("src_%02d", i));
|
gchar *name;
|
||||||
|
|
||||||
|
name = g_strdup_printf ("src_%02d", i);
|
||||||
|
gst_element_add_ghost_pad (result, pad, name);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
have_pad = TRUE;
|
have_pad = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,6 +174,8 @@ gst_aggregator_request_new_pad (GstElement *element, GstPadTemplate *templ, cons
|
||||||
name = g_strdup_printf ("sink%d",aggregator->numsinkpads);
|
name = g_strdup_printf ("sink%d",aggregator->numsinkpads);
|
||||||
|
|
||||||
sinkpad = gst_pad_new_from_template (templ, name);
|
sinkpad = gst_pad_new_from_template (templ, name);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
gst_pad_set_chain_function (sinkpad, gst_aggregator_chain);
|
gst_pad_set_chain_function (sinkpad, gst_aggregator_chain);
|
||||||
gst_element_add_pad (GST_ELEMENT (aggregator), sinkpad);
|
gst_element_add_pad (GST_ELEMENT (aggregator), sinkpad);
|
||||||
|
|
||||||
|
|
|
@ -182,6 +182,8 @@ gst_fakesink_request_new_pad (GstElement *element, GstPadTemplate *templ, const
|
||||||
name = g_strdup_printf ("sink%d", GST_ELEMENT (fakesink)->numsinkpads);
|
name = g_strdup_printf ("sink%d", GST_ELEMENT (fakesink)->numsinkpads);
|
||||||
|
|
||||||
sinkpad = gst_pad_new_from_template (templ, name);
|
sinkpad = gst_pad_new_from_template (templ, name);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
gst_element_add_pad (GST_ELEMENT (fakesink), sinkpad);
|
gst_element_add_pad (GST_ELEMENT (fakesink), sinkpad);
|
||||||
|
|
||||||
return sinkpad;
|
return sinkpad;
|
||||||
|
|
|
@ -193,6 +193,7 @@ gst_identity_init (GstIdentity *identity)
|
||||||
identity->drop_probability = 0.0;
|
identity->drop_probability = 0.0;
|
||||||
identity->silent = FALSE;
|
identity->silent = FALSE;
|
||||||
identity->dump = FALSE;
|
identity->dump = FALSE;
|
||||||
|
identity->last_message = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -218,6 +219,9 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
|
||||||
|
|
||||||
if (identity->drop_probability > 0.0) {
|
if (identity->drop_probability > 0.0) {
|
||||||
if ((gfloat)(1.0*rand()/(RAND_MAX)) < identity->drop_probability) {
|
if ((gfloat)(1.0*rand()/(RAND_MAX)) < identity->drop_probability) {
|
||||||
|
if (identity->last_message != NULL) {
|
||||||
|
g_free (identity->last_message);
|
||||||
|
}
|
||||||
identity->last_message = g_strdup_printf ("dropping ******* (%s:%s)i (%d bytes, %llu)",
|
identity->last_message = g_strdup_printf ("dropping ******* (%s:%s)i (%d bytes, %llu)",
|
||||||
GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||||
g_object_notify (G_OBJECT (identity), "last-message");
|
g_object_notify (G_OBJECT (identity), "last-message");
|
||||||
|
@ -231,6 +235,9 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
|
||||||
|
|
||||||
for (i = identity->duplicate; i; i--) {
|
for (i = identity->duplicate; i; i--) {
|
||||||
if (!identity->silent)
|
if (!identity->silent)
|
||||||
|
if (identity->last_message != NULL) {
|
||||||
|
g_free (identity->last_message);
|
||||||
|
}
|
||||||
identity->last_message = g_strdup_printf ("chain ******* (%s:%s)i (%d bytes, %llu)",
|
identity->last_message = g_strdup_printf ("chain ******* (%s:%s)i (%d bytes, %llu)",
|
||||||
GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||||
g_object_notify (G_OBJECT (identity), "last-message");
|
g_object_notify (G_OBJECT (identity), "last-message");
|
||||||
|
|
|
@ -2339,6 +2339,7 @@ gst_element_save_thyself (GstObject *object,
|
||||||
spec = specs[i];
|
spec = specs[i];
|
||||||
if (spec->flags & G_PARAM_READABLE) {
|
if (spec->flags & G_PARAM_READABLE) {
|
||||||
xmlNodePtr param;
|
xmlNodePtr param;
|
||||||
|
char *contents;
|
||||||
|
|
||||||
g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE (spec));
|
g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE (spec));
|
||||||
|
|
||||||
|
@ -2347,15 +2348,16 @@ gst_element_save_thyself (GstObject *object,
|
||||||
xmlNewChild (param, NULL, "name", spec->name);
|
xmlNewChild (param, NULL, "name", spec->name);
|
||||||
|
|
||||||
if (G_IS_PARAM_SPEC_STRING (spec))
|
if (G_IS_PARAM_SPEC_STRING (spec))
|
||||||
xmlNewChild (param, NULL, "value", g_value_dup_string (&value));
|
contents = g_value_dup_string (&value);
|
||||||
else if (G_IS_PARAM_SPEC_ENUM (spec))
|
else if (G_IS_PARAM_SPEC_ENUM (spec))
|
||||||
xmlNewChild (param, NULL, "value",
|
contents = g_strdup_printf ("%d", g_value_get_enum (&value));
|
||||||
g_strdup_printf ("%d", g_value_get_enum (&value)));
|
|
||||||
else if (G_IS_PARAM_SPEC_INT64 (spec))
|
else if (G_IS_PARAM_SPEC_INT64 (spec))
|
||||||
xmlNewChild (param, NULL, "value",
|
contents = g_strdup_printf ("%lld", g_value_get_int64 (&value));
|
||||||
g_strdup_printf ("%lld", g_value_get_int64 (&value)));
|
|
||||||
else
|
else
|
||||||
xmlNewChild (param, NULL, "value", g_strdup_value_contents (&value));
|
contents = g_strdup_value_contents (&value);
|
||||||
|
|
||||||
|
xmlNewChild (param, NULL, "value", contents);
|
||||||
|
g_free (contents);
|
||||||
|
|
||||||
g_value_unset(&value);
|
g_value_unset(&value);
|
||||||
}
|
}
|
||||||
|
@ -2557,6 +2559,7 @@ gst_element_state_get_name (GstElementState state)
|
||||||
case GST_STATE_PLAYING: return "\033[01;32mPLAYING\033[00m";break;
|
case GST_STATE_PLAYING: return "\033[01;32mPLAYING\033[00m";break;
|
||||||
case GST_STATE_PAUSED: return "\033[01;33mPAUSED\033[00m";break;
|
case GST_STATE_PAUSED: return "\033[01;33mPAUSED\033[00m";break;
|
||||||
default:
|
default:
|
||||||
|
/* This is a memory leak */
|
||||||
return g_strdup_printf ("\033[01;37;41mUNKNOWN!\033[00m(%d)", state);
|
return g_strdup_printf ("\033[01;37;41mUNKNOWN!\033[00m(%d)", state);
|
||||||
#else
|
#else
|
||||||
case GST_STATE_VOID_PENDING: return "NONE_PENDING";break;
|
case GST_STATE_VOID_PENDING: return "NONE_PENDING";break;
|
||||||
|
|
|
@ -2001,13 +2001,16 @@ gst_pad_save_thyself (GstObject *object, xmlNodePtr parent)
|
||||||
|
|
||||||
xmlNewChild (parent, NULL, "name", GST_PAD_NAME (realpad));
|
xmlNewChild (parent, NULL, "name", GST_PAD_NAME (realpad));
|
||||||
if (GST_RPAD_PEER (realpad) != NULL) {
|
if (GST_RPAD_PEER (realpad) != NULL) {
|
||||||
|
gchar *content;
|
||||||
|
|
||||||
peer = GST_PAD (GST_RPAD_PEER (realpad));
|
peer = GST_PAD (GST_RPAD_PEER (realpad));
|
||||||
/* first check to see if the peer's parent's parent is the same */
|
/* first check to see if the peer's parent's parent is the same */
|
||||||
/* we just save it off */
|
/* we just save it off */
|
||||||
xmlNewChild (parent, NULL, "peer",
|
content = g_strdup_printf ("%s.%s",
|
||||||
g_strdup_printf ("%s.%s",
|
|
||||||
GST_OBJECT_NAME (GST_PAD_PARENT (peer)),
|
GST_OBJECT_NAME (GST_PAD_PARENT (peer)),
|
||||||
GST_PAD_NAME (peer)));
|
GST_PAD_NAME (peer));
|
||||||
|
xmlNewChild (parent, NULL, "peer", content);
|
||||||
|
g_free (content);
|
||||||
} else
|
} else
|
||||||
xmlNewChild (parent, NULL, "peer", "");
|
xmlNewChild (parent, NULL, "peer", "");
|
||||||
|
|
||||||
|
|
|
@ -174,6 +174,8 @@ gst_aggregator_request_new_pad (GstElement *element, GstPadTemplate *templ, cons
|
||||||
name = g_strdup_printf ("sink%d",aggregator->numsinkpads);
|
name = g_strdup_printf ("sink%d",aggregator->numsinkpads);
|
||||||
|
|
||||||
sinkpad = gst_pad_new_from_template (templ, name);
|
sinkpad = gst_pad_new_from_template (templ, name);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
gst_pad_set_chain_function (sinkpad, gst_aggregator_chain);
|
gst_pad_set_chain_function (sinkpad, gst_aggregator_chain);
|
||||||
gst_element_add_pad (GST_ELEMENT (aggregator), sinkpad);
|
gst_element_add_pad (GST_ELEMENT (aggregator), sinkpad);
|
||||||
|
|
||||||
|
|
|
@ -182,6 +182,8 @@ gst_fakesink_request_new_pad (GstElement *element, GstPadTemplate *templ, const
|
||||||
name = g_strdup_printf ("sink%d", GST_ELEMENT (fakesink)->numsinkpads);
|
name = g_strdup_printf ("sink%d", GST_ELEMENT (fakesink)->numsinkpads);
|
||||||
|
|
||||||
sinkpad = gst_pad_new_from_template (templ, name);
|
sinkpad = gst_pad_new_from_template (templ, name);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
gst_element_add_pad (GST_ELEMENT (fakesink), sinkpad);
|
gst_element_add_pad (GST_ELEMENT (fakesink), sinkpad);
|
||||||
|
|
||||||
return sinkpad;
|
return sinkpad;
|
||||||
|
|
|
@ -193,6 +193,7 @@ gst_identity_init (GstIdentity *identity)
|
||||||
identity->drop_probability = 0.0;
|
identity->drop_probability = 0.0;
|
||||||
identity->silent = FALSE;
|
identity->silent = FALSE;
|
||||||
identity->dump = FALSE;
|
identity->dump = FALSE;
|
||||||
|
identity->last_message = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -218,6 +219,9 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
|
||||||
|
|
||||||
if (identity->drop_probability > 0.0) {
|
if (identity->drop_probability > 0.0) {
|
||||||
if ((gfloat)(1.0*rand()/(RAND_MAX)) < identity->drop_probability) {
|
if ((gfloat)(1.0*rand()/(RAND_MAX)) < identity->drop_probability) {
|
||||||
|
if (identity->last_message != NULL) {
|
||||||
|
g_free (identity->last_message);
|
||||||
|
}
|
||||||
identity->last_message = g_strdup_printf ("dropping ******* (%s:%s)i (%d bytes, %llu)",
|
identity->last_message = g_strdup_printf ("dropping ******* (%s:%s)i (%d bytes, %llu)",
|
||||||
GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||||
g_object_notify (G_OBJECT (identity), "last-message");
|
g_object_notify (G_OBJECT (identity), "last-message");
|
||||||
|
@ -231,6 +235,9 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
|
||||||
|
|
||||||
for (i = identity->duplicate; i; i--) {
|
for (i = identity->duplicate; i; i--) {
|
||||||
if (!identity->silent)
|
if (!identity->silent)
|
||||||
|
if (identity->last_message != NULL) {
|
||||||
|
g_free (identity->last_message);
|
||||||
|
}
|
||||||
identity->last_message = g_strdup_printf ("chain ******* (%s:%s)i (%d bytes, %llu)",
|
identity->last_message = g_strdup_printf ("chain ******* (%s:%s)i (%d bytes, %llu)",
|
||||||
GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||||
g_object_notify (G_OBJECT (identity), "last-message");
|
g_object_notify (G_OBJECT (identity), "last-message");
|
||||||
|
|
|
@ -24,9 +24,15 @@ make_bin (gint count)
|
||||||
{
|
{
|
||||||
GstElement *bin;
|
GstElement *bin;
|
||||||
GstElement *src;
|
GstElement *src;
|
||||||
|
char *name;
|
||||||
|
|
||||||
bin = gst_bin_new (g_strdup_printf ("bin%d", count));
|
name = g_strdup_printf ("bin%d", count);
|
||||||
src = gst_element_factory_make ("fakesrc", g_strdup_printf ("fakesrc%d", count));
|
bin = gst_bin_new (name);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
|
name = g_strdup_printf ("fakesrc%d", count);
|
||||||
|
src = gst_element_factory_make ("fakesrc", name);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
gst_bin_add (GST_BIN (bin), src);
|
gst_bin_add (GST_BIN (bin), src);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue