Hi Darren, On Wednesday 17 December 2008, Darren Longhorn wrote: > Hi, > > I'm using a camera (1cac:a332 kinstone C8) with uvc (SVN r233, fairly > old, I know). Usually, I sue this camera at 320x240 resolution at a > frame rate of 20f/s. When I try and up the frame size to 640x480, I > always get a timeout when I do a select(). > > I expected that if I passed a long enough timeout to select that it > would eventually indicate that a frame is ready, but that turned out not > to be true. It doesn't matter what value of timeout I pass to select - > the call just pends for whatever time I specify, but still always times > out. > > After a bit of investigation I discovered that if I reduce the frame > rate specified to the camera via the stream parameters, I can then > select and dequeue a frame. It seems as though this is the critical > value - unless I indicate a low enough frame rate the camera never > captures a frame. i.e. the camera must be able to capture a frame within > the frame rate given, regardless of how long a timeout is specified to > select. > > Is this correct behaviour?
No it isn't. The application should receive video frames regardless of the selected frame rate. This probably indicates a bug (either in the camera itself or in the uvcvideo driver). select() times out when no frame is ready. I can see two main reasons for that. The camera could fail to send video data to the host, or the driver could drop video frames because it believes they are incomplete/corrupted. > Could someone point me at the part of the source code where the timeout > is implemented? The select() timeout itself is implemented outside the uvcvideo driver. When select() is invoked the driver's uvc_v4l2_poll() function (in uvc_v4l2.c) is called. This calls uvc_queue_poll() which in turn calls poll_wait() on a wait queue. select() waits on that wait queue entry until the timeout elapses or the driver signals a wake-up condition on the wait queue by walling wake_up() in uvc_queue_next_buffer(). To understand where your problem comes from you should set the uvcvideo trace level to UVC_TRACE_FRAME. The driver will print extra messages to the kernel log when it receives data from the camera. You should also upgrade to the latest driver. It now has a nodrop module option that you can activate to disable incomplete frame drop. Alternatively you can remove the frame drop code at the beginning of uvc_queue_next_buffer(). Best regards, Laurent Pinchart _______________________________________________ Linux-uvc-devel mailing list [email protected] https://lists.berlios.de/mailman/listinfo/linux-uvc-devel
