Skip to content

fix(mux): keep access unit delimiters before injected parameter sets - #6001

Merged
kixelated merged 4 commits into
mainfrom
quest/m1/ts-reliability/aud-first
Oct 20, 2026
Merged

kixelated merged 4 commits into
mainfrom
quest/m1/ts-reliability/aud-first

Conversation

@kixelated

@kixelated kixelated commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Keyframes beginning with an access unit delimiter (AUD) currently export parameter sets before the AUD, violating Annex B ordering.

Closes #5951.

Approach

Keep the leading AUD before injected parameter sets in both the TS writer and the shared Annex B conversion used by elementary exporters, RTC, and the video decoder. The TS writer passes the codec it knows from the stream type; from_length_prefixed, whose signature carries no codec, identifies it from the injected parameter-set header so an H.265 slice header is never mistaken for an H.264 AUD. Payloads without a leading AUD keep their existing allocations and bytes.

Add regressions for both writers and codecs, all length-prefix widths in the shared converter, non-keyframes, prefixless conversion, and overlapping codec headers. Remove the completed quest.

Impact

  • Public API: unchanged; take_delimiter and InBandCodec::of_parameter_set are crate-private.
  • MoQ wire and catalog: unchanged. Generated H.264 Annex B bytes now order AUD, SPS, PPS, then remaining NALs. H.265 orders AUD, VPS, SPS, PPS, then remaining NALs.

Alternatives

Inferring the codec only from the payload can mistake an H.265 slice for an H.264 AUD. Rebuilding a shared parameter prefix in the TS path adds an unnecessary allocation.

Decisions (iterate round)

No maintainer decision was given for this round; each choice took the recommended option.

  1. How take_delimiter learns the codec
    • ✅ Take an InBandCodec; the TS writer passes its stream type's codec and only from_length_prefixed infers it from the prefix header (recommended: the type names the codec, and the inference lives where it is needed)
    • Keep the raw parameter-set header byte argument for both callers
  2. Merge conflict with origin/main in ts/export.rs

Follow-ups

  • annexb::length_prefixed_to_annexb is now only used by its own tests. Removing it is a public API break, so it belongs in a separate change.

Checks

  • Reproduced both ordering regressions before the source fix.
  • Passed full just check at adaced1 through the Nix dev shell after merging origin/main (3,529 workspace tests).
  • Earlier: passed just test interop --publishers rust,python,go,cpp --subscribers rust,python,go,cpp,js-native-node,js-native-bun,c,gst --timeout 30. Browser-inclusive just test interop --all was blocked locally (pinned Chromium cannot launch without libglib). This change touches no wire, FFI, or gateway code.
  • The regression tests run in the existing Rust CI test gate.

(written by GPT-6.1-Sol, updated by Claude Opus 5.5)

🤖 Generated with Claude Code

kixelated and others added 4 commits October 19, 2026 13:37
Co-Authored-By: GPT-6.1-Sol <noreply@openai.com>
…ty/aud-first

# Conflicts:
#	rs/moq-mux/src/container/ts/export.rs
The TS writer already knows its codec from the stream type, so only
from_length_prefixed, whose signature carries no codec, infers it from
the injected parameter-set header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review October 20, 2026 00:27
@coderabbitai

coderabbitai Bot commented Oct 20, 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 29 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: 869aa276-5191-4ed1-80a5-7ca4a5c08a1b
📥 Commits

Reviewing files that changed from the base of the PR and between 48c8a66 and adaced1.

📒 Files selected for processing: 4
  • quest/m1/ts-reliability/README.md
  • quest/m1/ts-reliability/aud-first.md
  • rs/moq-mux/src/codec/annexb.rs
  • rs/moq-mux/src/container/ts/export.rs
  • 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 20, 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-20T00:29:49.685556Z adaced1 Draft marked ready
ℹ️ 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
kixelated added this pull request to the merge queue Oct 20, 2026
Merged via the queue into main with commit 7e512ff Oct 20, 2026
12 of 13 checks passed
@kixelated
kixelated deleted the quest/m1/ts-reliability/aud-first branch October 20, 2026 01:50
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.

export ts: keyframe parameter sets are written ahead of the access unit delimiter

1 participant