Repository navigation
Publish the programs of a multiplex that open when one does not - #63
Merged
Merged
Conversation
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>
|
@gwendalsimon not for my case, but I think this will cause an issue for others if not addressed. I.e if is a service whose encoder is down when moq2ts starts and comes back later. Without a late join, that service stays off air until moq2ts restarts, and the restart takes down every program that is on air. That is the failure #63 removes at start-up, but moved to a later time. A second PR after this one sounds right. In that PR, a program that opens late could join the catalog as an update, the way a PAT change publishes a new track since #38. |
Contributor
Author
mondain
pushed a commit
that referenced
this pull request
Nov 19, 2026
After #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 (#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 #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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #62. In a multiplex, a program that fails to open at start-up no longer stops the others. moq2ts publishes the programs that opened, and the catalog lists only those. It logs the program that did not open once, with the reason, and exits with status 1 at the end. A missing PMT now reads "The PAT lists program N, but its PMT (PID P) did not come within 1000 ms of PCR time after the PAT." The start fails only when no program opens.
"strict_start": truein the configuration keeps the all-or-nothing start.The missing program stays out for the whole session. @t0ms, would a late join, where the program starts when its PMT arrives, matter for your case? I can add it in a second PR.
This depends on #59. I tested it in November 2026 with new tests in the multiplex suite.
This change is