Skip to content

fix(moq-mux): ts passthrough shifts onto the catalog clock - #5117

Merged
kixelated merged 1 commit into
mainfrom
fix/ts-passthrough-anchor
Oct 9, 2026
Merged

kixelated merged 1 commit into
mainfrom
fix/ts-passthrough-anchor

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Problem

main no longer compiles moq-mux: #5003 (import ts --passthrough) and #5082 (importers shift onto a catalog clock already in use) crossed. Passthrough still calls catalog::Producer::anchor(timestamp), which #5082 made private and reshaped (E0624 at container/ts/passthrough.rs:622).

Approach

Passthrough follows #5082's shared-clock rule like the other importers: it keeps its reservation's Timebase and shifts every object's PCR time through it. The first object (always a group start) anchors the offset: zero when it places the clock, so timestamps stay verbatim; otherwise it lands at now on the clock already in use, which never moves.

The shift is one constant applied after the PCR timeline is built, so passthrough's invariants hold unchanged: timestamps never step back, objects carry PCR time, and a flagged forward jump adds its step. Module docs say where the shift applies.

New test an_import_shifts_onto_a_clock_already_in_use: a capture takes the clock, then a feed an hour in (with a flagged 20 s jump) imports onto it. The clock is unchanged, the first object lands at now, and every object equals the verbatim import shifted by one offset. It fails with the shift removed. The passthrough suite and ts_passthrough_crosses_a_relay_through_a_flagged_jump pass.

Impact

  • ts::Passthrough onto a catalog whose clock is already in use (taken, published, or Config::with_clock) now shifts its timestamps onto that clock instead of re-anchoring it, like every other importer since feat(mux)!: importers shift onto a catalog clock already in use #5082.
  • No public API change. Wire: none. The CLI (moq import ts --passthrough) places a fresh clock, so its timestamps stay verbatim PCR time and draft-lcurley-moq-mpegts is unchanged.

Alternatives

Follow-ups

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

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

chatgpt-codex-connector Bot commented Oct 9, 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-09T21:39:54.995268Z a7103ad 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.

@coderabbitai

coderabbitai Bot commented Oct 9, 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 13 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: 14db6f9a-f556-4128-bed7-7621ced3c509

📥 Commits

Reviewing files that changed from the base of the PR and between 38066fd and a7103ad.


📒 Files selected for processing (2)
  • rs/moq-mux/src/container/ts/passthrough.rs
  • rs/moq-mux/src/container/ts/passthrough_test.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.

@kixelated

Copy link
Copy Markdown
Collaborator Author

Grok review of a7103ad4

Fixes the main build break from #5003 × #5082 by routing passthrough through its reservation's Timebase::shift instead of the now-private Producer::anchor. I checked it against catalog/timebase.rs on main and it looks right.

Blocking: none.

Non-blocking

  • passthrough.rs:~612: the shift now anchors on whichever object reaches write first, not inside the group.is_none() branch like the old anchor call was. The comment says that object always starts a group, and I agree it does today. A debug_assert!(self.group.is_none() || self.shift.offset().is_some()) (or similar) would keep that from regressing silently.
  • self.written and Group::ticks stay in unshifted PCR ticks while the published timestamps are shifted. That's consistent, since the offset is one constant, but a line in the doc saying the monotonic guard runs before the shift would help the next reader.
  • If the shift is negative, Offset::apply refuses anything below zero. That can't happen after the first object, because PCR time never steps back, so it's fine. The error surfaces as UnmappableTimestamp rather than a PCR error, though, if that ever changes.
  • CI (Check, Test, and the platform jobs) hadn't reported on this head yet when I reviewed. Since this PR is the build fix, let it go green before merging.

The new test is a good one: the clock isn't moved, the first object lands at now, and every object gets one offset across a flagged jump.

Verdict: MERGE (once CI is green)

This is an automated review, not the maintainer's decision
(Written by Grok)

@kixelated kixelated left a comment

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.

Automated review by review (OpenAI)

Reviewed commit: a7103ad

No concrete introduced bugs found in the full two-file diff and the surrounding timestamp, reservation, and container-writing paths.

Direction: retaining the reservation's Timebase and applying its constant shift after PCR interpolation and the monotonic guard is the appropriate small fix. It preserves group boundaries and discontinuity deltas without reopening Producer::anchor. Public signatures, TS payloads, and framing stay unchanged; shared-clock timestamp values intentionally shift. The new paused-time regression checks the fixed clock and the same offset on every object across a flagged jump.

Verification limits: static GitHub-only review; I did not run builds or tests. Check, Test, macOS, Windows, and Android are still running on this head, so build/test success remains unverified.

(Written by OpenAI)

@kixelated

Copy link
Copy Markdown
Collaborator Author

Summary before merge of a7103ad4080227b756198b20be757d71267db325:

  • Fix: passthrough keeps its reservation's Timebase and shifts each object's PCR time through it, replacing the call to the now-private Producer::anchor. CI is green (Check, Test, macOS, Windows, Android); the OpenAI review found nothing and Codex gave a thumbs up.
  • On the Grok notes, left as is so the build fix lands without another review round:
    • First object anchoring: an object is only opened before the first group when it starts one, and expect("the first object starts a group") a few lines below already panics if that ever regresses, so a debug_assert would only repeat it.
    • Monotonic guard before the shift: since the offset is one constant, guarding unshifted ticks is the same as guarding shifted ones. The module docs now say the shift is applied after the PCR timeline is built.
    • Negative shift: it can't go below zero after the first object, as the review says.
  • Decision: draft-lcurley-moq-mpegts stays unchanged. The CLI places a fresh clock, so its timestamps are still verbatim PCR time. feat(mux)!: importers shift onto a catalog clock already in use #5082 also left the demuxed lane's "timestamped with its PTS" wording alone.

(Written by Claude Opus 5.5)

@kixelated
kixelated merged commit 3e9f839 into main Oct 9, 2026
7 checks passed
@kixelated
kixelated deleted the fix/ts-passthrough-anchor branch October 9, 2026 21:53
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