Hi,
First of all, thank you for providing such great Linux support for webcams. I
have encountered an issue in this area that I hope you experts can help with.
I am using UVC/V4L on an embedded system, and I am experiencing a problem with
corrupted camera images. The system consists of a custom ASIC with an
ARM926EJ-S and OHCI USB host controller connected to a UVC camera which
supports only MJPEG.
The problem I have is that buffers dequeued in user space occasionally contain
corrupted JPEGs. This corruption ranges from slight, with a row of macroblocks
shifted, to severe, with the JPEG being totally undecompressible.
If I enable UVC_TRACE_FRAME, I see several instances of:
"uvcvideo: USB isochronous frame lost (-70)."
in dmesg. I have noticed a correlation between the presence of this message
and visual corruption in captured JPEGs.
I see that this error code corresponds to -ECOMM, which in turn corresponds to
TD_BUFFEROVERRUN in the isochronous packet status. I assume that this is
caused by CPU starvation, which should just manifest as dropped frames.
However, I think these overrun frames are not being dropped, and instead are
being passed to user space in an indeterminate state, leading to the visual
corruption that I've witnessed.
The attached patch (against 2.6.31) is my naïve attempt at fixing the problem.
It does appear to resolve the corruption, but I am not entirely sure it's the
correct thing to do. Does it look reasonable? I would appreciate any feedback.
Thank you,
Filter
diff -ur linux-2.6/drivers/media/video/uvc/uvc_video.c linux-patch/drivers/media/video/uvc/uvc_video.c
--- linux-2.6/drivers/media/video/uvc/uvc_video.c 2010-06-08 14:05:19.000000000 -0700
+++ linux-patch/drivers/media/video/uvc/uvc_video.c 2010-06-08 14:05:06.000000000 -0700
@@ -536,6 +536,11 @@
if (urb->iso_frame_desc[i].status < 0) {
uvc_trace(UVC_TRACE_FRAME, "USB isochronous frame "
"lost (%d).\n", urb->iso_frame_desc[i].status);
+ if (buf) {
+ buf->state = UVC_BUF_STATE_QUEUED;
+ buf->buf.bytesused = 0;
+ i = urb->number_of_packets;
+ }
continue;
}
_______________________________________________
Linux-uvc-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/linux-uvc-devel