Yes its fairly straight forward to patch libv4l to drop jpeg frames that get an error during the decode step. This is in fact already being done for the pixart jpeg format. I've attached a patch whcih should be applied to the latest version of libv4l which will also try broken frames for the sn9c20x driver. Please test it and let me know if this fixes the flickering issues.
On Wed, Jan 14, 2009 at 10:35 AM, GWater <[email protected]> wrote: > Till Bayer schrieb: >> >> GWater wrote: >>> >>> Vasily Khoruzhick schrieb: >>>> >>>> On Wednesday 14 January 2009 16:28:29 GWater wrote: >>>>> >>>>> Hi Till, >>>>> >>>>> Vasily mentioned that libv4l can drop the broken JPEG frames. >>>>> >>>>> Do you have a patch for that, Vasily? Any chance this patch gets into >>>>> libv4l? >>>>> >>>>> GWater >>>> >>>> Mmm, can't remember that I mentioned anything about jpeg+libv4l+broken >>>> frames :) >>> >>> Oh, >>> yeah sorry. Brian mentioned that hypothetically such a thing could >>> implemented. >>> >>> So no patch yet. >>> >>> GWater >>> >> >> Why are there broken frames in the first place? I get about 20 of these >> errors per second... >> >> >> Till >> > > No living soul among us knows... > > GWater > > > --~--~---------~--~----~------------~-------~--~----~ Lets make microdia webcams plug'n play, (currently plug'n pray) To post to this group, send email to [email protected] Visit us online https://groups.google.com/group/microdia -~----------~----~----~----~------~----~------~--~---
From 5d8343abaea6e129a2bfd4505a68c06a3d4448a7 Mon Sep 17 00:00:00 2001 From: Brian Johnson <[email protected]> Date: Thu, 15 Jan 2009 00:32:57 -0500 Subject: [PATCH] Drop bad jpeg frames on sn9c20x cameras Signed-off-by: Brian Johnson <[email protected]> --- libv4lconvert/libv4lconvert-priv.h | 1 + libv4lconvert/libv4lconvert.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/libv4lconvert/libv4lconvert-priv.h b/libv4lconvert/libv4lconvert-priv.h index 08a7a7c..5c53a41 100644 --- a/libv4lconvert/libv4lconvert-priv.h +++ b/libv4lconvert/libv4lconvert-priv.h @@ -78,6 +78,7 @@ #define V4LCONVERT_ROTATE_90 0x01 #define V4LCONVERT_ROTATE_180 0x02 #define V4LCONVERT_IS_UVC 0x04 +#define V4LCONVERT_IS_SN9C20X 0x08 /* Pixformat flags */ #define V4LCONVERT_COMPRESSED 0x01 diff --git a/libv4lconvert/libv4lconvert.c b/libv4lconvert/libv4lconvert.c index 3c51b6c..c97fbbd 100644 --- a/libv4lconvert/libv4lconvert.c +++ b/libv4lconvert/libv4lconvert.c @@ -163,6 +163,8 @@ struct v4lconvert_data *v4lconvert_create(int fd) if (syscall(SYS_ioctl, fd, VIDIOC_QUERYCAP, &cap) == 0) { if (!strcmp((char *)cap.driver, "uvcvideo")) data->flags |= V4LCONVERT_IS_UVC; + else if (!strcmp((char *)cap.driver, "sn9c20x")) + data->flags |= V4LCONVERT_IS_SN9C20X; } return data; @@ -538,7 +540,8 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data, are best thrown away to avoid flashes in the video stream. Tell the upper layer this is an intermediate fault and it should try again with a new buffer by setting errno to EAGAIN */ - if (src_pix_fmt == V4L2_PIX_FMT_PJPG) { + if (src_pix_fmt == V4L2_PIX_FMT_PJPG || + data->flags & V4LCONVERT_IS_SN9C20X) { V4LCONVERT_ERR("decompressing JPEG: %s", tinyjpeg_get_errorstring(data->jdec)); errno = EAGAIN; -- 1.5.6.3
