Re: [uvc] Frames smaller than dwMaxVideoFrameSize

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

 



Hello again list,

I wrote:
> We're seeing problems using cameras based on Geo GC6500 in Linux
> kernels 4.19+ in raw mode (as opposed to H.264 mode, to avoid IP
> issues).

> Putting frame size reporting/calculations aside for now

Now, on to frame size calculations. There's a small gadget in the code
seemingly existing since the dawn of time:

https://github.com/torvalds/linux/blob/95f5cbff90b9e4324839a5c28ee3153a3c9921a5/drivers/media/usb/uvc/uvc_video.c#L119

if (!(format->flags & UVC_FMT_FLAG_COMPRESSED) ||
(ctrl->dwMaxVideoFrameSize == 0 && stream->dev->uvc_version < 0x0110))
    ctrl->dwMaxVideoFrameSize = frame->dwMaxVideoFrameBufferSize;

It seems to be overwriting a closer-to-the-truth value of 3110412 in
dwMaxVideoFrameSize with frame->dwMaxVideoFrameBufferSize which
happens to be 4147200 and is used from then on, including the
uvc_video_validate_buffer() check. FWIW uvc_version is 0x0110. The
value is still not quite 3110400, but even if it were so (e.g. to
please uvc_video_validate_buffer()), it would have been overwritten
anyway. The condition block logic seems worth double-checking (sure
it's || not &&?).

My original question on whether a value below the maximum is valid
remains (hope the answer is obvious).

Best regards,

--
DoubleF



[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