Hi,

I didn't really understand UVC framework so I have a very ugly workaround patch for this FaceVsion camera. It did work on my MIPS platform with linux-2.6.31 and the TS packets lost is gone. There is no more blocky effects on the captured video stream.

diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c
index 809ec45..787fb2f 100644
--- a/drivers/media/video/uvc/uvc_video.c
+++ b/drivers/media/video/uvc/uvc_video.c
@@ -1315,6 +1315,14 @@ static void uvc_video_complete(struct urb *urb)

        stream->decode(urb, stream, buf);

+       /* workaround to avoid "Frame complete (overflow)"
+        * go to next buffer if buf->bytesused about 4/5 of buf->length
+        */
+       if (buf->bytesused > ((buf->length * 4) / 5)) {
+               buf->state = UVC_BUF_STATE_READY;
+               buf = uvc_queue_next_buffer(&stream->queue, buf);
+       }
+
        if ((ret = usb_submit_urb(urb, GFP_ATOMIC)) < 0) {
uvc_printk(KERN_ERR, "Failed to resubmit video URB (%d).\n",
                        ret);


--
Best Regards,
Grady Chen

On Mon, 12 Dec 2011, Grady Chen wrote:

Hi Laurent,

I have done the backward porting from this branch to linux-2.6.31 and I
could get MPEG2-TS stream from V4L2 APIs. The TS stream can be also
played by Ubuntu 11.10 Movie Player but there are some macro blocks
broken to cause blocky effects.

The attachment is the program that I used to capture MPEG2-TS stream.
I tried to do six times of xioctl(fd, VIDIOC_DQBUF, &buf) to analyze the
TS packets as the following:

/cap -d /dev/video1 -o -c 6

For each VIDIOC_DQBUF, it captured 500 TS packets:
1th VIDIOC_DQBUF:
PACKET COUNT: 0
47 40 00 10 00 00 b0 0d 00 00 c1 00 00 00 01 e0
10 2d 50 98 1b ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff

PACKET COUNT: 1
47 40 10 10 00 02 b0 12 00 01 c1 00 00 e0 11 f0
00 1b e0 11 f0 00 d1 fb 62 71 ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
......


2nd VIDIOC_DQBUF:
PACKET COUNT: 0
e7 04 23 72 b2 86 ee d5 03 e9 88 28 e8 7a 13 95
4a 75 4a f5 ff 19 59 73 97 72 f7 4e f9 f1 db ac
ef c7 81 34 10 79 fa fd ba 1c b5 af f8 27 aa aa
af 9b e3 7c 28 a4 b2 c9 91 fd c9 df 88 a4 44 56
2f 4f 76 b7 0b 66 c4 45 f1 9c b6 2b 47 00 11 3c
07 00 ff ff ff ff ff ff e9 f5 fe 08 f5 ab 7c 10
d5 7e f4 08 3b 24 a5 37 06 3a 05 19 50 dd 8c 5c
65 8c 4d 3e db ae a1 89 fa d6 ab 5d 4f 0b ff 53
d7 bf e9 02 8e be 27 f8 df c1 7d 7d b0 f4 81 f3
2d d1 ff 50 4f eb 97 e4 6f e1 68 a6 2e bc 5e 7d
67 97 ff 82 fa aa f1 79 90 f3 db fb e7 1b ef aa
92 53 a9 39 b9 7b 76 2f d4 a3 90 5e

PACKET COUNT: 1
b5 5a e8 fa ff d4 29 af 53 64 eb 55 13 e7 79 f7
c6 d2 77 76 31 3e 66 7d b5 07 fd b2 ec 6d 48 72
d9 98 fe d7 1b 42 6e 16 0d 66 5b bf 12 d6 ab 28
39 8f 8e 27 85 98 b9 28 2b 90 03 b2 79 a7 6d 8f
18 fd ea 37 2b 51 3e 9a 52 cf f8 ef 47 00 11 3d

You can see the 2nd VIDIOC_DQBUF didn't start with '47' which is the
MPEG2-TS sync byte and there are 2-4 TS packets lost between 1th
VIDIOC_DQBUF and 2nd VIDIOC_DQBUF. I think that's why there are some
blocky effects on the TS stream.

Do you have any comment on this issue?


--
Best regards,
Grady Chen

On Fri, 2011-11-25 at 14:44 +0100, Laurent Pinchart wrote:
Hi Grady,

On Friday 25 November 2011 07:29:27 Grady Chen wrote:
Hi Laurent,

I am a newer in linux-uvc-devel. I bought a FaceVsion webcam, FV
TouchCam V1 recently. I am trying to get H.264 stream from this webcam
by using V4L2 APIs.

From mailing list, I saw that you started working on FaceVsion camera
and you've been able to get the video stream out of the device.

If you can provide the patch that you had up to now, that will be great
helpful for me.

I've just pushed the patches to the uvcvideo-wip-mpeg branch on
git://linuxtv.org/pinchartl/uvcvideo.git
(http://git.linuxtv.org/pinchartl/uvcvideo.git/shortlog/refs/heads/uvcvideo-
wip-mpeg).


_______________________________________________
Linux-uvc-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/linux-uvc-devel

Reply via email to