From 2e80c0d2c08d1fbda3286bfe397153ec65661322 Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Thu, 3 May 2012 16:07:27 +0200 Subject: [PATCH] v4l2: bufferpool: reset buffer size in release_buffer The buffer might still be in use elsewhere when dequeuing buffers for outputs. https://bugzilla.gnome.org/show_bug.cgi?id=698822 --- sys/v4l2/gstv4l2bufferpool.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c index d4976fe083..f8851569da 100644 --- a/sys/v4l2/gstv4l2bufferpool.c +++ b/sys/v4l2/gstv4l2bufferpool.c @@ -683,8 +683,6 @@ gst_v4l2_buffer_pool_dqbuf (GstV4l2BufferPool * pool, GstBuffer ** buffer) /* this can change at every frame, esp. with jpeg */ if (obj->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) gst_buffer_resize (outbuf, 0, vbuffer.bytesused); - else - gst_buffer_resize (outbuf, 0, vbuffer.length); GST_BUFFER_TIMESTAMP (outbuf) = timestamp; @@ -897,6 +895,10 @@ gst_v4l2_buffer_pool_release_buffer (GstBufferPool * bpool, GstBuffer * buffer) if (pool->buffers[index] == NULL) { GST_LOG_OBJECT (pool, "buffer %u not queued, putting on free list", index); + + /* reset to the full length, in case it was changed */ + gst_buffer_resize (buffer, 0, meta->vbuffer.length); + /* playback, put the buffer back in the queue to refill later. */ GST_BUFFER_POOL_CLASS (parent_class)->release_buffer (bpool, buffer);