v4l2: Improve buffer management
authorWim Taymans <wim.taymans@collabora.co.uk>
Mon, 23 Apr 2012 16:01:31 +0000 (18:01 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 23 Apr 2012 16:10:33 +0000 (18:10 +0200)
commiteecb9a96a669e5de089fd84355fdd585665f7f16
tree129bfd6511cd1bad12579d43ff88bdf66a1b693d
parent713ddbf5417984237d1d8a4cbd5e93250aed2157
v4l2: Improve buffer management

Query the amount of available buffers when doing set_config(). This allows us to
configure the parent bufferpool with the number of buffers to preallocate.
Keep track of the provided allocator and use it when we need to allocate a
buffer in RW mode.
When we are can not allocate the requested max_buffers amount of buffers, make
sure we keep 2 buffers around in the pool and copy them into an output buffer.
This makes sure that we always have a buffer to capture into. We also need to
detect those copied buffers and unref them when they return to the pool.
sys/v4l2/gstv4l2bufferpool.c
sys/v4l2/gstv4l2bufferpool.h
sys/v4l2/gstv4l2src.c