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)
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)
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);