Repository navigation
fix(recording): let a webcam's MJPEG mode win when it is faster or sharper - #1129
Conversation
…arper chooseWebcamFormat excluded every compressed mode as soon as a camera offered one uncompressed mode. A Logitech C920 only reaches 1080p at 30 in MJPEG (its YUY2 1080p runs at 5 fps), so it was driven at YUY2 800x448 on every preset. Compressed modes now compete on useful frame rate and pixels like any other; an uncompressed mode only breaks a tie. What stays out is a compressed mode whose decode costs more than 1080p at 30, counted at the rate the camera runs. Decoding MJPEG to NV12 through the helper's own source-reader setup on a Ryzen 7 5800X takes 4.9 ms a frame at 1080p, 9.2 ms at 1440p and 19.7 ms at 4K (p95 22.7), so a BRIO keeps its uncompressed 1080p30 rather than decode 4K. Refs #1112
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to The change selects better webcam modes, such as MJPEG 1080p30 for the C920. The capture path already enables the conversion needed for the new selections, so no merge-blocking risk was found. Testing on real C920 hardware and slower CPUs was not performed. Pre-merge checks |
|
Summary
A Logitech C920 is driven at YUY2 800x448 on every preset because
chooseWebcamFormatdrops all compressed modes as soon as one uncompressed mode exists. The camera only reaches 1080p at 30 fps in MJPEG; its YUY2 1080p mode runs at 5 fps.Measured on a Ryzen 7 5800X, decoding MJPEG to NV12 with the helper's own source-reader setup (
ReadSampleper frame, unpaced):At 30 fps the frame interval is 33 ms. 1080p takes 15% of it, and 4K takes 60% on an idle desktop.
Related issue
Refs #1112
Type of change
Release impact
Desktop impact
Testing
webcam_format_testcovers the C920, BRIO and StreamCam lists on all three presets, plus the tie-break and the decode ceiling. Built with MSVC and run: all pass. Onmainit fails on the three C920 cases (expected 1920x1080@30, got 800x448@30).ReadSample33.3 ms, paced by the camera). On Windows 11 the Frame Server already decodes it, because it lists an NV12 copy of every MJPEG mode. The chooser still picks NV12 1920x1080@30 on that camera, as before.🤖 Generated with Claude Code
Summary by CodeRabbit