[PATCH 1/1] media: uvcvideo: Mark buffer error where overflow

Kai-Heng Feng kai.heng.feng at canonical.com
Fri Oct 25 16:30:12 UTC 2019


From: Baoyou Xie <baoyou.xie at linaro.org>

BugLink: https://bugs.launchpad.net/bugs/1849871

Some cameras post inaccurate frame where next frame data overlap
it. this results in screen flicker, and it need to be prevented.

So this patch marks the buffer error to discard the frame where
buffer overflow.

Signed-off-by: Baoyou Xie <baoyou.xie at linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab at s-opensource.com>
(cherry picked from commit dfc1648c576719b5a2701805aab1e208789d5969)
Signed-off-by: Kai-Heng Feng <kai.heng.feng at canonical.com>
---
 drivers/media/usb/uvc/uvc_video.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
index 31d428c6bd20..924974125714 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -1089,6 +1089,7 @@ static void uvc_video_decode_data(struct uvc_streaming *stream,
 	/* Complete the current frame if the buffer size was exceeded. */
 	if (len > maxlen) {
 		uvc_trace(UVC_TRACE_FRAME, "Frame complete (overflow).\n");
+		buf->error = 1;
 		buf->state = UVC_BUF_STATE_READY;
 	}
 }
-- 
2.17.1




More information about the kernel-team mailing list