Skip to content

hang: re-emit deprecated CMAF timescale/trackId in catalog#1440

Merged
kixelated merged 1 commit into
mainfrom
backwards-compatible-cmaf
May 22, 2026
Merged

hang: re-emit deprecated CMAF timescale/trackId in catalog#1440
kixelated merged 1 commit into
mainfrom
backwards-compatible-cmaf

Conversation

@kixelated
Copy link
Copy Markdown
Collaborator

Summary

Older players parse CMAF timescale and trackId from explicit catalog fields. The current schema moves both into the base64 init segment, which breaks anything pinned to @moq/hang@0.2.4 or earlier — see the \$ZodError thrown by the deployed moq-pilot web client this afternoon, where the new publisher's catalog (init-only) failed validation against the old schema.

  • rs/hang/src/catalog/container.rs: add timescale: Option<u32> and track_id: Option<u32> to Container::Cmaf, both #[deprecated] and skipped on serialize when None. They're accepted (and ignored) on deserialize so catalogs from either side round-trip.
  • rs/moq-mux/src/import/fmp4.rs: populate both fields from trak.mdia.mdhd.timescale / trak.tkhd.track_id when constructing the CMAF container during fMP4 import. This is the path the publisher actually uses, so freshly-published catalogs now carry the legacy fields again.
  • All other call sites use .. in the pattern or pass None (FFI fallback / tests).
  • js/hang/src/catalog/container.ts: accept the deprecated fields as optional.

Serde's derive doesn't propagate #[deprecated] into its generated read/write code, and our one populating site uses struct-init syntax that doesn't trigger the lint either, so the workspace builds clean.

Test plan

  • cargo build --workspace
  • cargo test -p hang -p moq-mux (84 passed)
  • After publish, confirm an old-version watcher (@moq/hang@0.2.4) can decode a CMAF catalog from the new publisher.

🤖 Generated with Claude Code

Players that predate the `init` field in the CMAF container parse
`timescale` and `trackId` directly off the catalog. The current schema
moves both into the base64 init segment, which breaks those older
players (e.g. anything pinned to `@moq/hang@0.2.4`).

Add both fields back as optional, `#[deprecated]` for Rust consumers,
and populate them on the fMP4 import path so newly-published catalogs
stay readable by old and new clients alike. The JS schema accepts them
as optional so round-tripping is clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b207f7dc-7533-4a79-809d-1d8b9993d3a2

📥 Commits

Reviewing files that changed from the base of the PR and between ececd8e and b1b13f6.

📒 Files selected for processing (8)
  • js/hang/src/catalog/container.ts
  • rs/hang/src/catalog/container.rs
  • rs/moq-ffi/src/media.rs
  • rs/moq-mux/src/catalog/producer.rs
  • rs/moq-mux/src/container/hang.rs
  • rs/moq-mux/src/export/fmp4.rs
  • rs/moq-mux/src/import/fmp4.rs
  • rs/moq-mux/src/import/test/mod.rs

Walkthrough

This pull request extends the CMAF container variant with optional timescale and track_id metadata fields across the moq codebase. The TypeScript schema and Rust enum are expanded to accept these fields, which are extracted from MP4 track metadata during import and marked as deprecated since they duplicate values derivable from the init segment. The FFI layer explicitly handles conversions to control field visibility. All pattern matches for Container::Cmaf are updated to use resilient destructuring syntax ({ init, .. }) to accommodate the new optional properties without breaking existing behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 54.55% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: re-emitting deprecated CMAF timescale/trackId fields for backward compatibility with older clients.
Description check ✅ Passed The description is directly related to the changeset, explaining the backward compatibility problem and detailing all modifications across multiple files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch backwards-compatible-cmaf
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch backwards-compatible-cmaf

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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 and usage tips.

@kixelated kixelated enabled auto-merge (squash) May 22, 2026 18:08
@kixelated kixelated merged commit d7b10a3 into main May 22, 2026
1 check passed
@kixelated kixelated deleted the backwards-compatible-cmaf branch May 22, 2026 18:24
@moq-bot moq-bot Bot mentioned this pull request May 22, 2026
kixelated added a commit that referenced this pull request May 22, 2026
After merging main, Container::Cmaf grew optional deprecated timescale
and track_id fields (#1440) that consumers re-derive from init. The MSF
catalog doesn't carry either at the wire level, so populate them as
None when constructing Cmaf from an MSF track.

Co-Authored-By: Claude Opus 4.7 (1M context) <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