Index | Thread | Search

From:
Stefan Hagen <sh+openbsd-tech@codevoid.de>
Subject:
Re: sys/uvideo: forward error bit to consumer
To:
tech@openbsd.org, mglocker@openbsd.org
Date:
Fri, 20 Dec 2024 13:36:23 +0100

Download raw body.

Thread
Kirill A. Korinsky wrote (2024-12-19 23:49 CET):
> tech@,
> 
> Some invalid frames or frames with an error flag from the camera might be 
> essential for a stream consumer for synchronization and other purposes. 
> Without this, the consumer may be unable to synchronize the stream or play 
> it at all.
> 
> Instead of skipping frames that the driver considers incorrect, this change 
> forwards them to the V4L consumer with the V4L2_BUF_FLAG_ERROR flag set, 
> allowing the consumer to decide whether to skip the frame or use parts of it.
> 
> This change fixes the embedded webcam on the ThinkPad T14 Gen 5, which was 
> tested by sdk@.
> 
> The behavior for non-mmap consumers remains unchanged, and error frames 
> are still skipped by the driver.
> 
> I had tested this diff with the following webcams and no regressions
> were noticed:
>  - Azurewave, USB camera
>  - LG UltraFine Display Camera
>  - Jabra PanaCast 20
> 
> Feedback? Tests? Ok?

Thank you for fixing the webcam in my Thinkpad T15g5!

I tested:
- 8SSC21K64624V1SR47D21S9 Integrated Camera (T15g5 cam)
- Sunplus IT Co Full HD webcam
- Logitech Webcam C270

They all work fine with video(1) and ffplay (yuy2 stream & mjpeg).

jfyi: ffplay started showing errors when playing the Logitech Webcam C270 mjpeg stream:
...
[mjpeg @ 0xb22d21ed800] unable to decode APP fields: Invalid data found when processing input
[mjpeg @ 0xb22d21ed800] unable to decode APP fields: Invalid data found when processing input
[mjpeg @ 0xb22d21ed800] unable to decode APP fields: Invalid data found when processing input
...

It looks like this is not a driver issue and is simply an effect of unknown frames being forwarded now.
This post explains that Logitech is embedding extra stuff into the mjpeg stream and ffplay finds it:
https://stackoverflow.com/questions/55439184/getting-unable-to-decode-app-fields-while-playing-usb-webcam-stream-through-ff

In case you want to look at the debug output anyway, here's the debug package for this camera:
https://ptrace.org/uvideo_dump_LogiC270.tgz (70MB)

Best regards,
Stefan