v4l2: Don't use allocator size to iterate

As the buffer array is fixed size and small, it's safer to simply
use this static size to cleanup the buffers. This is also more
consistent with the rest. The associated method is no longer
required and can be dropped.
This commit is contained in:
Nicolas Dufresne 2015-01-07 17:58:05 -05:00
parent e47a5708f0
commit 3e876215b7
3 changed files with 1 additions and 21 deletions

View file

@ -1407,17 +1407,3 @@ gst_v4l2_allocator_reset_group (GstV4l2Allocator * allocator,
gst_v4l2_allocator_reset_size (allocator, group); gst_v4l2_allocator_reset_size (allocator, group);
} }
gsize
gst_v4l2_allocator_num_allocated (GstV4l2Allocator * allocator)
{
gsize num_allocated;
GST_OBJECT_LOCK (allocator);
num_allocated = allocator->count;
GST_OBJECT_UNLOCK (allocator);
return num_allocated;
}

View file

@ -153,8 +153,6 @@ GstV4l2MemoryGroup* gst_v4l2_allocator_dqbuf (GstV4l2Allocator * alloc
void gst_v4l2_allocator_reset_group (GstV4l2Allocator * allocator, void gst_v4l2_allocator_reset_group (GstV4l2Allocator * allocator,
GstV4l2MemoryGroup * group); GstV4l2MemoryGroup * group);
gsize gst_v4l2_allocator_num_allocated (GstV4l2Allocator * allocator);
G_END_DECLS G_END_DECLS
#endif /* __GST_V4L2_ALLOCATOR_H__ */ #endif /* __GST_V4L2_ALLOCATOR_H__ */

View file

@ -904,11 +904,7 @@ gst_v4l2_buffer_pool_flush_stop (GstBufferPool * bpool)
case GST_V4L2_IO_DMABUF: case GST_V4L2_IO_DMABUF:
case GST_V4L2_IO_DMABUF_IMPORT: case GST_V4L2_IO_DMABUF_IMPORT:
{ {
gsize num_allocated; for (i = 0; i < VIDEO_MAX_FRAME; i++) {
num_allocated = gst_v4l2_allocator_num_allocated (pool->vallocator);
for (i = 0; i < num_allocated; i++) {
/* Re-enqueue buffers */ /* Re-enqueue buffers */
if (pool->buffers[i]) { if (pool->buffers[i]) {
GstBufferPool *bpool = (GstBufferPool *) pool; GstBufferPool *bpool = (GstBufferPool *) pool;