Skip to content

Let a late multiplex program join the catalog when it opens - #64

Merged
mondain merged 3 commits into
openmoq:mainfrom
gwendalsimon:fix/mpts-late-join
Nov 19, 2026
Merged

mondain merged 3 commits into
openmoq:mainfrom
gwendalsimon:fix/mpts-late-join

Conversation

@gwendalsimon

@gwendalsimon gwendalsimon commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #62. After #63, a program that did not open at start-up stayed out for the whole session. It now keeps waiting, and when its PAT and PMT come, a new catalog lists it before its first Object, as a PSI change does. Every configured track is declared from the start, because the publisher's track list is fixed per connection.

While it waits, the program is logged as a status. A program that joins late does not change the exit status. One that never joined by the end of the source is logged once as an error, and the exit status is 1, as in #63. Because open() measures the rates over 1 s of PCR time, the program's first Object comes about 1 s after its PMT.

This depends on #63. I tested it in November 2026 with a new test where the PMT comes late.


This change is Reviewable

gwendalsimon and others added 3 commits November 16, 2026 18:45
The PSI scan of a single-program live source read at most 4096
packets, which is 154 ms at 40 Mbit/s. An encoder that sends a PAT
every 476 ms, within the 500 ms of ETSI TR 101 290, then failed most
starts with "No PAT found at the start of the source".

* On a live source, wait for the PAT up to 1 s of PCR time
  (kPsiWindowPcr), then for its PMT up to 1 s after the PAT.
* Cap the single-program live scan, which keeps what it reads, at
  106,400 packets (2 s at 80 Mbit/s, about 20 MB). A source without
  a PCR stops at that cap.
* A program of a multiplex (timed windows) now also waits up to 1 s
  after the PAT for its PMT, where it stopped 1 s after the first PCR.
  Its 600,000-packet cap and stall error are unchanged.
* Keep the 4096-packet scan for seekable files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In a multiplex, a program that failed to open at start-up stopped every
program, for example a service that the PAT lists while its encoder is
down. After start-up, a read error already ends only its own program.
Start-up now treats one dead service the same way (openmoq#62).

* MptsPipeline leaves out a program that does not open, reports it
  once with programEnded(), and publishes the others. The catalog
  lists the opened programs only. The CLI logs the reason and exits 1
  at the end, as for a program that ends early.
* Only when no program opens does the start fail, with the first
  program's error, as before.
* "strict_start": true in the --config file keeps the old start: one
  program that does not open fails every program. --config takes no
  other option, so the setting is a key of the file.
* M2tsPacketizer names a missing PMT: "The PAT lists program N, but its
  PMT (PID P) did not come within 1000 ms of PCR time after the PAT."
  It replaces the generic initData message only when the PAT listed
  the program and the source did not end.
* Tests: a program missing from the PAT (the others publish, one
  programEnded, a two-program catalog), the same with strict_start
  (fails as before), no program open (fails), a PMT that never comes
  (the other program publishes), and the strict_start key in the
  configuration parser. The missing-program test now expects the new
  start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After openmoq#63, a multiplex program that did not open at start-up stayed out
for the whole session. It now keeps waiting and joins: when its PAT and
PMT come, a new catalog lists it before its first Object, as a PSI
change does (openmoq#62).

* A program that does not open gets a thread that opens it again on
  its own queue until it opens, its source ends, or the pipeline stops.
  Each attempt goes on from the last one's offset in the queue's
  stream, which the first pull's live edge uses.
* Shared keeps every program's catalog entry and lists the opened ones
  only; join() adds an entry and queues the new catalog. A program
  still waiting counts as live, so the broadcast does not end while it
  waits, and a clean end of its source ends it cleanly.
* Every configured track is declared to the publisher from the start,
  because moqxr's track list is fixed per connection.
* While it waits, the program is reported as a status, "... It joins
  the catalog when it opens.", then "program N joined the catalog.".
  One that never opened by the end of its source is reported once by
  programEnded(), with the reason of its last full attempt and "It
  never joined the catalog.", so the exit status stays 1 as in openmoq#63; the
  other programs' broadcast still ends cleanly. An interrupt reports
  nothing.
* PacketQueueDevice::ended() tells a waiting program that its source
  ended.
* Tests: a PMT that comes at round 20 (101 publishes from the start;
  102 joins with a catalog update before its first Object, from round
  20-32, since open() measures the rates over 1 s of PCR time; one
  update and one closing catalog, no programEnded); the missing-program
  and missing-PMT cases now expect the status, then one programEnded at
  the end of the source.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mondain
mondain merged commit 2c5ca08 into openmoq:main Nov 19, 2026
4 checks passed
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.

A multiplex program that fails to open at start-up stops every program

2 participants