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>
t0ms
force-pushed
the
quest/m2/stats/rust
branch
from
October 17, 2026 04:00
eedd70a to
c5b2b84
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), as the maintainer asked there, and rebased onto its head8cadf9f4, which takes main.Problem
#5643 defines the publisher's
statssnapshot and the viewer's.echofeedback, but nothing in Rustwrites either. The Rust reporters
quest asks moq-mux to count what each rendition carries and the CLI to publish it.
Approach
This is the import and export half. The quest file now holds the rest: the capture encoders,
moq play --echo, and gateway--stats.catalog::Producer::media/media_rawattach acounter to each track a container importer writes: frames, payload bytes, and keyframes for video.
Sourcecounts what an exporter reads: frames, bytes, and the newest arrival (timestampandwall).catalog::Producer::stats()andSource::stats()return them keyed by rendition ID. Everycontainer import and export shares them. Counts are cumulative for the process: a rendition that
ends keeps its final counts, and one that returns under the same ID continues them. An fMP4 import
counts samples as frames.
moq import --statsnamesstats.json(and its.z) in the catalog'sstatssection whilethe importer still holds its reservation, so the section rides the first catalog. It writes about
once a second while subscribed, with the connection's RTT, estimated send rate, and loss. At EOF it
writes the final counts whether or not anyone subscribes, and the import holds the track through
--linger, so a late subscriber still reads them. It covers the stdin imports.import capture,the gateways,
archive, andts --program allrefuse it: the capture encoders create their tracksdirectly and do not count yet, and
--program allbuilds a catalog per program.moq export --echo <name>follows the catalog'sechosection and publishes<prefix>/<name>.echowithfeedback.json(and its.z). Each catalog update reconciles it, andthe broadcast is retracted when the export ends. The catalog finishing does not end it, since the
export still drains its delayed tail.
--echocovers the stdout container exports, and refuses--catalog-format msf, which carries noechosection.moq export stats/moq export echoprint reports as JSON lines.statsfollows abroadcast's stats track until the broadcast ends.
echoprints{"broadcast", "feedback"}forevery
.echobroadcast under--broadcast.doc/bin/cli.md§ Stats and feedback,doc/concept/stats.md, and the quest rewritten forthe remaining half.
Decisions a reviewer may want to revisit:
--statswhere it would publish an empty or partial track, rather than publishingone.
--echonames one path segment.Impact
catalog::Producer::statsandSource::stats.moq-jsonmoves from moq-cli's dev-dependencies to its dependencies.Results
just fixandjust checkpass with the TS health commit on top: 3,243 and 436 tests. This commitalone passes moq-mux's and moq-cli's 1,598 tests and lint. On macOS,
play's link step tripsbuild.warningson the__eh_framelinker note; with warnings allowed it passes 206 of 206, thatnote being its only warning. The tests are new:
stats_count_what_the_import_writes_and_the_export_reads(moq-mux)bbb_cbr.tsimport counts exactly the frames and bytes written, and an export'sSourcethe same after draining, with an arrivala_returning_track_continues_its_counts,an_ended_track_keeps_its_final_counts,arrival_pairs_the_latest_timestamp_with_its_wall_timeimport_stats_count_what_each_rendition_wrote(CLI over a test relay)a_late_sink_reads_the_final_statsexport_echo_reports_what_the_export_readsviewers/alice.echofrom a catalog solicitingviewers; frames read never exceed those written; the arrival advances; RTT presentstats_needs_a_catalog_the_cli_builds,echo_needs_a_container_export_and_a_hang_catalog(Written by Claude Opus 5.5)