v4l2: bufferpool: update buffer state after group release

This fixes the state that lead to a flood of "newly allocated buffer
%u is not free" warnings.

Fixes #1185 #3184 #4037

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8454>
This commit is contained in:
sergey radionov 2025-02-11 11:52:05 +07:00 committed by GStreamer Marge Bot
parent c79b256795
commit d8a85e3793

View File

@ -778,6 +778,17 @@ gst_v4l2_buffer_pool_streamoff (GstV4l2BufferPool * pool)
} }
} }
static void
gst_v4l2_buffer_pool_group_released (GstV4l2BufferPool * pool,
GstV4l2MemoryGroup * group)
{
gint index = group->buffer.index;
g_atomic_int_set (&pool->buffer_state[index], BUFFER_STATE_FREE);
gst_v4l2_buffer_pool_resurrect_buffer (pool);
}
static gboolean static gboolean
gst_v4l2_buffer_pool_start (GstBufferPool * bpool) gst_v4l2_buffer_pool_start (GstBufferPool * bpool)
{ {
@ -941,7 +952,7 @@ gst_v4l2_buffer_pool_start (GstBufferPool * bpool)
pool->group_released_handler = pool->group_released_handler =
g_signal_connect_swapped (pool->vallocator, "group-released", g_signal_connect_swapped (pool->vallocator, "group-released",
G_CALLBACK (gst_v4l2_buffer_pool_resurrect_buffer), pool); G_CALLBACK (gst_v4l2_buffer_pool_group_released), pool);
ret = gst_v4l2_buffer_pool_streamon (pool); ret = gst_v4l2_buffer_pool_streamon (pool);
} }