feat(moq-srt): SRT contribution ingest gateway#1747
Merged
Conversation
961f6e3 to
2623dd2
Compare
New `rs/moq-srt` crate (library + binary) that ingests SRT, demuxes the MPEG-TS each connection carries via moq-mux, and publishes the result into a MoQ origin as ordinary broadcasts. Pure Rust (srt-tokio), no libsrt or ffmpeg. This replaces the relay-embedding approach in moq-pro#112: instead of embedding moq-relay as a library, a relay depends on moq-srt with `default-features = false` and calls `moq_srt::run(origin, config)` against its own origin. No extra hop, no toolchain bump, no dual moq-native. Structured to match the sibling gateway crate moq-hls: - Library surface is just `Config` + `run`; feature-gated `server` keeps the core lib to srt-tokio/moq-net/moq-mux, with moq-native/clap/axum/rustls optional behind `server` (default). - `error.rs` thiserror Error/Result; plain `#[non_exhaustive]` Config built by the binary's clap args. - Binary has two modes: `serve` (local QUIC/WebTransport server + cert endpoint) and `publish` (forward to a remote relay), mirroring moq-hls import. Routing derives the broadcast path from the SRT stream id (`#!::r=<resource>` or raw `app/key`), with `--srt-prefix` namespacing and first-publisher-wins. The listener is unauthenticated for now (gate via firewall/private network); SRT passphrase auth is the planned next step. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two pre-existing breakages on dev surfaced by the full workspace CI build, neither caused by the new moq-srt crate: - moq-ffi: `subscribe_catalog` / `subscribe_media` became `async`, but a test still called `.unwrap()` on the returned future. Add `.await`. - moq-native: a qmux bump (0.1.2 -> 0.1.3) grew `qmux::Session` to ~216 bytes, re-tripping `clippy::large_enum_variant` on `RequestKind`. Box the `WebSocket` variant, matching the existing `Quinn(Box<..>)` pattern. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2623dd2 to
62da759
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.
What
A new
rs/moq-srtcrate (library + binary): a pure-Rust SRT contribution ingest gateway. It runs an SRT listener, demuxes the MPEG-TS each connection carries viamoq-mux, and publishes the result into a MoQ origin as ordinary broadcasts. The contribution-ingest analogue ofmoq-hls's import andmoq-rtc's WHIP. No libsrt or ffmpeg (srt-tokio).Why (replaces moq-pro#112)
This replaces the relay-embedding approach in moq-pro#112 (
moq-ingest), which embedded the wholemoq-relayas a library and so forced a Rust 1.95 toolchain bump and dualmoq-nativeversions. Instead, a relay depends onmoq-srtwithdefault-features = falseand callsmoq_srt::run(origin, config)against its own origin:No extra hop, no toolchain bump, no dual
moq-native.Structure (matches
moq-hls)Config+run. Feature-gatedserverkeeps the core library tosrt-tokio/moq-net/moq-mux;moq-native/clap/axum/rustls/url/sd-notifyareoptionalbehindserver(default-on). A relay embeds withdefault-features = false.error.rs:thiserror#[non_exhaustive] Error+Result.Configis a plain#[non_exhaustive]struct (built by the binary's clap args, so CLI deps stay out of the embeddable lib).serve(local QUIC/WebTransport server +/certificate.sha256endpoint + optional--dir) andpublish(forward to a remote--relay), mirroringmoq-hls import.Usage
Routing derives the broadcast path from the SRT stream id (
#!::r=<resource>or rawapp/key), with--srt-prefixnamespacing and first-publisher-wins (a duplicate stream id is rejected).Public API
New crate, so all surface is additive (no breaking changes to existing crates):
moq_srt::Config— plain#[non_exhaustive]struct (listen,prefix,latency) withDefault.moq_srt::run(origin: OriginProducer, config: Config) -> Result<()>.moq_srt::{Error, Result}.Targets
devper the branch rules (new public library API). Uses the devmoq-netAPI (BroadcastInfo,publish_broadcast -> Result<OriginPublish>,with_publisher).Heads-up
members/default-members/dependencies(asdefault-features = false).Verification
cargo build -p moq-srt(and--no-default-features),cargo clippy -p moq-srt --all-targets(clean),cargo fmt --check(via nix), and the 5 unit tests (stream-id routing + path-claim guard) all pass. Not yet exercised against a live SRT source end-to-end.(Written by Claude)
Unrelated dev-CI fixes (second commit)
The full-workspace CI build surfaced two pre-existing breakages on
dev, neither caused bymoq-srt(it compiles clean on its own). Fixed in a separate commit so they're easy to drop or fold into the in-flight origin API work:subscribe_catalog/subscribe_mediabecameasync, but a test still called.unwrap()on the returned future. Added.await.qmuxbump (0.1.2 → 0.1.3) grewqmux::Sessionto ~216 bytes, re-trippingclippy::large_enum_variantonRequestKind. Boxed theWebSocketvariant, matching the existingQuinn(Box<…>)pattern.Verified locally against the CI gates:
cargo check(default /--no-default-features/--all-features),cargo clippy --workspace --all-targets -- -D warnings,cargo doc -D warnings,cargo test --all-features(compile),cargo sort,cargo shear,taplo, andcargo fmtall pass.