Skip to content

fix(moq-mux): send the H.265 picture aspect, not the pixel aspect (backport #5574) - #6631

Merged
kixelated merged 1 commit into
releasefrom
backport/h265-display-aspect
Oct 24, 2026
Merged

kixelated merged 1 commit into
releasefrom
backport/h265-display-aspect

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Backport of #5574 onto release, so the next moq-mux and libmoq patch put the H.265 picture's display aspect in the catalog, not the VUI sample aspect. Reported in #6536.

Why

On release, the H.265 importer copies the VUI aspect_ratio_info (the sample aspect) into displayAspectWidth/displayAspectHeight. A 1280x720 hevc_nvenc stream signalling square samples (aspect_ratio_idc 1) gets 1:1, which @moq/watch hands to WebCodecs as the whole picture's aspect, so 16:9 video plays square.

Change

A cherry-pick of #5574's code, which applied cleanly:

  • VuiData now holds the sample aspect, and display_aspect turns it into the picture aspect: none for square samples, otherwise width*sar_w : height*sar_h reduced (1440x1080 at 4:3 becomes 16:9).
  • SpsHead::from_rbsp crops the conformance window with checked arithmetic and refuses a window that leaves no picture, instead of scuffle_h265's unchecked cropped_width, so the aspect math never sees a zero or wrapped size.
  • Doc comments on hang::catalog::VideoConfig, moq_mux::catalog::VideoHint, MoqVideoHint, and the js/hang schema say the fields are the picture aspect.
  • Tests: real hevc_nvenc SPS fixtures for square (no aspect) and anamorphic (16:9) samples, plus the empty conformance window refusal.

Left out: the drafts/draft-lcurley-moq-hang.md wording, which conflicts with release's draft (no moq-hang-04 changelog) and is versioned on main.

API and wire impact

None. No signatures or fields change; only doc comments and what value the H.265 importer writes. Ships as a patch.

Checks

just check origin/release passes: Rust (nextest, 2404 + 387 + 133 + 78 tests), clippy, biome, and the doc and Python checks it selected. cargo nextest run -p moq-mux h265: 33 passed.

The quest tracking this, #6619, closes the issue on main and should merge after this one.

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

…ckport #5574)

The H.265 importer copied the VUI sample aspect into the catalog's
displayAspectWidth/Height, so a 1280x720 square-pixel stream played square
in @moq/watch. It now omits the fields for square samples and sends the
whole picture's aspect otherwise, and refuses an SPS whose conformance
window crops the picture to nothing.

The draft-lcurley-moq-hang.md wording change stays on main, where the
draft is versioned.

Co-authored-by: Adidharma Torutama <adidharmatoru@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit d91b042)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T07:50:39.356645Z 0d70b8c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

kixelated added a commit that referenced this pull request Oct 24, 2026
The release backport is #6631.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d70b8c031

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +288 to +290
let display_aspect = vui_data.display_aspect(head.width, head.height);
config.display_aspect_width = display_aspect.map(|(width, _)| width);
config.display_aspect_height = display_aspect.map(|(_, height)| height);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Synchronize the draft's aspect-ratio semantics

This backport changes the aspect ratio emitted in the catalog and clarifies its meaning in both language schemas, but leaves drafts/draft-lcurley-moq-hang.md unchanged. Its video section still describes stretching coded pixels and a “1:1 ratio” without explicitly distinguishing sample aspect from whole-picture aspect, the distinction responsible for this playback bug. Update that wording alongside the implementation; the applicable cross-language rule requires catalog changes to update the draft in the same PR, including for this backport.

AGENTS.md reference: rs/moq-mux/AGENTS.md:L14-L14

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Leaving this as is. The maintainer accepted keeping the draft wording off release: release's copy of drafts/draft-lcurley-moq-hang.md predates the versioned moq-hang-04 changelog the wording change lands under, so porting it would mean inventing a draft revision that never shipped. The wording landed on main with #5574, where the draft is versioned, and this backport changes no wire format: the catalog fields keep their names and types, and only the doc comments and the value the H.265 importer writes change.

(Written by Claude Opus 5.5)

@kixelated

Copy link
Copy Markdown
Collaborator Author

Merging: Codex reviewed head 0d70b8c and required Check passed. Its one finding (port the draft wording) is declined, since the maintainer accepted keeping that change on main only; see the reply in the thread. No code changed during the merge pass. Lands as a merge commit, per CONTRIBUTING for PRs into release. #6619 follows on main to delete the quest and close #6536.

(Written by Claude Opus 5.5)

@kixelated
kixelated merged commit ded4341 into release Oct 24, 2026
9 checks passed
@kixelated
kixelated deleted the backport/h265-display-aspect branch October 24, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant