Skip to content

fix: the snapshot keeps the single view's aspect ratio (#248) - #250

Merged
compot-dev merged 3 commits into
v2from
fix/snapshot-aspect-248
Oct 20, 2026
Merged

compot-dev merged 3 commits into
v2from
fix/snapshot-aspect-248

Conversation

@compot-dev

@compot-dev compot-dev commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #248.

In /snapshot.jpg and on the debug page, the single view's camera was copied straight into its 16:9 cell, so a picture of another aspect ratio, such as a slot turned 90° (portrait), was stretched. On the screen it is fitted with black bars.

Change.

  • Snapshots.Cell.aspect: width / height of the picture as the screen shows it; the single view's cell gets it from the view's video size (after Turn). Grid cells keep 0 and fill their cell as before.
  • Snapshots.fit(): the largest rectangle of that ratio centred in the cell (the whole cell for 0 or a ratio within 1 %, so no one-pixel bars); PixelCopy copies into that rectangle and the frame is drawn there.
  • SnapshotsTest; docs/debug.md.

Version 2.18.1 (PATCH). PR #220 (also 2.18.1 now) waits for a reporter's test and will move on to 2.18.2 if this merges first.

  • Docker build as CI: testDebugUnitTest (362 tests, incl. SnapshotsTest), lintDebug, assembleDebug; version check
  • Aceline-1, CI build 2.18.1 cdac5da: single view of a 2560×1920 H.265 slot turned 90° → its /snapshot.jpg cell shows the portrait picture centred with black bars (was stretched); a 16:9 H.264 slot fills its cell as before; the 3×3 grid snapshot unchanged (9 cells); 0 FATAL EXCEPTION / ANR in

)

A turned (portrait) picture was copied straight into the 16:9 cell and
stretched; it is now fitted, centred, with black around it, as the screen
shows it.
@compot-dev
compot-dev marked this pull request as ready for review October 20, 2026 09:30
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Preserve single-view aspect ratio in snapshots

🐞 Bug fix 🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Fit single-view pictures within snapshot cells, preventing turned portrait video from stretching.
• Keep grid cells unchanged and avoid narrow bars for nearly matching aspect ratios.
• Add fitting tests, update debug documentation, and release version 2.18.1.
Diagram

graph TD
  Single["Single view"] --> Cells["Snapshot cells"] --> Fit["Aspect fit"] --> Copy["PixelCopy"] --> Canvas["JPEG canvas"] --> Clients["Snapshot clients"]
  Grid["Grid views"] --> Cells
Loading
High-Level Assessment

Keep the cell-level fit: it corrects both snapshot consumers without changing on-screen rendering or grid-cell behavior. Reusing the existing screen-fitting helper would still require snapshot-specific centering and near-match handling, so it offers little architectural benefit.

Files changed (6) +82 / -6

Bug fix (2) +35 / -2
Decoder.javaPass single-view video aspect to snapshot cells +4/-0

Pass single-view video aspect to snapshot cells

• Sets the on-screen single-view cell’s aspect ratio from its displayed video dimensions when available. Other cells retain the default fill behavior.

android/app/src/main/java/com/openipc/decoder/Decoder.java

Snapshots.javaFit snapshot frames within their cells +31/-2

Fit snapshot frames within their cells

• Adds an optional cell aspect ratio and computes a centered destination rectangle, leaving zero or nearly matching ratios at full-cell size. PixelCopy uses the fitted dimensions, and the JPEG canvas draws the result in that rectangle.

android/app/src/main/java/com/openipc/decoder/Snapshots.java

Tests (1) +37 / -0
SnapshotsTest.javaTest snapshot aspect fitting +37/-0

Test snapshot aspect fitting

• Adds unit tests for full-cell fitting, near-matching ratios, centered portrait frames, and wider frames with bars above and below.

android/app/src/test/java/com/openipc/decoder/SnapshotsTest.java

Documentation (2) +8 / -2
CHANGELOG.mdDocument the 2.18.1 snapshot fix +7/-1

Document the 2.18.1 snapshot fix

• Adds a 2.18.1 entry describing the corrected single-view snapshot aspect ratio. Also adjusts the 2.18.0 heading date.

CHANGELOG.md

debug.mdClarify single-view snapshot presentation +1/-1

Clarify single-view snapshot presentation

• Documents that the debug page and snapshot fit the on-screen single-view picture within its grid cell rather than stretching turned video.

docs/debug.md

Other (1) +2 / -2
build.gradleBump the app to 2.18.1 +2/-2

Bump the app to 2.18.1

• Increments versionCode from 43 to 44 and versionName from 2.18.0 to 2.18.1.

android/app/build.gradle

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can open the rule or relationship behind a finding in one click

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@compot-dev
compot-dev merged commit 3400117 into v2 Oct 20, 2026
7 checks passed
@compot-dev
compot-dev deleted the fix/snapshot-aspect-248 branch October 20, 2026 09:32
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.

Snapshot: a turned single-view picture is stretched to the 16:9 cell

1 participant