Repository navigation
Conversation
`moq export ts` held each frame for `--delay` and then sent it up to another `--delay` ahead of its decode time, so its output trailed the source by about twice the delay. A frame is now due at its release time: anchor + DTS + delay less its send-ahead, where the send-ahead comes out of the same delay and is capped by the PID's decoder buffer (EB from the SPS HRD or the level, B for audio). Padded video whose HRD declares a longer buffer delay than the delay fails the export, naming the `--delay` it needs. The default `--delay` rises from 500 ms to 1 s, which fits a broadcast-sized CPB, and SRT egress muxes at its latency or 1 s, whichever is longer. 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.
Stacked on #5306; draft until it merges.
Problem
moq export tsheld each frame for--delay, then sent it up to another--delayahead of its decode time to fill the receiver's buffers. Its output therefore trailed the source by about twice the delay, where an SRT receiver at the same latency trails by the latency.Approach
--delayit needs. A unit that still misses its slot names the delay or the multiplex rate.--delaydefaults to 1 s, which a broadcast-sized CPB (9 Mbit at 9 Mb/s) needs. SRT egress muxes at its latency or 1 s, whichever is longer.Impact
moq export ts --delay: default 500 ms -> 1 s, and the delay now bounds the whole trail, send-ahead included.moq export ts: padded HRD video whose buffer delay exceeds--delayfails withraise the delay to <d>, where it used to run.--delay 500ms.Server::bindkeeps its signature.moq_muxTSExport::with_delay: same signature, the delay now includes the send-ahead, and the error above is new.test/ts/pcr-timing.py --drift-msdefaults to 1000, the new delay.Results
Two feeds of a broadcast capture through one relay at 100 ms RTT, 40 s per cell, delivery latency from the source tap to the egress tap (median / p95 of each feed):
--delayb581c27ea5640abeOver 300 s at
--delay 1s, main reads 1877 and 1911 ms and this branch 1183 ms for both feeds. No video was lost and no frame missed its deadline in any cell. What remains above the delay is consistent with this capture sending its video less far ahead than the cap allows, so the clock anchors on the video.just test ts --hrd --strictpasses at the 1 s default (EB peaks at 100 %, worst buffer delay 1.05 s), and with--delay 500msthe export stops withMPEG-TS video on PID 256 declares a 1.000s decoder buffer delay (its HRD's CPB over its bit rate), past what a 500ms delay sends it ahead; raise the delay to 1s.New tests:
padded_video_needs_the_delay_its_hrd_declares(an SPS with a 9 Mbit CBR NAL HRD is refused at 500 ms and runs on time at 1 s),sps_hrd_reads_the_nal_hrd, the schedule's reach and refusal cases, anda_joiner_runs_at_the_delay_from_its_first_outputtightened to one delay.Alternatives
Follow-ups
drift_ppmon theTS export release clockline) is noisier on audio/video sources whose video arrives less far ahead than its cap. The video then has the least slack, so the steering follows its best phase in each 2 s step, which moves with the pictures in that step. On the broadcast capture it still reads about -1,100 ppm 60 s into a loop of the clip, where fix(ts): schedule padded output at exact decoder times #5306 settles within 10 ppm. The applied drift is slew-limited to 0.075 Hz/s, so output timing is unchanged in these runs. Steering on each track's own envelope would settle it.(Written by Claude Opus 5.5)
Need help on this PR? Tag
@codesmith-botwith what you need.