Skip to content

feat(hang)!: one continuous broadcast clock at the catalog root - #3675

Merged
kixelated merged 4 commits into
devfrom
quest/m1/broadcast-clock
Sep 17, 2026
Merged

kixelated merged 4 commits into
devfrom
quest/m1/broadcast-clock

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Problem

The broadcast clock lived on the archive timeline section (Archive.timeline.wall), so a live-only publisher had to create an archive timeline just to expose its clock, and every track carried a potentially competing wall epoch. There was no shared clock owner: timeline::Config.wall was a passive timestamp and delayed first frames, source resets, and multi-timescale tracks had no consistent mapping.

Approach

Advertise one fixed broadcast clock at the catalog root as clock: { wall, timescale }, where wall is PTS zero in clock timescale units since the MoQ epoch (2020-01-01T00:00:00Z). Every media track and the archive index refer to it after explicit timescale conversion.

  • moq_mux::Clock is the shared owner (one monotonic epoch, Copy across producers) and publishes its section() at the catalog root from the first snapshot, independently of any archive. catalog::Config::with_clock names a recording import's real start; catalog::Producer::clock shares the epoch.
  • Clock::source (SourceMap) translates a source's own zero onto the mapping: first frame anchors live (accounting for its PTS), resets re-anchor forward preserving the real idle gap, B-frame reordering within a group survives, unmappable sources are refused via Error::UnmappableTimestamp. Wall mapping is never overwritten and system-clock adjustments never retime it.
  • Removed Archive.timeline.wall and timeline::Config.wall with no compatibility alias. Zero timescales and walls past the JSON-safe integer range are refused (Rust + JS).
  • HLS EXT-X-PROGRAM-DATE-TIME and DASH availabilityStartTime map through the root clock; without a catalog clock the manifest falls back to the arrival anchor and playlists omit program-date-time.
  • Mirrored Rust/JS catalog models, updated the Hang draft, added rs/hang/fixtures/catalog-clock.json reader fixture plus clock-owner/HLS-migration tests wired into CI.
  • Completes and deletes quest/m1/broadcast-clock.md, removing its references across the quest tree. Native capture, CLI imports, and js/publish adoption stay in the M2 publisher-clock quest.

Alternatives

  • Keep a per-archive wall with a root alias during migration: rejected, the quest requires no two independently editable wall fields.
  • Per-rendition wall anchors: rejected, the timeline is broadcast-wide and there is one mapping per broadcast.

(Written by Muse Spark)

@kixelated
kixelated marked this pull request as ready for review September 14, 2026 23:19
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 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-09-17T12:33:20.184037Z c15b6cc 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.

Reviewed commit: 7435fdd23c

ℹ️ 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 rs/moq-mux/src/catalog/producer.rs Resolved
Comment thread rs/moq-mux/src/clock.rs Resolved
Comment thread rs/hang/src/catalog/clock.rs Resolved
@kixelated
kixelated force-pushed the quest/m1/broadcast-clock branch from 7435fdd to 36cfa43 Compare September 17, 2026 12:10

@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: 36cfa43806

ℹ️ 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 rs/moq-mux/src/clock.rs Resolved
Comment thread js/hang/src/catalog/clock.ts Resolved
kixelated and others added 4 commits September 17, 2026 05:28
Replaces Archive.timeline.wall with clock: { wall, timescale } advertised at
the catalog root, owned by the shared moq_mux::Clock. HLS program-date-time
and DASH availabilityStartTime map through it after timescale conversion.
Capture stamps from the catalog's advertised clock so HLS/DASH wall times
match the root mapping. Reject wall times before the moq epoch and
explicit null timescales instead of substituting defaults.

Co-Authored-By: grok-4.6 <noreply@x.ai>
SourceMap rejects a mapped timestamp above u64 microseconds instead of
wrapping. The JS clock schema matches Rust's u32 timescale bound.

Co-Authored-By: grok-4.6 <noreply@x.ai>
@kixelated
kixelated force-pushed the quest/m1/broadcast-clock branch from 36cfa43 to c15b6cc Compare September 17, 2026 12:28

@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: c15b6cc157

ℹ️ 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 rs/moq-mux/src/catalog/producer.rs Resolved
Comment thread js/hang/src/catalog/clock.ts Resolved
Comment thread rs/moq-mux/src/clock.rs Resolved
@kixelated
kixelated enabled auto-merge (squash) September 17, 2026 12:46

Copy link
Copy Markdown
Collaborator Author

Rebased onto current origin/dev (including #3711) and enabled squash auto-merge.

Codex findings:

  • Fixed: capture stamps from catalog.clock(); walls before the moq epoch are refused; explicit timescale: null is refused; mapped timestamps past u64 micros are refused; JS clock timescales match Rust u32.
  • Declined this round: stdin/container import mapping (M2 publisher-clock), JS wallClockTime BigInt arithmetic, and a separate high-water mark for B-frame reorder plus reset.

(written by grok-4.6)

@kixelated
kixelated merged commit dbe0eb0 into dev Sep 17, 2026
3 checks passed
@kixelated
kixelated deleted the quest/m1/broadcast-clock branch September 17, 2026 12:59
@moq-bot moq-bot Bot mentioned this pull request Sep 23, 2026
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