mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
v4l2bufferpool: Fix race condition between qbuf and pool streamoff
There is a chance that pool->buffers[index] sets BUFFER_STATE_QUEUED, but it has not been queued yet which makes pool->buffers[index] still NULL. At this time, if pool_streamff release all buffers with BUFFER_STATE_QUEUED state regardless of whether the buffer is NULL or not, it will cause segfault. To fix this, also check buffer when streamoff release buffer. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1842>
This commit is contained in:
parent
52c0763042
commit
fa6f34d595
1 changed files with 1 additions and 1 deletions
|
@ -744,7 +744,7 @@ gst_v4l2_buffer_pool_streamoff (GstV4l2BufferPool * pool)
|
|||
for (i = 0; i < VIDEO_MAX_FRAME; i++) {
|
||||
gint old_buffer_state =
|
||||
g_atomic_int_and (&pool->buffer_state[i], ~BUFFER_STATE_QUEUED);
|
||||
if (old_buffer_state & BUFFER_STATE_QUEUED) {
|
||||
if ((old_buffer_state & BUFFER_STATE_QUEUED) && pool->buffers[i]) {
|
||||
GstBuffer *buffer = pool->buffers[i];
|
||||
GstBufferPool *bpool = GST_BUFFER_POOL (pool);
|
||||
|
||||
|
|
Loading…
Reference in a new issue