mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
v4l2bufferpool: Prevent num_queued from going negative
This commit is contained in:
parent
57726911f8
commit
3a7bd8d479
1 changed files with 5 additions and 3 deletions
|
@ -990,12 +990,12 @@ gst_v4l2_buffer_pool_qbuf (GstV4l2BufferPool * pool, GstBuffer * buf)
|
|||
|
||||
GST_LOG_OBJECT (pool, "queuing buffer %i", index);
|
||||
|
||||
g_atomic_int_inc (&pool->num_queued);
|
||||
pool->buffers[index] = buf;
|
||||
|
||||
if (!gst_v4l2_allocator_qbuf (pool->vallocator, group))
|
||||
goto queue_failed;
|
||||
|
||||
pool->buffers[index] = buf;
|
||||
g_atomic_int_inc (&pool->num_queued);
|
||||
|
||||
return GST_FLOW_OK;
|
||||
|
||||
already_queued:
|
||||
|
@ -1008,6 +1008,8 @@ queue_failed:
|
|||
GST_ERROR_OBJECT (pool, "could not queue a buffer %i", index);
|
||||
/* Mark broken buffer to the allocator */
|
||||
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_TAG_MEMORY);
|
||||
g_atomic_int_add (&pool->num_queued, -1);
|
||||
pool->buffers[index] = NULL;
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue