Commit 3afedb95 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

[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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 0c6a3b26
...@@ -409,13 +409,6 @@ static int uvc_video_decode_start(struct uvc_streaming *stream, ...@@ -409,13 +409,6 @@ static int uvc_video_decode_start(struct uvc_streaming *stream,
if (len < 2 || data[0] < 2 || data[0] > len) if (len < 2 || data[0] < 2 || data[0] > len)
return -EINVAL; return -EINVAL;
/* Skip payloads marked with the error bit ("error frames"). */
if (data[1] & UVC_STREAM_ERR) {
uvc_trace(UVC_TRACE_FRAME, "Dropping payload (error bit "
"set).\n");
return -ENODATA;
}
fid = data[1] & UVC_STREAM_FID; fid = data[1] & UVC_STREAM_FID;
/* Increase the sequence number regardless of any buffer states, so /* 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,6 +425,13 @@ static int uvc_video_decode_start(struct uvc_streaming *stream,
return -ENODATA; return -ENODATA;
} }
/* Mark the buffer as bad if the error bit is set. */
if (data[1] & UVC_STREAM_ERR) {
uvc_trace(UVC_TRACE_FRAME, "Marking buffer as bad (error bit "
"set).\n");
buf->error = 1;
}
/* Synchronize to the input stream by waiting for the FID bit to be /* Synchronize to the input stream by waiting for the FID bit to be
* toggled when the the buffer state is not UVC_BUF_STATE_ACTIVE. * toggled when the the buffer state is not UVC_BUF_STATE_ACTIVE.
* stream->last_fid is initialized to -1, so the first isochronous * stream->last_fid is initialized to -1, so the first isochronous
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment