mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
v4l2: bufferpool: Don't copy buffer when flushing
Threshold handling can race with flushing operation. This can lead to avoidable buffer copies. Simply check and return the flushing status. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4437>
This commit is contained in:
parent
c6be3d7505
commit
c9841a5383
1 changed files with 4 additions and 2 deletions
|
@ -1922,8 +1922,9 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer ** buf,
|
|||
/* If we have no more buffer, and can allocate it time to do so */
|
||||
if (num_queued == 0) {
|
||||
if (GST_V4L2_ALLOCATOR_CAN_ALLOCATE (pool->vallocator, MMAP)) {
|
||||
GST_DEBUG_OBJECT (pool, "Resurrect for empty queue");
|
||||
ret = gst_v4l2_buffer_pool_resurrect_buffer (pool);
|
||||
if (ret == GST_FLOW_OK)
|
||||
if (ret == GST_FLOW_OK || ret == GST_FLOW_FLUSHING)
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
@ -1933,8 +1934,9 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer ** buf,
|
|||
GstBuffer *copy;
|
||||
|
||||
if (GST_V4L2_ALLOCATOR_CAN_ALLOCATE (pool->vallocator, MMAP)) {
|
||||
GST_DEBUG_OBJECT (pool, "Resurrect for threshold");
|
||||
ret = gst_v4l2_buffer_pool_resurrect_buffer (pool);
|
||||
if (ret == GST_FLOW_OK)
|
||||
if (ret == GST_FLOW_OK || ret == GST_FLOW_FLUSHING)
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue