Repository navigation
Conversation
bestFormat ranked formats by pixel area alone, so cameras whose largest mode is uncompressed YUYV over USB 2.0 opened at 2 fps. On a Logitech C925e that is 2304x1536 YUYV, while the same camera offers 1920x1080 MJPEG at 30 fps. Formats below 15 fps now lose to any format that reaches it; among usable formats the largest still wins, so 4K at 15 fps is still preferred over 1080p at 30 fps as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
[Medium impact] The change affects the default camera format used for preview and capture. The PR appears safe to merge, with a non-blocking test gap for cameras whose formats all fall below 15 fps. Findings
SummaryThis PR prefers the largest camera format whose target rate reaches 15 fps.
Reviews (1) · Last reviewed commit: "Default to the largest camera format tha..." · Reviewed by Greptile |
| // Logitech C925e: YUYV at sensor maximum only manages 2 fps. | ||
| QList<media::Format> c{{{2304,1536},2,2,1}, {{1920,1080},5,30,2}, {{1920,1080},5,5,1}, {{640,480},5,30,1}}; | ||
| QCOMPARE(media::bestFormat(c),1); |
There was a problem hiding this comment.
Slow-camera fallback lacks tests
The new test always includes formats that reach 15 fps, so it does not cover the new fallback: when every format is slower, pick the fastest before comparing size. A future change could restore size-first selection for slow cameras without failing this test. Add a case where a smaller, faster format wins, plus an equal-rate tie where the larger format wins.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Thanks for this, and for the C925e case. #19 fixes the same 2 fps default the same way (formats slower than 15 fps lose when a faster one exists), so I merged that one and I'm closing this as a duplicate. |
The problem
media::bestFormatranks formats by pixel area alone. On cameras whose largest mode is uncompressed YUYV over USB 2.0, that picks a mode the camera can only deliver at 2 fps. On a Logitech C925e the default is 2304×1536 YUYV @ 2 fps, while the same camera offers 1920×1080 MJPEG @ 30 fps. #14 reports the same with a C920 PRO (2560×1472 @ 2 fps).The change
A format whose target rate is below 15 fps now loses to any format that reaches 15 fps. Among usable formats the existing ordering is unchanged, so the existing expectation (4K @ 15 fps beats 1080p @ 30 fps) still holds. If no format reaches 15 fps, the fastest is preferred, then the largest.
This only changes the default, so it complements the picker in #14 rather than competing with it: users who never open the picker no longer start at 2 fps.
Testing
bin/test: backend 18/18 and UI 3/3 pass, including a newformatSelectioncase modelled on the C925e's format list.1920 × 1080 · up to 30 fpsand is smooth (previously 2 fps).🤖 Generated with Claude Code