[Gstreamer-openmax] [PATCH] add some debug traces and asserts
Felipe Contreras
felipe.contreras at gmail.com
Sat Nov 14 05:08:16 PST 2009
On Wed, Nov 4, 2009 at 4:26 AM, Rob Clark <rob at ti.com> wrote:
>
> Signed-off-by: Rob Clark <rob at ti.com>
> ---
> omx/gstomx_base_filter.c | 18 ++++++++++++++++++
> omx/gstomx_util.c | 11 ++++++++---
> omx/gstomx_util.h | 8 ++++++++
> 3 files changed, 34 insertions(+), 3 deletions(-)
>
> diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
> index 35571ae..418915c 100644
> --- a/omx/gstomx_base_filter.c
> +++ b/omx/gstomx_base_filter.c
> @@ -70,6 +70,7 @@ setup_ports (GstOmxBaseFilter *self)
>
> if (g_getenv ("OMX_ALLOCATE_ON"))
> {
> + GST_DEBUG_OBJECT (self, "OMX_ALLOCATE_ON");
> self->in_port->omx_allocate = TRUE;
> self->out_port->omx_allocate = TRUE;
> self->share_input_buffer = FALSE;
> @@ -77,14 +78,25 @@ setup_ports (GstOmxBaseFilter *self)
> }
> else if (g_getenv ("OMX_SHARE_HACK_ON"))
> {
> + GST_DEBUG_OBJECT (self, "OMX_SHARE_HACK_ON");
> self->share_input_buffer = TRUE;
> self->share_output_buffer = TRUE;
> }
> else if (g_getenv ("OMX_SHARE_HACK_OFF"))
> {
> + GST_DEBUG_OBJECT (self, "OMX_SHARE_HACK_OFF");
> self->share_input_buffer = FALSE;
> self->share_output_buffer = FALSE;
> }
> + else
> + {
> + GST_DEBUG_OBJECT (self, "default sharing and allocation");
> + }
> +
> + GST_DEBUG_OBJECT (self, "in_port->omx_allocate=%d, out_port->omx_allocate=%d",
> + self->in_port->omx_allocate, self->out_port->omx_allocate);
> + GST_DEBUG_OBJECT (self, "share_input_buffer=%d, share_output_buffer=%d",
> + self->share_input_buffer, self->share_output_buffer);
I'd rather have these a bit more organized:
omx_allocate: in: yes, out: yes
share_buffer: in: yes, out: yes
Either: yes/no, true/false, on/off.
> }
>
> static GstStateChangeReturn
> @@ -324,6 +336,8 @@ push_buffer (GstOmxBaseFilter *self,
> {
> GstFlowReturn ret;
>
> + PRINT_BUFFER (self, buf);
Agh, I hate macros. Do we really want this? If so, can we make this an
inline function?
> /** @todo check if tainted */
> GST_LOG_OBJECT (self, "begin");
> ret = gst_pad_push (self->srcpad, buf);
> @@ -407,6 +421,8 @@ output_loop (gpointer data)
> /* buf is always null when the output buffer pointer isn't shared. */
> buf = omx_buffer->pAppPrivate;
>
> + PRINT_BUFFER (self, buf);
> +
> /** @todo we need to move all the caps handling to one single
> * place, in the output loop probably. */
> if (G_UNLIKELY (omx_buffer->nFlags & 0x80))
> @@ -571,6 +587,8 @@ pad_chain (GstPad *pad,
>
> self = GST_OMX_BASE_FILTER (GST_OBJECT_PARENT (pad));
>
> + PRINT_BUFFER (self, buf);
> +
> gomx = self->gomx;
>
> GST_LOG_OBJECT (self, "begin");
> diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
> index 1cd224f..2bd25b4 100644
> --- a/omx/gstomx_util.c
> +++ b/omx/gstomx_util.c
> @@ -358,14 +358,16 @@ g_omx_core_init (GOmxCore *core)
> core,
> &callbacks);
>
> + g_free (component_name);
> + g_free (library_name);
> +
> GST_DEBUG_OBJECT (core->object, "OMX_GetHandle(&%p) -> %d",
> core->omx_handle, core->omx_error);
>
> + g_return_if_fail (core->omx_handle);
> +
> if (!core->omx_error)
> core->omx_state = OMX_StateLoaded;
> -
> - g_free (component_name);
> - g_free (library_name);
> }
>
> void
> @@ -509,6 +511,7 @@ OMX_HANDLETYPE
> g_omx_core_get_handle (GOmxCore *core)
> {
> if (!core->omx_handle) g_omx_core_init (core);
> + g_return_val_if_fail (core->omx_handle, NULL);
> return core->omx_handle;
> }
These seem to depend on one of your previous patches.
> @@ -589,6 +592,7 @@ port_allocate_buffers (GOmxPort *port)
> {
> if (port->omx_allocate)
> {
> + GST_DEBUG_OBJECT (port->core->object, "%d: OMX_AllocateBuffer(), size=%d", i, size);
> OMX_AllocateBuffer (port->core->omx_handle,
> &port->buffers[i],
> port->port_index,
> @@ -599,6 +603,7 @@ port_allocate_buffers (GOmxPort *port)
> {
> gpointer buffer_data;
> buffer_data = g_malloc (size);
> + GST_DEBUG_OBJECT (port->core->object, "%d: OMX_UseBuffer(), size=%d", i, size);
> OMX_UseBuffer (port->core->omx_handle,
> &port->buffers[i],
> port->port_index,
> diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
> index be9290f..6627a49 100644
> --- a/omx/gstomx_util.h
> +++ b/omx/gstomx_util.h
> @@ -198,5 +198,13 @@ void g_omx_port_finish (GOmxPort *port);
> OMX_SetConfig ( \
> g_omx_core_get_handle ((port)->core), idx, (param))
>
> +#define PRINT_BUFFER(obj, buffer) G_STMT_START { \
> + if (buffer) { \
> + GST_DEBUG_OBJECT (obj, #buffer "=0x%08x (time=%"GST_TIME_FORMAT", duration=%"GST_TIME_FORMAT", flags=%08x)", (buffer), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)), GST_TIME_ARGS (GST_BUFFER_DURATION(buffer)), GST_BUFFER_FLAGS (buffer)); \
> + } else { \
> + GST_DEBUG_OBJECT (obj, #buffer "=null"); \
> + } \
> + } G_STMT_END
> +
Too unreadable.
> #endif /* GSTOMX_UTIL_H */
> --
> 1.6.3.2
--
Felipe Contreras
More information about the Gstreamer-openmax
mailing list