diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2012-06-26 12:07:47 +0200 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2012-06-26 12:07:47 +0200 |
commit | 1b09bc609a578e731f0dbc8f6e698e25d8f4c5f8 (patch) | |
tree | 35f6cdcff0e1519ae717f2024e411a32349f6d36 /sys | |
parent | 9fd4af2164b0ef33c87e0d1cb6c1c888025d0a9a (diff) |
v4l2: free kernel buffers before allocating new ones
See https://bugzilla.gnome.org/show_bug.cgi?id=670257
Diffstat (limited to 'sys')
-rw-r--r-- | sys/v4l2/gstv4l2bufferpool.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c index 0679ea3bf..65d1a5c57 100644 --- a/sys/v4l2/gstv4l2bufferpool.c +++ b/sys/v4l2/gstv4l2bufferpool.c @@ -305,6 +305,17 @@ gst_v4l2_buffer_pool_set_config (GstBufferPool * bpool, GstStructure * config) else num_buffers = max_buffers; + /* Free the buffers from the kernel */ + GST_DEBUG_OBJECT (pool, "Freeing the buffers from the kernel"); + + memset (&breq, 0, sizeof (struct v4l2_requestbuffers)); + breq.type = obj->type; + breq.count = 0; + breq.memory = V4L2_MEMORY_MMAP; + + if (v4l2_ioctl (pool->video_fd, VIDIOC_REQBUFS, &breq) < 0) + goto reqbufs_failed; + /* first, lets request buffers, and see how many we can get: */ GST_DEBUG_OBJECT (pool, "starting, requesting %d MMAP buffers", num_buffers); |