Skip to content

Default to the largest camera format that sustains 15 fps - #18

Closed
liberuum wants to merge 1 commit into
omacom:masterfrom
liberuum:default-usable-frame-rate
Closed

liberuum wants to merge 1 commit into
omacom:masterfrom
liberuum:default-usable-frame-rate

Conversation

@liberuum

@liberuum liberuum commented Nov 5, 2026

Copy link
Copy Markdown

The problem

media::bestFormat ranks 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 new formatSelection case modelled on the C925e's format list.
  • Real hardware, C925e on Omarchy: the preview now opens at 1920 × 1080 · up to 30 fps and is smooth (previously 2 fps).

🤖 Generated with Claude Code

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>
@greptile-apps

greptile-apps Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[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

  1. P2 Slow-camera fallback lacks tests ▶

Summary

This PR prefers the largest camera format whose target rate reaches 15 fps.

  • The default camera choice favors formats that reach 15 fps.

Reviews (1) · Last reviewed commit: "Default to the largest camera format tha..." · Reviewed by Greptile

Comment thread tests/backend_tests.cpp
Comment on lines +44 to +46
// 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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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!

gigasolo added a commit to gigasolo/monologue that referenced this pull request Nov 6, 2026
The 15 fps ceiling from omacom#18 prefers the faster of two slow modes.
The skip from omacom#19 already drops a slow mode when a smoother one
exists, which is the C925e and Brio case, and otherwise keeps the
largest. Applying the ceiling on top of that skip would undo that.
@dhh

dhh commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

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.

@dhh dhh closed this Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants