mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-27 01:28:34 +00:00
v4l2: fix the critical log when unreference the buffer with no data
In the trick mode, driver may queue a valid buffer follow by an empty buffer which has no valid data to indicate EOS.For the empty buffer whose memory is multi-plane, need to resize it before unreference it. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2731>
This commit is contained in:
parent
cf94045dbf
commit
e0564b04c6
1 changed files with 19 additions and 2 deletions
|
@ -121,6 +121,19 @@ done:
|
|||
return valid;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_v4l2_buffer_pool_resize_buffer (GstBufferPool * bpool, GstBuffer * buffer)
|
||||
{
|
||||
GstV4l2BufferPool *pool = GST_V4L2_BUFFER_POOL (bpool);
|
||||
GstV4l2MemoryGroup *group;
|
||||
|
||||
if (gst_v4l2_is_buffer_valid (buffer, &group)) {
|
||||
gst_v4l2_allocator_reset_group (pool->vallocator, group);
|
||||
} else {
|
||||
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_TAG_MEMORY);
|
||||
}
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_v4l2_buffer_pool_copy_buffer (GstV4l2BufferPool * pool, GstBuffer * dest,
|
||||
GstBuffer * src)
|
||||
|
@ -1971,8 +1984,10 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer ** buf,
|
|||
gsize size = gst_buffer_get_size (*buf);
|
||||
|
||||
/* Legacy M2M devices return empty buffer when drained */
|
||||
if (size == 0 && GST_V4L2_IS_M2M (obj->device_caps))
|
||||
if (size == 0 && GST_V4L2_IS_M2M (obj->device_caps)) {
|
||||
gst_v4l2_buffer_pool_resize_buffer (bpool, *buf);
|
||||
goto eos;
|
||||
}
|
||||
|
||||
if (GST_VIDEO_INFO_FORMAT (&pool->caps_info) !=
|
||||
GST_VIDEO_FORMAT_ENCODED && size < pool->size)
|
||||
|
@ -2026,8 +2041,10 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer ** buf,
|
|||
gst_v4l2_buffer_pool_complete_release_buffer (bpool, tmp, FALSE);
|
||||
|
||||
/* Legacy M2M devices return empty buffer when drained */
|
||||
if (GST_V4L2_IS_M2M (obj->device_caps))
|
||||
if (GST_V4L2_IS_M2M (obj->device_caps)) {
|
||||
gst_v4l2_buffer_pool_resize_buffer (bpool, *buf);
|
||||
goto eos;
|
||||
}
|
||||
}
|
||||
|
||||
ret = gst_v4l2_buffer_pool_copy_buffer (pool, *buf, tmp);
|
||||
|
|
Loading…
Reference in a new issue