Skip to content

fix(media): accept portrait video at the same bound as landscape - #5560

Closed
AleksandarIlic wants to merge 1 commit into
block:mainfrom
Appollo41:fix/portrait-video-resolution
Closed

AleksandarIlic wants to merge 1 commit into
block:mainfrom
Appollo41:fix/portrait-video-resolution

Conversation

@AleksandarIlic

Copy link
Copy Markdown

Summary

  • compare the video resolution bound against the long and short edge instead of raw width and height
  • cover portrait 4K (2160x3840) and a portrait clip one pixel past the long edge

Root cause

validate_video_file() checked width > 3840 || height > 2160, which reads the bound as landscape-only. The same 4K frame is 3840x2160 landscape and 2160x3840 portrait: the first is accepted, the second rejected on height, despite being identical in pixel count, codec, and file size.

This affects anything recorded in portrait above 2160 tall — 4K phone video, and native-resolution phone screen recordings such as 1180x2556. No client caps resolution before upload: the desktop transcode pads to even dimensions without downscaling and mobile uploads at native resolution, so these files are rejected only after the whole body has been received.

Landscape behaviour is unchanged, and the bound still applies in portrait — 2160x3841 is still rejected.

Validation

  • cargo test -p buzz-media: 110 passed, including the two new cases; the existing 3841x2161 rejection test is unaffected
  • cargo check --workspace --all-targets, cargo clippy -p buzz-media -p buzz-relay --all-targets, cargo fmt --all --check: clean
  • cargo test -p buzz-relay --lib: 859 passed; the 8 failures are pre-existing and infra-dependent (Sqlx(PoolTimedOut), no local Postgres/Redis)

Summary

Related issue

Testing

## Summary

- compare the video resolution bound against the long and short edge
instead of raw width and height
- cover portrait 4K (2160x3840) and a portrait clip one pixel past the
long edge

## Root cause

`validate_video_file()` checked `width > 3840 || height > 2160`, which
reads the bound as landscape-only. The same 4K frame is 3840x2160
landscape and 2160x3840 portrait: the first is accepted, the second
rejected on height, despite being identical in pixel count, codec, and
file size.

This affects anything recorded in portrait above 2160 tall — 4K phone
video, and native-resolution phone screen recordings such as 1180x2556.
No client caps resolution before upload: the desktop transcode pads to
even dimensions without downscaling and mobile uploads at native
resolution, so these files are rejected only after the whole body has
been received.

Landscape behaviour is unchanged, and the bound still applies in
portrait — 2160x3841 is still rejected.

## Validation

- `cargo test -p buzz-media`: 110 passed, including the two new cases;
the existing 3841x2161 rejection test is unaffected
- `cargo check --workspace --all-targets`, `cargo clippy -p buzz-media
-p buzz-relay --all-targets`, `cargo fmt --all --check`: clean
- `cargo test -p buzz-relay --lib`: 859 passed; the 8 failures are
pre-existing and infra-dependent (`Sqlx(PoolTimedOut)`, no local
Postgres/Redis)

Signed-off-by: Aleksandar Ilic <aleksandar@appollo41.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@AleksandarIlic
AleksandarIlic requested a review from a team as a code owner August 11, 2026 10:34
@AleksandarIlic

Copy link
Copy Markdown
Author

This was fixed upstream in #6058 (196d62f). Same orientation-independent envelope, and it covers a case I missed here (2161×3840, short edge over). Thanks!

@AleksandarIlic
AleksandarIlic deleted the fix/portrait-video-resolution branch August 24, 2026 21:31
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.

1 participant