[PATCH] media: uvc: Don't recompute frame size unnecessarily

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



uvc_fixup_video_ctrl() needs the frame size for bandwidth calculation,
which it computes from the frame width, height and bpp. The same
calculation is done earlier and the resulting value is stored in
dwMaxVideoFrameBufferSize. Reuse it instead of recomputing it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
---
 drivers/media/usb/uvc/uvc_video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
index 8fa77a81dd7f..a269aeaa9ecc 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -178,7 +178,7 @@ static void uvc_fixup_video_ctrl(struct uvc_streaming *stream,
 		 * high-speed devices) per second and add the UVC header size
 		 * (assumed to be 12 bytes long).
 		 */
-		bandwidth = frame->wWidth * frame->wHeight / 8 * format->bpp;
+		bandwidth = frame->dwMaxVideoFrameBufferSize;
 		bandwidth *= 10000000 / interval + 1;
 		bandwidth /= 1000;
 		if (stream->dev->udev->speed == USB_SPEED_HIGH)
-- 
Regards,

Laurent Pinchart




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux