Skip to content

Commit

Permalink
[media] uvcvideo: Fix frame drop in bulk video stream
Browse files Browse the repository at this point in the history
When video endpoint is configured as bulk, a ZLP is sent after every
video frames with size as multiple of 512 bytes. This is done so that
host can detect end of transfer and pass data for processing.
Still, frames that are multiple of 16K in size gets dropped. The ZLP
sent by camera is ignored by uvc_video_decode_bulk(). The makes sure
that the ZLP is not part of a video frame before ignoring it. If ZLP
follows a video frame, then it triggers completion callback.

[mchehab@redhat.com: Fix a small CodingStyle issue]
Signed-off-by: Jayakrishnan Memana <jayakrishnan.memana@maxim-ic.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Jayakrishnan authored and Mauro Carvalho Chehab committed Jul 6, 2012
1 parent 7078daa commit c854a48
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/media/video/uvc/uvc_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,11 @@ static void uvc_video_decode_bulk(struct urb *urb, struct uvc_streaming *stream,
u8 *mem;
int len, ret;

if (urb->actual_length == 0)
/*
* Ignore ZLPs if they're not part of a frame, otherwise process them
* to trigger the end of payload detection.
*/
if (urb->actual_length == 0 && stream->bulk.header_size == 0)
return;

mem = urb->transfer_buffer;
Expand Down

0 comments on commit c854a48

Please sign in to comment.