gstbufferpool: there is a bug in do_alloc_buffer function in gstbufferpool.c
Hi Devs,
In do_alloc_buffer function in gstbufferpool.c, should not use cur_buffers variable to make judgments with max_buffers, because g_atomic_int_add function return the value before the add. I think you shall let cur_buffers+1 or let priv->cur_buffers >= max_buffers instead of cur_buffers >= max_buffers.
Here is the related code:
cur_buffers = g_atomic_int_add (&priv->cur_buffers, 1);
if (max_buffers && cur_buffers >= max_buffers)
GST_LOG_OBJECT (pool, "allocated buffer %d/%d, %p", cur_buffers, max_buffers, *buffer);
g_atomic_int_add function prototype:
gint g_atomic_int_add (volatile gint *atomic, gint val);
atomic: a pointer to a gint or guint
val: the value to add
Returns: the value of atomic before the add, signed