bufferpool: add more debug info

This commit is contained in:
Wim Taymans 2011-03-04 12:06:11 +01:00
parent 52a3fa9346
commit b11ede5984
2 changed files with 16 additions and 2 deletions

View file

@ -298,6 +298,7 @@ _gst_buffer_dispose (GstBuffer * buffer)
/* keep the buffer alive */ /* keep the buffer alive */
gst_buffer_ref (buffer); gst_buffer_ref (buffer);
/* return the buffer to the pool */ /* return the buffer to the pool */
GST_CAT_LOG (GST_CAT_BUFFER, "release %p to pool %p", buffer, pool);
gst_buffer_pool_release_buffer (pool, buffer); gst_buffer_pool_release_buffer (pool, buffer);
} }
} }
@ -844,7 +845,8 @@ gst_buffer_add_meta (GstBuffer * buffer, const GstMetaInfo * info,
g_return_val_if_fail (info != NULL, NULL); g_return_val_if_fail (info != NULL, NULL);
/* create a new slice */ /* create a new slice */
GST_DEBUG ("alloc metadata of size %" G_GSIZE_FORMAT, info->size); GST_CAT_DEBUG (GST_CAT_BUFFER, "alloc metadata of size %" G_GSIZE_FORMAT,
info->size);
size = ITEM_SIZE (info); size = ITEM_SIZE (info);
item = g_slice_alloc (size); item = g_slice_alloc (size);

View file

@ -562,13 +562,14 @@ default_acquire_buffer (GstBufferPool * pool, GstBuffer ** buffer,
while (TRUE) { while (TRUE) {
if (G_UNLIKELY (g_atomic_int_get (&pool->flushing))) if (G_UNLIKELY (g_atomic_int_get (&pool->flushing)))
return GST_FLOW_WRONG_STATE; goto flushing;
/* try to get a buffer from the queue */ /* try to get a buffer from the queue */
*buffer = gst_atomic_queue_pop (pool->queue); *buffer = gst_atomic_queue_pop (pool->queue);
if (G_LIKELY (*buffer)) { if (G_LIKELY (*buffer)) {
gst_poll_read_control (pool->poll); gst_poll_read_control (pool->poll);
result = GST_FLOW_OK; result = GST_FLOW_OK;
GST_LOG_OBJECT (pool, "acquired buffer %p", *buffer);
break; break;
} }
@ -579,20 +580,30 @@ default_acquire_buffer (GstBufferPool * pool, GstBuffer ** buffer,
result = pclass->alloc_buffer (pool, buffer, params); result = pclass->alloc_buffer (pool, buffer, params);
} else } else
result = GST_FLOW_NOT_SUPPORTED; result = GST_FLOW_NOT_SUPPORTED;
GST_LOG_OBJECT (pool, "alloc buffer %p", *buffer);
break; break;
} }
/* check if we need to wait */ /* check if we need to wait */
if (params && !(params->flags & GST_BUFFER_POOL_FLAG_WAIT)) { if (params && !(params->flags & GST_BUFFER_POOL_FLAG_WAIT)) {
GST_LOG_OBJECT (pool, "no more buffers");
result = GST_FLOW_UNEXPECTED; result = GST_FLOW_UNEXPECTED;
break; break;
} }
/* now wait */ /* now wait */
GST_LOG_OBJECT (pool, "waiting for free buffers");
gst_poll_wait (pool->poll, GST_CLOCK_TIME_NONE); gst_poll_wait (pool->poll, GST_CLOCK_TIME_NONE);
} }
return result; return result;
/* ERRORS */
flushing:
{
GST_DEBUG_OBJECT (pool, "we are flushing");
return GST_FLOW_WRONG_STATE;
}
} }
static inline void static inline void
@ -663,6 +674,7 @@ static void
default_release_buffer (GstBufferPool * pool, GstBuffer * buffer) default_release_buffer (GstBufferPool * pool, GstBuffer * buffer)
{ {
/* keep it around in our queue */ /* keep it around in our queue */
GST_LOG_OBJECT (pool, "released buffer %p", buffer);
gst_atomic_queue_push (pool->queue, buffer); gst_atomic_queue_push (pool->queue, buffer);
gst_poll_write_control (pool->poll); gst_poll_write_control (pool->poll);
} }