Package: uvccapture
Version: 0.5-2.1
Severity: normal
Tags: upstream patch

My camera is unable to allocate 16 buffers, but returns 15 instead.  uvccapture
tries to map 16 of them anyway, which means it doesn't work.

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.10-3-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages uvccapture depends on:
ii  libc6     2.17-93
ii  libjpeg8  8d-1

uvccapture recommends no packages.

uvccapture suggests no packages.

-- no debconf information
Description: Use returned number of buffers instead of requested.
 VIDIOC_REQBUFS stores the number of actually allocated buffers.
 This patch uses this value instead of assuming it is equal to the requested number.
Author: Bas Wijnen <[email protected]>
Last-Update: 2013-10-19

--- uvccapture-0.5.orig/v4l2uvc.c
+++ uvccapture-0.5/v4l2uvc.c
@@ -202,7 +202,7 @@ init_v4l2 (struct vdIn *vd)
     goto fatal;
   }
   /* map the buffers */
-  for (i = 0; i < NB_BUFFER; i++) {
+  for (i = 0; i < vd->rb.count; i++) {
     memset (&vd->buf, 0, sizeof (struct v4l2_buffer));
     vd->buf.index = i;
     vd->buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
@@ -226,7 +226,7 @@ init_v4l2 (struct vdIn *vd)
       fprintf (stderr, "Buffer mapped at address %p.\n", vd->mem[i]);
   }
   /* Queue the buffers. */
-  for (i = 0; i < NB_BUFFER; ++i) {
+  for (i = 0; i < vd->rb.count; ++i) {
     memset (&vd->buf, 0, sizeof (struct v4l2_buffer));
     vd->buf.index = i;
     vd->buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
@@ -335,7 +335,7 @@ close_v4l2 (struct vdIn *vd)
 
   /* If the memory maps are not released the device will remain opened even
      after a call to close(); */
-  for (i = 0; i < NB_BUFFER; i++) {
+  for (i = 0; i < vd->rb.count; i++) {
     munmap (vd->mem[i], vd->buf.length);
   }
 

Reply via email to