aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Grzeschik <[email protected]>2024-02-14 00:37:55 +0100
committerGreg Kroah-Hartman <[email protected]>2024-02-17 17:08:45 +0100
commit2a3b7af120477d0571b815ccb8600cafd5ebf02f (patch)
tree6fd6375c953fab2c558d62b74abd240225aa75a4
parentab9ffa51d5a2f3145839ca59354b3f74d18f7e85 (diff)
usb: gadget: uvc: mark incomplete frames with UVC_STREAM_ERR
If an frame was transmitted incomplete to the host, we set the UVC_STREAM_ERR bit in the header for the last request that is going to be queued. This way the host will know that it should drop the frame instead of trying to display the corrupted content. Signed-off-by: Michael Grzeschik <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/usb/gadget/function/uvc_video.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c
index d677d7daa187..d41f5f31dadd 100644
--- a/drivers/usb/gadget/function/uvc_video.c
+++ b/drivers/usb/gadget/function/uvc_video.c
@@ -35,6 +35,9 @@ uvc_video_encode_header(struct uvc_video *video, struct uvc_buffer *buf,
data[1] = UVC_STREAM_EOH | video->fid;
+ if (video->queue.flags & UVC_QUEUE_DROP_INCOMPLETE)
+ data[1] |= UVC_STREAM_ERR;
+
if (video->queue.buf_used == 0 && ts.tv_sec) {
/* dwClockFrequency is 48 MHz */
u32 pts = ((u64)ts.tv_sec * USEC_PER_SEC + ts.tv_nsec / NSEC_PER_USEC) * 48;