From 3e876215b79ba825b6c4687c06c31f5cad0a3ef7 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Wed, 7 Jan 2015 17:58:05 -0500 Subject: [PATCH] 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. --- sys/v4l2/gstv4l2allocator.c | 14 -------------- sys/v4l2/gstv4l2allocator.h | 2 -- sys/v4l2/gstv4l2bufferpool.c | 6 +----- 3 files changed, 1 insertion(+), 21 deletions(-) diff --git a/sys/v4l2/gstv4l2allocator.c b/sys/v4l2/gstv4l2allocator.c index fcfa03c124..97f8752df8 100644 --- a/sys/v4l2/gstv4l2allocator.c +++ b/sys/v4l2/gstv4l2allocator.c @@ -1407,17 +1407,3 @@ gst_v4l2_allocator_reset_group (GstV4l2Allocator * allocator, 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; -} diff --git a/sys/v4l2/gstv4l2allocator.h b/sys/v4l2/gstv4l2allocator.h index 8200e03d42..d51f3d1b6f 100644 --- a/sys/v4l2/gstv4l2allocator.h +++ b/sys/v4l2/gstv4l2allocator.h @@ -153,8 +153,6 @@ GstV4l2MemoryGroup* gst_v4l2_allocator_dqbuf (GstV4l2Allocator * alloc void gst_v4l2_allocator_reset_group (GstV4l2Allocator * allocator, GstV4l2MemoryGroup * group); -gsize gst_v4l2_allocator_num_allocated (GstV4l2Allocator * allocator); - G_END_DECLS #endif /* __GST_V4L2_ALLOCATOR_H__ */ diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c index 44197f19d8..c3ceb25769 100644 --- a/sys/v4l2/gstv4l2bufferpool.c +++ b/sys/v4l2/gstv4l2bufferpool.c @@ -904,11 +904,7 @@ gst_v4l2_buffer_pool_flush_stop (GstBufferPool * bpool) case GST_V4L2_IO_DMABUF: case GST_V4L2_IO_DMABUF_IMPORT: { - gsize num_allocated; - - num_allocated = gst_v4l2_allocator_num_allocated (pool->vallocator); - - for (i = 0; i < num_allocated; i++) { + for (i = 0; i < VIDEO_MAX_FRAME; i++) { /* Re-enqueue buffers */ if (pool->buffers[i]) { GstBufferPool *bpool = (GstBufferPool *) pool;