open-standards/joule-code/joule-code-rs/crates/joule-moq-ingest/src/lib.rs
Transaction Science 57e426c940 live-contribution: the link record's magic is WLK1, no longer the clip record's WCL1
The contribution link record and the live-recording clip record both began WCL1. The clip
record had it first (live-recording §5.1, the registry's only WCL1 row); the link record took
the same four bytes when it was added, so a reader that tells records apart by their magic
could not tell one from the other.

The link record is now WLK1, a magic nothing else in the registry, the code or an open branch
uses. live-contribution §6.2 and SPEC name it, §6.5 step 2 says the clip record's WCL1 is
refused as malformed, and codecs/registry.rs registers it (REGISTRY.md and registry/ exported
from it). joule-moq-ingest writes and reads it. The corpus live-conformance/links/ is
regenerated with it, its files now .wlk1, plus clip_record_magic, a part with the clip
record's magic, refused. live_contribution_verify.py reads WLK1 and also refuses each accepted
part mutated to WCL1.

A wire change: a link record written before this one is malformed to a reader of this
revision. The CHANGELOG says so and acknowledges every corpus file that changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 05:19:53 -05:00

56 lines
2.9 KiB
Rust

//! **joule-moq-ingest**: WebRTC into and out of WAI rooms over MoQ.
//!
//! - **WHIP** (RFC 9725, [`whip`]): any standard WebRTC encoder publishes into a room. The
//! gateway checks its bearer token, a room grant, against the room ([`room`]); takes
//! its media, frame by frame, from the WebRTC stack; packages each frame as one WAI
//! envelope ([`frame`]); groups the frames, one group per keyframe for video and per
//! fixed duration for audio ([`package`]); and publishes the tracks and their catalog
//! at the relay as their MoQ publisher ([`relay`], [`catalog`]), signing every group's
//! receipts as the first hop.
//! - **WHEP** (`draft-ietf-wish-whep-05`, [`whep`]): a standard WebRTC player watches a
//! publisher's tracks. The gateway subscribes at the relay, verifies every object
//! against its receipt, drops and counts what fails, and packetises the rest back to RTP.
//! - **Bounds** ([`config::Limits`]): sessions, bitrate, tracks per session.
//! - **Enhanced RTMP** ([`rtmp`], `extensions/live-ingest.md` §12): an RTMP or RTMPS
//! encoder publishes into a room with a one-time stream key the `/rtmp` resource issues
//! under its grant; legacy AVC and AAC, and the enhanced FourCCs for HEVC, AV1, VP9,
//! VP8, Opus, FLAC and AAC, single-track or multitrack, each track a room track whose
//! receipts the gateway signs as the first hop.
//! - **SCTE 104** ([`scte`], `extensions/cue-injection.md`): an automation system's
//! splice and time-signal requests, translated to SCTE 35 sections and signed as the
//! room's `cue` events, each preceded by the injection record that lets a verifier
//! recompute it.
//! - **Records** ([`record`]): each session ends with a record of what it carried, signed
//! by the gateway: the seam for live metering's per-hop record.
//! - **SRT and RIST** ([`contrib`]): contribution over UDP with retransmission, from
//! `joule-contrib`, into the same tracks: a one-time session from `/srt` or `/rist`
//! under the room grant, the transport stream demultiplexed, H.264, HEVC and AAC
//! carried; and the link's own record, `WLK1` ([`linkrec`]), signed part by part on the
//! owner's `link` track.
//!
//! The WebRTC stack is `str0m` (sans-IO, MIT OR Apache-2.0) with its pure-Rust crypto
//! backend; the relay protocol is `joule-moq`'s draft-22 codec and `joule-moq-relay`'s
//! client. The mappings this crate implements, and the one it specifies only (SRT), are
//! WAI's `extensions/live-ingest.md`; SRT and RIST as it profiles them for contribution are
//! `extensions/live-contribution.md`.
pub mod catalog;
pub mod config;
pub mod contrib;
pub mod frame;
pub mod gateway;
pub mod linkrec;
pub mod package;
pub mod record;
pub mod relay;
pub mod room;
pub mod rtc;
pub mod rtmp;
pub mod scte;
pub mod sdp;
pub mod whep;
pub mod whip;
pub use config::GatewayConfig;
pub use gateway::{Gateway, GatewayServer};
pub use record::{SessionRecord, SignedRecord};