My laptop has the built-in camera

$ dmesg | grep uvideo
uvideo0 at uhub0 port 4 configuration 1 interface 0 "Micron Built-in iSight" 
rev 2.00/1.84 addr 2
video0 at uvideo0
$

and video(1) usually fails to grab frames in the default resolution of
640x480.  No problems so far with 320x240 and 252x288.

In video(1)'s verbose mode, this results in a bogus `run time' being
printed due to the use of the uninitialized variable `tp_start', which
is only initialized after the first frame was grabbed successfully. 

In the following run I waited about 10 seconds before aborting with ^C:

$ video -v
video device /dev/video:
  encodings: uyvy
  frame sizes (width x height, in pixels) and rates (in frames per second):
        320x240: 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 
30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30
        352x288: 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 
30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30
        640x480: 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 
30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30
  controls: brightness, saturation, gamma, sharpness
Xv adaptor 0, Intel(R) Textured Video:
  encodings: yuy2, uyvy
  max size: 1280x800
using uyvy encoding
using frame size 640x480 (614400 bytes)
using default frame rate
^Crun time: -32862651769276.644531 seconds
            ^^^^^^^^^^^^^^^^^^^^^^

Index: app/video/video.c
===================================================================
RCS file: /cvs/xenocara/app/video/video.c,v
retrieving revision 1.12
diff -u -p -r1.12 video.c
--- app/video/video.c   23 Oct 2014 07:36:06 -0000      1.12
+++ app/video/video.c   19 Jun 2015 09:06:27 -0000
@@ -1406,6 +1406,10 @@ stream(struct video *vid)
        long frames_played = -1, frames_grabbed = 0, fus = 50000;
        int sequence = 20, ret, err, todo, done;
 
+       /* Guard against uninitialized variable in case no frame is grabbed. */
+       if (vid->verbose > 0)
+               gettimeofday(&tp_start, NULL);
+
        if (vid->fps && !vid->nofps) {
                fus = 1000000 / vid->fps;
                timerclear(&frit.it_value);

Reply via email to