diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-11-03 06:24:34 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-11 08:14:31 -0500 |
commit | 3afedb95858bcc117b207a7c0a6767fe891bdfe9 (patch) | |
tree | cf21cbf7f8fb866ab281544b9a33d387a2cad7aa /drivers/media/video/uvc | |
parent | 0c6a3b268e14ab99960028c9ad202b9aebae0a03 (diff) |
[media] uvcvideo: Don't skip erroneous payloads
Instead of skipping the payload completely, which would make the
resulting image corrupted anyway, store the payload normally and mark
the buffer as erroneous. If the no_drop module parameter is set to 1 the
buffer will then be passed to userspace, and tt will then be up to the
application to decide what to do with the buffer.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/uvc')
-rw-r--r-- | drivers/media/video/uvc/uvc_video.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c index b953dae5205d..a57f81341849 100644 --- a/drivers/media/video/uvc/uvc_video.c +++ b/drivers/media/video/uvc/uvc_video.c | |||
@@ -409,13 +409,6 @@ static int uvc_video_decode_start(struct uvc_streaming *stream, | |||
409 | if (len < 2 || data[0] < 2 || data[0] > len) | 409 | if (len < 2 || data[0] < 2 || data[0] > len) |
410 | return -EINVAL; | 410 | return -EINVAL; |
411 | 411 | ||
412 | /* Skip payloads marked with the error bit ("error frames"). */ | ||
413 | if (data[1] & UVC_STREAM_ERR) { | ||
414 | uvc_trace(UVC_TRACE_FRAME, "Dropping payload (error bit " | ||
415 | "set).\n"); | ||
416 | return -ENODATA; | ||
417 | } | ||
418 | |||
419 | fid = data[1] & UVC_STREAM_FID; | 412 | fid = data[1] & UVC_STREAM_FID; |
420 | 413 | ||
421 | /* Increase the sequence number regardless of any buffer states, so | 414 | /* Increase the sequence number regardless of any buffer states, so |
@@ -432,6 +425,13 @@ static int uvc_video_decode_start(struct uvc_streaming *stream, | |||
432 | return -ENODATA; | 425 | return -ENODATA; |
433 | } | 426 | } |
434 | 427 | ||
428 | /* Mark the buffer as bad if the error bit is set. */ | ||
429 | if (data[1] & UVC_STREAM_ERR) { | ||
430 | uvc_trace(UVC_TRACE_FRAME, "Marking buffer as bad (error bit " | ||
431 | "set).\n"); | ||
432 | buf->error = 1; | ||
433 | } | ||
434 | |||
435 | /* Synchronize to the input stream by waiting for the FID bit to be | 435 | /* Synchronize to the input stream by waiting for the FID bit to be |
436 | * toggled when the the buffer state is not UVC_BUF_STATE_ACTIVE. | 436 | * toggled when the the buffer state is not UVC_BUF_STATE_ACTIVE. |
437 | * stream->last_fid is initialized to -1, so the first isochronous | 437 | * stream->last_fid is initialized to -1, so the first isochronous |