v4l2: Don't use allocator size to iterate
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>
Wed, 7 Jan 2015 22:58:05 +0000 (17:58 -0500)
committerNicolas Dufresne <nicolas.dufresne@collabora.co.uk>
Fri, 9 Jan 2015 04:55:28 +0000 (23:55 -0500)
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
sys/v4l2/gstv4l2allocator.h
sys/v4l2/gstv4l2bufferpool.c

index fcfa03c..97f8752 100644 (file)
@@ -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;
-}
index 8200e03..d51f3d1 100644 (file)
@@ -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__ */
index 44197f1..c3ceb25 100644 (file)
@@ -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;