[Vm-dev] [commit][3258] open the number of buffers provided by the xioctl( cam, VIDIOC_REQBUFS call, save the number in the cam struct and use it when closing the camera connection .

commits at squeakvm.org commits at squeakvm.org
Sat Feb 21 01:23:29 UTC 2015


Revision: 3258
Author:   rowledge
Date:     2015-02-20 17:23:27 -0800 (Fri, 20 Feb 2015)
Log Message:
-----------
open the number of buffers provided by the xioctl( cam, VIDIOC_REQBUFS call, save the number in the cam struct and use it when closing the camera connection. Makes things work cleanly on Raspberry Pi

Modified Paths:
--------------
    branches/Cog/platforms/unix/plugins/CameraPlugin/sqCamera-linux.c

Modified: branches/Cog/platforms/unix/plugins/CameraPlugin/sqCamera-linux.c
===================================================================
--- branches/Cog/platforms/unix/plugins/CameraPlugin/sqCamera-linux.c	2015-02-18 00:00:19 UTC (rev 3257)
+++ branches/Cog/platforms/unix/plugins/CameraPlugin/sqCamera-linux.c	2015-02-21 01:23:27 UTC (rev 3258)
@@ -585,8 +585,11 @@
 	if (!(cam->buffers = calloc (req.count, sizeof (struct buffer))))
 		return false;
 
+    /* we have at least as many buffers as requested; save that actual number for uninit_map later */
+    cam->nBuffers = req.count;
+    
 	vBufReset(bufPtr);
-	for (bufPtr->index = 0; bufPtr->index < req.count; bufPtr->index++) {
+	for (bufPtr->index = 0; bufPtr->index < /* req.count */ cam->nBuffers; bufPtr->index++) {
 
 		if (!xioctl(cam, VIDIOC_QUERYBUF, bufPtr)) return false;
 		



More information about the Vm-dev mailing list