2000-12-28 22:12:02 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
|
|
|
*
|
2005-09-07 13:22:16 +00:00
|
|
|
* gsttrace.c: Tracing functions (deprecated)
|
2000-01-30 09:03:00 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 20:44:48 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2000-01-30 09:03:00 +00:00
|
|
|
*/
|
2005-10-15 16:01:57 +00:00
|
|
|
|
2004-04-28 23:26:06 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2000-01-30 09:03:00 +00:00
|
|
|
#include <stdio.h>
|
2004-04-28 23:26:06 +00:00
|
|
|
#ifdef HAVE_UNISTD_H
|
2000-01-30 09:03:00 +00:00
|
|
|
#include <unistd.h>
|
2004-04-28 23:26:06 +00:00
|
|
|
#endif
|
2000-01-30 09:03:00 +00:00
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <string.h>
|
2011-04-09 22:54:20 +00:00
|
|
|
#include <errno.h>
|
2000-12-15 01:57:34 +00:00
|
|
|
|
2007-10-31 22:01:03 +00:00
|
|
|
#if defined (_MSC_VER) && _MSC_VER >= 1400
|
|
|
|
# include <io.h>
|
|
|
|
#endif
|
|
|
|
|
2000-12-28 22:12:02 +00:00
|
|
|
#include "gst_private.h"
|
2004-05-10 18:07:24 +00:00
|
|
|
#include "gstinfo.h"
|
2000-12-28 22:12:02 +00:00
|
|
|
|
2000-12-15 01:57:34 +00:00
|
|
|
#include "gsttrace.h"
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2012-01-22 00:42:34 +00:00
|
|
|
GMutex _gst_trace_mutex;
|
2009-06-23 11:44:50 +00:00
|
|
|
|
2012-01-27 16:50:42 +00:00
|
|
|
/* global flags */
|
|
|
|
static GstAllocTraceFlags _gst_trace_flags = GST_ALLOC_TRACE_NONE;
|
2001-12-04 22:12:50 +00:00
|
|
|
|
2012-01-27 16:50:42 +00:00
|
|
|
/* list of registered tracers */
|
|
|
|
static GList *_gst_alloc_tracers = NULL;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2012-01-27 16:50:42 +00:00
|
|
|
static void
|
|
|
|
_at_exit (void)
|
2001-12-04 22:12:50 +00:00
|
|
|
{
|
2012-01-27 16:50:42 +00:00
|
|
|
if (_gst_trace_flags)
|
|
|
|
_priv_gst_alloc_trace_dump ();
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2001-12-04 22:12:50 +00:00
|
|
|
void
|
2012-01-27 16:50:42 +00:00
|
|
|
_priv_gst_alloc_trace_initialize (void)
|
2001-12-04 22:12:50 +00:00
|
|
|
{
|
2012-01-27 16:50:42 +00:00
|
|
|
const gchar *trace;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2012-01-27 16:50:42 +00:00
|
|
|
trace = g_getenv ("GST_TRACE");
|
|
|
|
if (trace != NULL) {
|
2012-04-17 08:33:59 +00:00
|
|
|
const GDebugKey keys[] = {
|
|
|
|
{"live", GST_ALLOC_TRACE_LIVE},
|
|
|
|
{"mem-live", GST_ALLOC_TRACE_MEM_LIVE},
|
|
|
|
};
|
|
|
|
_gst_trace_flags = g_parse_debug_string (trace, keys, G_N_ELEMENTS (keys));
|
2012-01-27 16:50:42 +00:00
|
|
|
atexit (_at_exit);
|
2001-05-16 05:04:44 +00:00
|
|
|
}
|
|
|
|
|
2012-01-27 16:50:42 +00:00
|
|
|
g_mutex_init (&_gst_trace_mutex);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2001-12-04 22:12:50 +00:00
|
|
|
void
|
2012-01-27 16:50:42 +00:00
|
|
|
_priv_gst_alloc_trace_deinit (void)
|
2003-02-02 19:10:44 +00:00
|
|
|
{
|
2012-01-27 16:50:42 +00:00
|
|
|
g_mutex_clear (&_gst_trace_mutex);
|
2003-02-02 19:10:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-01-27 16:50:42 +00:00
|
|
|
* _priv_gst_alloc_trace_register:
|
2003-02-02 19:10:44 +00:00
|
|
|
* @name: the name of the new alloc trace object.
|
2012-01-27 16:50:42 +00:00
|
|
|
* @offset: the offset in the object where a GType an be found. -1 when the
|
|
|
|
* object has no gtype.
|
2003-02-02 19:10:44 +00:00
|
|
|
*
|
|
|
|
* Register an get a handle to a GstAllocTrace object that
|
|
|
|
* can be used to trace memory allocations.
|
|
|
|
*
|
|
|
|
* Returns: A handle to a GstAllocTrace.
|
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
GstAllocTrace *
|
2012-01-27 16:50:42 +00:00
|
|
|
_priv_gst_alloc_trace_register (const gchar * name, goffset offset)
|
2003-02-02 19:10:44 +00:00
|
|
|
{
|
|
|
|
GstAllocTrace *trace;
|
|
|
|
|
|
|
|
g_return_val_if_fail (name, NULL);
|
|
|
|
|
2010-03-28 16:05:36 +00:00
|
|
|
trace = g_slice_new (GstAllocTrace);
|
2003-02-02 19:10:44 +00:00
|
|
|
trace->name = g_strdup (name);
|
|
|
|
trace->live = 0;
|
|
|
|
trace->mem_live = NULL;
|
|
|
|
trace->flags = _gst_trace_flags;
|
2012-01-27 16:50:42 +00:00
|
|
|
trace->offset = offset;
|
2003-02-02 19:10:44 +00:00
|
|
|
|
|
|
|
_gst_alloc_tracers = g_list_prepend (_gst_alloc_tracers, trace);
|
|
|
|
|
|
|
|
return trace;
|
|
|
|
}
|
|
|
|
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
static gint
|
|
|
|
compare_func (GstAllocTrace * a, GstAllocTrace * b)
|
|
|
|
{
|
|
|
|
return strcmp (a->name, b->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GList *
|
|
|
|
gst_alloc_trace_list_sorted (void)
|
|
|
|
{
|
|
|
|
GList *ret;
|
|
|
|
|
|
|
|
ret = g_list_sort (g_list_copy (_gst_alloc_tracers),
|
|
|
|
(GCompareFunc) compare_func);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-01-27 16:50:42 +00:00
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_alloc_trace_print (const GstAllocTrace * trace)
|
2003-02-02 19:10:44 +00:00
|
|
|
{
|
|
|
|
GSList *mem_live;
|
|
|
|
|
|
|
|
g_return_if_fail (trace != NULL);
|
|
|
|
|
|
|
|
if (trace->flags & GST_ALLOC_TRACE_LIVE) {
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
g_print ("%-22.22s : %d\n", trace->name, trace->live);
|
|
|
|
} else {
|
|
|
|
g_print ("%-22.22s : (no live count)\n", trace->name);
|
2003-02-02 19:10:44 +00:00
|
|
|
}
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
|
2003-02-02 19:10:44 +00:00
|
|
|
if (trace->flags & GST_ALLOC_TRACE_MEM_LIVE) {
|
|
|
|
mem_live = trace->mem_live;
|
|
|
|
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
while (mem_live) {
|
2009-12-23 20:37:51 +00:00
|
|
|
gpointer data = mem_live->data;
|
2012-01-27 16:50:42 +00:00
|
|
|
const gchar *type_name;
|
2012-02-02 15:59:12 +00:00
|
|
|
gchar *extra = NULL;
|
2012-03-27 13:00:38 +00:00
|
|
|
gint refcount = -1;
|
2009-12-23 20:37:51 +00:00
|
|
|
|
2012-02-02 14:55:44 +00:00
|
|
|
if (trace->offset == -2) {
|
2012-03-27 13:00:38 +00:00
|
|
|
if (G_IS_OBJECT (data)) {
|
2012-02-02 14:55:44 +00:00
|
|
|
type_name = G_OBJECT_TYPE_NAME (data);
|
2012-03-27 13:00:38 +00:00
|
|
|
refcount = G_OBJECT (data)->ref_count;
|
|
|
|
} else
|
2012-02-02 14:55:44 +00:00
|
|
|
type_name = "<invalid>";
|
|
|
|
} else if (trace->offset == -1) {
|
|
|
|
type_name = "<unknown>";
|
|
|
|
} else {
|
2012-01-27 16:50:42 +00:00
|
|
|
GType type;
|
|
|
|
|
|
|
|
type = G_STRUCT_MEMBER (GType, data, trace->offset);
|
|
|
|
type_name = g_type_name (type);
|
2012-02-02 15:59:12 +00:00
|
|
|
|
2012-03-27 13:00:38 +00:00
|
|
|
if (type == GST_TYPE_CAPS) {
|
2012-02-02 15:59:12 +00:00
|
|
|
extra = gst_caps_to_string (data);
|
2015-10-16 11:00:50 +00:00
|
|
|
} else if (type == GST_TYPE_EVENT) {
|
|
|
|
const GstStructure *s = gst_event_get_structure (data);
|
|
|
|
|
|
|
|
if (s == NULL)
|
|
|
|
extra = g_strdup_printf ("%s", GST_EVENT_TYPE_NAME (data));
|
|
|
|
else
|
|
|
|
extra = gst_structure_to_string (s);
|
|
|
|
} else if (type == GST_TYPE_MESSAGE) {
|
|
|
|
const GstStructure *s = gst_message_get_structure (data);
|
|
|
|
|
|
|
|
if (s == NULL)
|
|
|
|
extra = g_strdup_printf ("%s", GST_MESSAGE_TYPE_NAME (data));
|
|
|
|
else
|
|
|
|
extra = gst_structure_to_string (s);
|
2016-03-23 10:31:46 +00:00
|
|
|
} else if (type == GST_TYPE_BUFFER) {
|
|
|
|
guint size = gst_buffer_get_size (data);
|
|
|
|
|
|
|
|
extra = g_strdup_printf ("%u bytes", size);
|
|
|
|
} else if (type == GST_TYPE_MEMORY) {
|
|
|
|
GstMemory *mem = (GstMemory *) data;
|
|
|
|
|
|
|
|
extra = g_strdup_printf ("%u bytes, %s allocator", (guint) mem->size,
|
|
|
|
mem->allocator ? mem->allocator->mem_type : "unknown");
|
2012-03-27 13:00:38 +00:00
|
|
|
}
|
2012-06-14 14:27:26 +00:00
|
|
|
refcount = GST_MINI_OBJECT_REFCOUNT_VALUE (data);
|
2009-12-23 20:37:51 +00:00
|
|
|
}
|
2012-01-27 16:50:42 +00:00
|
|
|
|
2012-02-02 15:59:12 +00:00
|
|
|
if (extra) {
|
2012-03-27 13:00:38 +00:00
|
|
|
g_print (" %-20.20s : (%d) %p (\"%s\")\n", type_name, refcount, data,
|
|
|
|
extra);
|
2012-02-02 15:59:12 +00:00
|
|
|
g_free (extra);
|
|
|
|
} else
|
2012-03-27 13:00:38 +00:00
|
|
|
g_print (" %-20.20s : (%d) %p\n", type_name, refcount, data);
|
2012-01-27 16:50:42 +00:00
|
|
|
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
mem_live = mem_live->next;
|
2003-02-02 19:10:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-01-27 16:50:42 +00:00
|
|
|
* _priv_gst_alloc_trace_dump:
|
2003-02-02 19:10:44 +00:00
|
|
|
*
|
2012-01-27 16:50:42 +00:00
|
|
|
* Print the status of all registered alloc trace objects.
|
2003-02-02 19:10:44 +00:00
|
|
|
*/
|
|
|
|
void
|
2012-01-27 16:50:42 +00:00
|
|
|
_priv_gst_alloc_trace_dump (void)
|
2003-02-02 19:10:44 +00:00
|
|
|
{
|
2012-01-27 16:50:42 +00:00
|
|
|
GList *orig, *walk;
|
|
|
|
|
|
|
|
orig = walk = gst_alloc_trace_list_sorted ();
|
|
|
|
|
|
|
|
while (walk) {
|
|
|
|
GstAllocTrace *trace = (GstAllocTrace *) walk->data;
|
2003-02-02 19:10:44 +00:00
|
|
|
|
2012-01-27 16:50:42 +00:00
|
|
|
gst_alloc_trace_print (trace);
|
|
|
|
|
|
|
|
walk = g_list_next (walk);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (orig);
|
2003-02-02 19:10:44 +00:00
|
|
|
}
|