Skip to content

feat(hang)!: load CMAF decoding on demand - #6219

Merged
kixelated merged 6 commits into
mainfrom
quest/m1/hang-cmaf-lazy
Oct 22, 2026
Merged

kixelated merged 6 commits into
mainfrom
quest/m1/hang-cmaf-lazy

Conversation

@kixelated

@kixelated kixelated commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Watch loads the fMP4 parser and an unused CMAF encoder even when every rendition uses Legacy or LOC.

Approach

Move the unchanged synchronous decoder and format to @moq/hang/cmaf. Watch imports it only inside CMAF decode/probe paths, with cancellation checks after module loading. Remove the unused encoder and direct encoder-only dependency. Fixed fragments replace encoder-generated test/benchmark input; the browser benchmark retains its decode phase. A benchmark-only resolver adapter keeps comparisons with older Container.Cmaf revisions buildable, with two resolver regression tests. The nightly size check now rejects CMAF in initial Hang/Watch chunks and records its separate chunk.

Impact

  • Breaking API: replace Container.Cmaf (including Watch.Hang.Container.Cmaf) with a synchronous import * as Cmaf from "@moq/hang/cmaf". CMAF encoding exports are removed. Hang and Watch migration notes and current consumers are updated.
  • Watch deployments must serve the generated dynamic chunk. Player calls and catalog shapes are unchanged.
  • Wire: no change. Keep @svta/cml-iso-bmff, decoder behavior, and CMAF bytes unchanged.
  • Present consumers: Watch audio/video CMAF playback, the audio-quality capture formatter, and the browser decode benchmark.

Validation

  • just ci and quest check pass; 277 Hang tests, 59 focused Watch decoder tests, and the full scoped JS suite pass.
  • Chromium browser benchmark smoke passes fixed audio/video decode in base (5e8e0c6841), current, A/A, and copy-control variants. The old-base build fails without the resolver adapter and passes with it.
  • A Chromium module-load check fetches no CMAF chunk for the Watch entry; loading the optional chunk fetches it once and decodes the fixed sample bytes.
  • Identical size builds reduce Watch initial JS from 527,255 to 500,581 raw bytes and 159,780 to 152,007 gzip bytes: 26,674 raw / 7,773 gzip bytes removed. The optional CMAF chunk is 12,359 raw / 4,417 gzip bytes. Watch UI initial JS falls from 575,881 to 549,214 raw bytes. Measurements exclude the deferred chunk from initial bytes.

Alternatives

Keep the current parser rather than add a second parser or an async Hang facade. Remove encoding because its only consumers were tests and the benchmark; current publishing uses Legacy or LOC.

Follow-ups

None. Complete the settled hang-cmaf-lazy quest and remove its references. Browser harness migration is independently owned by #6216.

(Written by GPT-6)

kixelated and others added 3 commits October 21, 2026 15:45
Co-Authored-By: GPT-6 <noreply@openai.com>
Remove the unused CMAF encoder and keep synchronous decoding behind @moq/hang/cmaf. Watch imports it only on CMAF paths. Preserve decoder input as fixed fixtures, migrate timing-only tests to Legacy, and measure the dynamic chunk boundary.

Co-Authored-By: GPT-6 <noreply@openai.com>
Co-Authored-By: GPT-6 <noreply@openai.com>
@kixelated
kixelated marked this pull request as ready for review October 21, 2026 23:00
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 44 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7400f035-da57-4516-9c62-596db7793c9a
📥 Commits

Reviewing files that changed from the base of the PR and between bce217e and b8e35ba.

⛔ Files ignored due to path filters: 1
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing: 31
  • bench/README.md
  • bench/browser/build.ts
  • bench/browser/driver.ts
  • bench/browser/page/cmaf.ts
  • bench/browser/workspace.test.ts
  • bench/browser/workspace.ts
  • doc/lib/js/hang.md
  • js/hang/MIGRATE.md
  • js/hang/README.md
  • js/hang/package.json
  • js/hang/src/cmaf/decode.test.ts
  • js/hang/src/cmaf/decode.ts
  • js/hang/src/cmaf/fixtures.json
  • js/hang/src/cmaf/format.test.ts
  • js/hang/src/cmaf/format.ts
  • js/hang/src/cmaf/index.ts
  • js/hang/src/container/cmaf/encode.test.ts
  • js/hang/src/container/cmaf/encode.ts
  • js/hang/src/container/cmaf/index.ts
  • js/hang/src/container/consumer.test.ts
  • js/hang/src/container/index.ts
  • js/watch/MIGRATE.md
  • js/watch/src/audio/decoder.test.ts
  • js/watch/src/audio/decoder.ts
  • js/watch/src/video/decoder.test.ts
  • js/watch/src/video/decoder.ts
  • quest/m1/README.md
  • quest/m1/fmp4-import-unwrap.md
  • quest/m1/hang-cmaf-lazy.md
  • sh/size/bundles.ts
  • test/audio-quality/clients/js/src/capture.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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-22T06:03:25.310359Z b8e35ba New commits
ℹ️ 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.

@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.

ℹ️ 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 thread bench/browser/page/cmaf.ts Resolved
kixelated and others added 2 commits October 21, 2026 16:15
Co-Authored-By: GPT-6 <noreply@openai.com>
Co-Authored-By: GPT-6 <noreply@openai.com>
@kixelated

Copy link
Copy Markdown
Collaborator Author

Quest outcome: complete. The decoder is synchronous at @moq/hang/cmaf, Watch loads it only for CMAF paths, the unused encoder is removed, and current consumers/migration notes are updated. No wire change or parser replacement.

just ci passes on the final tree. Comparative Chromium CMAF smoke passes old base/current/A-A/copy; the decoder import compatibility finding is fixed, regression-tested, replied to, and resolved. Codex completed review of code commit 248a32b3c8 with no remaining findings and a thumbs-up. Final b0933ae8b7 only corrects the benchmark README; its GitHub CodeQL runs are still progressing. CodeRabbit's rate-limited attempt does not count as a review.

No open decisions or follow-up quests. Recommend /quest-merge once the final required checks/review state is clear. This batch does not authorize merging or enqueueing.

(Written by GPT-6)

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

Copy link
Copy Markdown
Collaborator Author

Merged origin/main (b8e35ba). Conflicts were mechanical: consumer.test.ts now imports the union of both sides (readFileSync from this PR, Manual/Nano from main), and js/watch/MIGRATE.md keeps both Unreleased entries. No new users of Container.Cmaf or the removed encoder came in from main; demo/web has no CMAF consumers. Scoped just check passes.

Codex's only finding (baseline benchmark resolver) was fixed in 248a32b, which Codex then reviewed with no findings; later changes are docs and this merge. Enabling auto-merge.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 22, 2026
Merged via the queue into main with commit 6522287 Oct 22, 2026
11 checks passed
@kixelated
kixelated deleted the quest/m1/hang-cmaf-lazy branch October 22, 2026 08:29
kixelated added a commit that referenced this pull request Oct 22, 2026
Keep both MIGRATE.md Unreleased entries, and drop the hang-cmaf-lazy
and fmp4-import-unwrap quests, finished by #6219 and this PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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