Repository navigation
Conversation
`moq import --stats` names a stats track in the catalog the import builds and fills it with what each rendition has written: frames, payload bytes, and video keyframes, with the connection's transport. `moq export --echo <name>` publishes the feedback a catalog solicits, counting what the export reads and its newest arrival. `moq export stats` and `moq export echo` print either as JSON lines. moq-mux counts at the container producer and the source, so every container import and export shares the counters. Capture encoders, gateways, `archive`, and `ts --program all` refuse `--stats`; MSF catalogs refuse `--echo`. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
A TS import's stats and a TS export's feedback now carry an `mpegts` section: each elementary stream's access units and quiet time, and the TR 101 290 counters. An export adds `release`, how its output clock keeps up with the source: frames dropped at the deadline, the least margin frames arrived with over the last second, the clock's offset and drift from the source, and measurements past the 30 ppm a system clock may run off. `ts::stats` gains serde and `Report`, the extension both snapshots flatten. `stats::Export` moves its clock fields under `release`, and `ts::Release` reports the same for a passthrough export. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
t0ms
force-pushed
the
quest/m2/ts-health-stats
branch
from
October 17, 2026 04:00
70aebba to
a0b877c
Compare
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 #5643 (base
quest/m2/stats/schema) and on the Rust reporters PR, #5783; until that merges, this diff shows both commits. Rebased onto #5643's head8cadf9f4, which takes main: #5713'strimmedandgapssit underreleasebesidedropped, and the passthrough counts its gaps too. That is the re-timing section the decision recorded on #5643 describes.Problem
ts::statscounts the TR 101 290 checks and each elementary stream's delivery, but only logs them.The TS health stats quest
asks for them in the media reports. On #5643, the maintainer asked for the export's re-timing stats
(frames dropped at the release deadline, the release margin, and the output clock's offset from the
source) to sit in their own section beside
mpegts.Approach
serde on
ts::stats.Snapshot,Stream, andClassare camelCase, with every fielddefaulted. Counters are omitted at zero, as hang's are.
quietis whole milliseconds. An unknownclassreads asdata. PID keys go throughDisplayFromStr: flattened into a snapshot, a sectionloses serde_json's integer-key parsing, and
hang::stats::Snapshot<Report>would not read back("invalid type: string "256", expected u16").
ts::stats::Report { mpegts, release }is theEof bothhang::stats::Snapshotandhang::echo::Snapshot. An import fillsmpegtsfromImport::stats(). A TS export fills it withits rows and adds
release. A passthrough export reportsreleasealone.ts::stats::Release:dropped,margin,offset,drift(ppm), andoutOfTolerance.stats::Exportbecomes{ streams, release }, andts::Release::stats()gives the passthrough's.The jitter buffer measures the two new gauges:
margin: the least time any frame arrived before its deadline over each whole second of ourclock, negative when one missed.
offset: the gap between the slack of the track sent latest and the delay, which the clock pullsshut, as last measured. Like
drift, it is absent until the rate is measured.Both are integer milliseconds.
CLI: the import's decode loop sets
mpegtsat each one-second sample and after the finaldrain. The TS export and the passthrough set theirs as they sample. The release-clock log line
gains
margin_msandoffset_ms.Docs: a
doc/concept/stats.md§ MPEG-TS sections covers:downstream wire);
PID_errorcovered byunitsandquiet;releasefields.Also a paragraph in
doc/bin/cli.md. The quest file is removed, with its links.Decisions a reviewer may want to revisit:
release, andtrimmedandgapsin it: they are theexport's own counts, not a row's, though
gapsis about the source rather than the clock.marginover one second (a report's interval) rather than since the last sample, so two readers donot interfere.
marginandoffset.Class::Datalast, which#[serde(other)]requires.Impact
ts::stats::Export:dropped,trimmed,gaps,drift, andout_of_tolerancemove underrelease..zdeltas stay small, since counters only climb.Results
just fixandjust checkpass: 3,243 and 436 tests. On macOS,play's link step tripsbuild.warningson the__eh_framelinker note; with warnings allowed it passes 206 of 206, that notebeing its only warning.
a_report_flattens_beside_the_media_countersquietin ms, zeros omitted) and a full read-back throughhang::stats::Snapshot<Report>; an unknown class reads as dataDisplayFromStrthe_margin_is_the_least_spare_over_a_secondthe_clock_follows_a_drifting_source_for_a_dayoffsetwithin the run's existing bound at ±25 and ±30 ppm, andmarginequals the delay plusoffsetto 1 msa_slow_source_clock_keeps_the_delay(export)import_stats_count_what_each_rendition_wrote(CLI)mpegtspresent, every TR 101 290 counter zero on the clean clip, every PID'sunitsadvancing and ending equal to an in-process import's, and noreleaseat importimport_stats_report_a_silent_video_pid(CLI)quietpeaks (the import logged 1.24 s) while audio stays under 500 ms; video counts again after; no priority 1 check firesexport_echo_reports_what_the_export_reads(CLI)releasecarries a margin (2,737 ms on a 4 s delay, nothing dropped)(Written by Claude Opus 5.5)