Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
1478b4f
fix(mux): the TS export follows a PMT revision at the next version
t0ms Oct 22, 2026
fd667d9
fix(mux): a TS track taking a PID over waits for the old one's tail
t0ms Oct 22, 2026
54214cf
fix(mux): a TS takeover holds across generations, and a drain keeps i…
t0ms Oct 22, 2026
a9d87ee
fix(moq-mux): a PMT revision rewrites every copy not yet out, a drain…
t0ms Oct 22, 2026
1fa312a
fix(moq-mux): a PID taken over leaves its buffer behind, draining des…
t0ms Oct 22, 2026
348d251
fix(moq-mux): the PCR moves behind the PMT naming its PID, draining s…
t0ms Oct 22, 2026
9ce2f52
fix(moq-mux): a cut stream's queue goes with it, the PCR moves behind…
t0ms Oct 22, 2026
44f9627
Merge remote-tracking branch 'origin/main' into quest/m1/ts-reliabili…
kixelated Oct 22, 2026
d92117c
fix(ts): send each PMT revision as one boundary
kixelated Oct 22, 2026
3473558
Merge remote-tracking branch 'origin/main' into quest/m1/ts-reliabili…
kixelated Oct 22, 2026
b9a519c
fix(ts): follow the last PMT out across switches and takeovers
kixelated Oct 22, 2026
3ab02d6
fix(ts): keep revisions on the program, the held frame, and the AAC t…
kixelated Oct 23, 2026
002e2c2
fix(ts): read on a withdrawn track that returns after its listing
kixelated Oct 23, 2026
2b328e4
fix(ts): forget a withdrawal once its subscription is replaced
kixelated Oct 23, 2026
265fc54
Merge remote-tracking branch 'origin/main' into fix-6289
kixelated Oct 23, 2026
4c0800f
fix(mux): cut the jitter track by its name after merging main
kixelated Oct 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/ts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ jobs:
MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs
shell: bash -leo pipefail {0}

# A KLV stream joins the program mid-stream and leaves it: the export announces each
# layout at the next PMT version, and carries the stream only while a PMT lists it.
- name: TS PMT revision
if: ${{ !cancelled() }}
run: nix develop --command just test ts --revision --strict
env:
MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs
shell: bash -leo pipefail {0}

- name: TS audio-only SCTE-35
if: ${{ !cancelled() }}
run: nix develop --command just test ts --clockless audio-scte35
Expand Down
2 changes: 2 additions & 0 deletions drafts/draft-lcurley-moq-mpegts.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ A consumer rebuilding a transport stream:
- MUST place each track on its recorded `pid`, and MUST assign an unused PID to a track with none.
- MUST put the PMT on `program.pmtPid` and build the PAT and PMT from `program`.
- MUST choose a PCR PID and emit PCRs on it at the program clock's repetition interval. With no media stream it MUST use an unused PID with adaptation-only PCR packets and no PMT elementary-stream entry. It MUST NOT refuse a program for lacking video.
- MUST follow the catalog as it changes: when a track joins or leaves `tracks` or `programDescriptors` changes, it MUST emit a PMT at the next `version_number` (modulo 32) before any packet of a stream it adds, and MUST NOT emit a stream's packets after a PMT that no longer lists it. Each version it emits MUST differ from the one before, and no older version may follow a newer one. The PCR PID MUST NOT move until the stream it rides ends.
- MUST re-emit each track's `descriptors` as its ES-level descriptors, and `programDescriptors` as the PMT's `program_info`.
- MUST re-emit each `si` entry's sections byte-for-byte on that entry's PID, reading them from its track ({{si-track}}), at least as often as its `interval` when declared.
- MUST packetize each `verbatim` frame as one section on its track's PID.
Expand Down Expand Up @@ -457,6 +458,7 @@ A broadcast demultiplexed from a DVB transport stream: video and audio described
- A flagged PCR jump on an `m2ts` track follows hang's discontinuity marker rather than a skipped group sequence.
- An `m2ts` track unwraps PCRs from its history, clamps extrapolated object times at a forward discontinuity, and cuts a fallback group after one second. `randomAccess` covers every published group; `muxRate` follows the measured source rate.
- A `tracks` entry is never changed in place: a stream the PMT revises continues under a new name, and one it drops leaves the section. `programDescriptors` follows the PMT; `program`'s `transportStreamId` and `programNumber` do not change.
- A consumer rebuilding a stream follows the catalog's revisions at the next PMT `version_number`, and carries a stream only while a PMT lists it.

## draft-lcurley-moq-mpegts-00
{:numbered="false"}
Expand Down
4 changes: 2 additions & 2 deletions quest/m1/ts-reliability/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ refused means an error or a counted drop.
| CAT, EMM/ECM, ATSC PSIP, other SI PIDs, unlisted PIDs, TS scrambling | Outside the profile, raw lane; counted when the import reads every program. Today dropped uncounted | [routes](/quest/m1/ts-reliability/stream-routes.md) |
| DVB SI on 0x0010, 0x0011, 0x0012, 0x0014 | Preserved: snapshot track per PID and `table_id` | landed |
| Program identity, program and ES descriptors | Preserved: descriptors follow each PMT revision; an identity change refuses | landed |
| PMT add, remove, retype; PID reuse | Normalized without a new epoch: a changed or reused PID ends its track and continues under a fresh name, and the PMT is rebuilt at the next `version_number`. Import landed; today refusal or stale PMT on export | [PMT export](/quest/m1/ts-reliability/pmt-export.md) |
| PMT add, remove, retype; PID reuse | Normalized without a new epoch: a changed or reused PID ends its track and continues under a fresh name, and the export rebuilds the PMT at the next `version_number`. Today `export ts --sync` ends at an added track and announces no other revision | [PMT export](/quest/m1/ts-reliability/pmt-export.md) |
| PAT changes: moved PMT PID, programs added or removed | Normalized: followed; a removed program retires, and returns as a new epoch. Today ignored, or the whole multiplex stops | [PAT changes](/quest/m1/ts-reliability/pat-lifecycle.md) |
| Programs without video | Preserved when the PMT names a PCR PID; refused without one | landed |
| PCR | Normalized: rebased, carried on the first video PID, else audio, else a dedicated PCR-only PID | landed |
Expand Down Expand Up @@ -102,7 +102,7 @@ remain with their current quests.
- [State bound](/quest/m1/ts-reliability/state-bound.md) - SI and revision state retire with what the source stops repeating
- [Decode order](/quest/m1/ts-reliability/decode-order.md) - TS, MKV and FLV author DTS from decode order and a declared `reorder` depth
- [Shared parser](/quest/m1/ts-reliability/shared-parser.md) - `--program all` scans the multiplex once
- [PMT export](/quest/m1/ts-reliability/pmt-export.md) - a TS export announces each PMT revision, mux rate included, at the next `version_number`
- [PMT export](/quest/m1/ts-reliability/pmt-export.md) - synced TS legs revise their PMT and grid identically
- [Access units](/quest/m1/ts-reliability/pes-access-units.md) - a PES carrying several access units publishes each at its own time
- [PAT changes](/quest/m1/ts-reliability/pat-lifecycle.md) - a revised PAT never leaves a broadcast meaning another program
- [Stream routes](/quest/m1/ts-reliability/stream-routes.md) - every PID gets a declared route, and what is not carried is counted
Expand Down
95 changes: 43 additions & 52 deletions quest/m1/ts-reliability/pmt-export.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,52 @@
# [M] TS export follows a PMT revision
# [M] Synced TS legs revise their PMT identically

## Goal

A TS export of a broadcast whose layout changes mid-stream announces the
revised layout as an ordinary PMT revision. A track added, retired, or
replaced under a fresh name changes the PMT at the next `version_number`;
nothing else blips.
Two `moq export ts --sync` legs of a broadcast whose layout changes
mid-stream revise their PMT identically: the same `version_number`, in the
same slot, listing the same streams, wherever both legs hold the content
around it. A track added no longer ends a synced export.

## Plan

The import already keeps track names honest: a changed `stream_type` or ES
descriptor loop finishes the old track, drops its catalog entry, and opens
a new uniquely named one; a removed stream finishes its track and leaves
the catalog; `programDescriptors` updates in place; a program identity
change refuses.

What the export does today:

- `Export` builds the PAT/PMT once. A track added afterward fails the export
("TS track layout changed after PAT/PMT was emitted"), so every revision
the import publishes ends the export.
- A track that leaves the catalog keeps its PID in the PMT forever, and
`programDescriptors` is read once.
- A switch to another instance already rebuilds the tables at the next
`version_number`.

Decided 2026-10-20 by the maintainer:

- Export rebuilds the PMT at the next `version_number` when the track set
or an entry changes, drops a retired track's PID once its track ends, and
keeps the PCR PID unless its track retires. A TS receiver sees an
ordinary PMT revision and a Hang player sees a rendition switch.

A `programDescriptors` change is an entry change too: the PMT carries the
revised `program_info` at the next `version_number`.

Under `moq export ts --sync`, the revision is a function of the catalog
alone, so identical legs revise their PMT identically.

Decided 2026-10-22 by the maintainer: a revision is one transaction over
everything the catalog configures. A `muxRate` change applies with the
tables at the same boundary and, under `--sync`, rebuilds the grid there:
today `Schedule::set_rate` updates the rate while the `--sync` `Grid` keeps
the layout it was built at, so a running leg and a new joiner schedule the
same broadcast differently (reproduced in the 2026-10-22 audit).

Rust: `rs/moq-mux` TS export. Draft
([mpegts](/drafts/draft-lcurley-moq-mpegts.md)): the rebuild section says
how a consumer revises the PMT.

Tests use the generated `fixture::Mux` builder through import and export:
PMT add, remove, retype, descriptor-only change, version rollover (31 to
0), PID reuse after removal, a program descriptor change, and a `muxRate`
change under `--sync` with a leg joining after it, each asserting the
exported PMT's streams and version sequence, and the two legs' packets. Extend the
TSDuck round trip with a generated mid-stream PMT revision so
`compliance.py` checks the rebuilt version sequence in CI.
Outside `--sync`, the export follows a PMT revision at the next
`version_number`: a stream joins the PMT with its first frame, and leaves
once the catalog has dropped it and nothing of it is left to go out. A track
recorded on the PID of a dropped stream waits for that stream to drain, and
cuts it if it never ends. Each revision is one boundary: versions go out in
order, no packet of a stream a revision adds goes ahead of it, and its PCR
PID and `muxRate` take over after its last packet. The PCR keeps its PID
unless its track retires.

What `--sync` does today:

- The tables are laid once, from the catalog the leg opened on. A track
added afterward fails the export ("… under --sync").
- A track that leaves the catalog keeps its PID and its lane, and an entry
or `programDescriptors` change is not announced.
- A `muxRate` change is warned and ignored: the leg keeps the rate its grid
was laid at.
- So legs that open on either side of a catalog change lay different PMTs
and grids, and a pair does not survive an added stream.

Decided 2026-10-22 by the maintainer: under `moq export ts --sync`, the
revision is a function of the catalog alone, so identical legs revise
their PMT identically. A revision is one transaction over everything the
catalog configures: a `muxRate` change applies with the tables at the same
boundary and, under `--sync`, rebuilds the grid there.

Open: where a revision lands. Each leg reads the catalog update at its own
moment, so the slot that carries the revised PMT, and its `version_number`,
must follow from something both legs read alike, such as an added track's
first unit on its lane or the end of a retired track's last group. A
revision that adds a track also needs a lane the rate can carry.

Rust: `rs/moq-mux` TS export (`with_sync`).

Tests: two synced legs, joined apart, across a PMT add, remove, retype,
descriptor change and `muxRate` change, write the same packets from the
revision on, PMTs included; a leg that joins after a revision lays the
revised PMT at the same `version_number`, and the revised grid.

## Related

Expand Down
Loading