Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion quest/m2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ quests that require them.
- [moq-video codecs split submission from receive](/quest/m2/video-codec-receive.md) - video encoders and decoders submit, then `receive` one output, the shape moq-audio took, so no call allocates a `Vec` of outputs
- [Connection state carries each phase's data](/quest/m2/connection-state-phases.md) - moq-tokio's `Observation`, moq-ffi's `MoqConnectionState`, and moq-c's `moq_connection_state` each hold one phase per value, so no field is readable in a phase where it means nothing
- [moq-video takes devices, not environment variables](/quest/m2/video-devices.md) - VA-API and V4L2 device paths are config fields, and `moq_video::ENV` never ships
- [Gateways share one ingest config and one rate cap](/quest/m2/gateway-ingest.md) - `moq_mux::Ingest` replaces 18 per-gateway setters, and the live rate cap moves to `moq_net::bandwidth`
- [JS time values are types, not numbers](/quest/m2/js-time-types.md) - every public JS duration and instant is a `Clock.Duration` or `Clock.Instant` object, so a unit mistake fails to compile
- [Small API fixes before the cut](/quest/m2/api-shape/README.md) - one path and one spelling per item, names by role, and no dead or wrong-role public surface across net, transport, media, native, apps, JS, and bindings
- [Finishing a producer returns a Finished handle](/quest/m2/finished-handle.md) - `finish(self)` consumes moq-net's and the media crates' producers, so appending after finish doesn't compile
Expand Down
37 changes: 0 additions & 37 deletions quest/m2/gateway-ingest.md

This file was deleted.

2 changes: 1 addition & 1 deletion quest/m3/release/api-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ consumers in this repository and its downstream applications. Mean 6.9; three
clusters were restrictive (the native playout clock, JS duration units, and
moq-video's environment knobs). Its approved changes are m2 quests
(route-roles, js-time-types, mux-sync, no-sentinels, video-devices,
gateway-ingest, and the [api-shape epic](/quest/m2/api-shape/README.md)),
gateway-ingest (landed), and the [api-shape epic](/quest/m2/api-shape/README.md)),
two m1 quests, and plan edits. Check first, next run: surfaces `just
api-diff` cannot see (GStreamer properties, CLI flags and env, MIGRATE drift)
and publish versions of packages exempt from the cut's version. `just
Expand Down
14 changes: 6 additions & 8 deletions quest/m3/rtc-pacing.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,14 @@ WHEP enforcement needs it and nobody owned it.

Public API: a rate handle on moq-webrtc's WHEP server. Decided 2026-10-30
(maintainer): `whep::accept` takes the same shape as `whip::accept`, a
`whep::Request` struct, rather than a fifth argument. That struct lands
first in [gateway-ingest](/quest/m2/gateway-ingest.md), `#[non_exhaustive]`,
so this quest adds a `rate: Option<bandwidth::Limit>` field to it, never a
`whep::Request` struct, rather than a fifth argument. That struct exists,
`#[non_exhaustive]`, so this quest adds a `rate: Option<bandwidth::Limit>`
field to it, as `whip::Request` has, never a
`with_rate` setter (2026-11-07, maintainer, /quest-plan from the API sweep
of open PRs and remaining quests). The handle
is `moq_net::bandwidth::Limit`, which replaces moq-webrtc's
`rate::{Cap, Limit}` in [gateway-ingest](/quest/m2/gateway-ingest.md)
(2026-11-07, maintainer, /quest-plan from the API shape audit). Wire: none.

Changed 2026-11-07 (maintainer, /quest-plan from the API sweep of open PRs and remaining quests): `whep::Request` itself lands before the cut in [gateway-ingest](/quest/m2/gateway-ingest.md); this quest adds its rate field.
is `moq_net::bandwidth::Limit`, which replaced moq-webrtc's own
`rate::{Cap, Limit}` (2026-11-07, maintainer, /quest-plan from the API shape
audit). Wire: none.

## Related

Expand Down
9 changes: 5 additions & 4 deletions quest/m3/srt-rate-handle.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ enforcement needs it and nobody owned it.
included, stays under the cap is untouched; under the cap nothing changes.

Public API: a rate handle and a rate-limit close reason on moq-srt's server.
The handle is `moq_net::bandwidth::Limit`, shared with WHIP, WHEP, and the
relay's grant caps since [gateway-ingest](/quest/m2/gateway-ingest.md)
(2026-11-07, maintainer, /quest-plan from the API shape audit), not a
moq-srt copy. Wire: none.
The handle is `moq_net::bandwidth::Limit`, the one WHIP takes in
`whip::Request.rate` (2026-11-07, maintainer, /quest-plan from the API shape
audit), not a moq-srt copy. It reaches a server ingest as a field on
`moq_mux::Ingest` or a new `#[non_exhaustive]` request, and a dial-out push
as a field on `moq_srt::dial::Publish`, never as a `with_*` setter. Wire: none.

## Required

Expand Down
2 changes: 1 addition & 1 deletion quest/m3/stats/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
TS release section holds the drops (from
[moq-dev/moq#6654](https://github.com/moq-dev/moq/pull/6654)).

Changed 2026-11-07 (maintainer, /quest-plan from the API sweep of open PRs and remaining quests): a gateway takes its report and echo as fields on its request struct or on `moq_mux::Ingest` ([gateway-ingest](/quest/m2/gateway-ingest.md)), not as `with_report` and `with_echo` builders.
Changed 2026-11-07 (maintainer, /quest-plan from the API sweep of open PRs and remaining quests): a gateway takes its report and echo as fields on its request struct or on `moq_mux::Ingest`, not as `with_report` and `with_echo` builders.

## Related

Expand Down
18 changes: 4 additions & 14 deletions rs/moq-cli/src/hls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,7 @@ impl Tls {
/// Pull a remote HLS/LL-HLS playlist (URL or file path) into the Origin under `target.name`,
/// announced under `instance`. Once the playlist ends, serve the finished broadcast for the linger.
pub async fn import(target: ImportTarget, args: ImportArgs, instance: moq_net::Instance) -> anyhow::Result<()> {
let ImportTarget {
origin,
name,
max_age,
linger,
bandwidth,
} = target;
let ImportTarget { origin, name, ingest } = target;
// Held through the linger, so the finished broadcast stays announced while it serves the tail.
let route = origin
.route(
Expand All @@ -196,10 +190,7 @@ pub async fn import(target: ImportTarget, args: ImportArgs, instance: moq_net::I
)
.context("failed to create broadcast")?;

let config = moq_mux::catalog::Config::default()
.with_max_age(max_age)
.with_bandwidth(bandwidth);
let catalog = moq_mux::catalog::Producer::new(&mut route.broadcast().clone(), config)?;
let catalog = moq_mux::catalog::Producer::new(&mut route.broadcast().clone(), ingest.catalog())?;
// Announced once the catalog first goes out, which waits for every rendition's init: a
// relay queries a broadcast's tracks the moment it is announced, and keeps the refusals of a
// publisher that cannot serve its declared tracks yet.
Expand Down Expand Up @@ -227,6 +218,7 @@ pub async fn import(target: ImportTarget, args: ImportArgs, instance: moq_net::I
// The playlist ended: serve the finished broadcast for the linger, so a subscriber that
// arrives after the end still gets the tail. An interrupt drops it at once.
importer.finish()?;
let linger = ingest.linger;
tracing::info!(?linger, "playlist ended; serving the finished broadcast");
moq_mux::Linger::new([route.broadcast().clone()], importer, linger)
.wait()
Expand Down Expand Up @@ -528,9 +520,7 @@ mod test {
let target = ImportTarget {
origin,
name: "hls".to_string(),
max_age: None,
linger: moq_mux::Linger::DEFAULT,
bandwidth: Default::default(),
ingest: moq_mux::Ingest::default(),
};
let args = ImportArgs {
playlist: playlist.to_str().unwrap().to_string(),
Expand Down
22 changes: 12 additions & 10 deletions rs/moq-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -751,25 +751,27 @@ fn spawn_import(
reject_listener_cors(&rtc.cors, "import rtc")?;
}

let max_age = Some(import.max_age.map_or(hang::container::MAX_AGE, Into::into));
let linger = import.linger.map_or(moq_mux::Linger::DEFAULT, Into::into);
let mut ingest = moq_mux::Ingest::default();
if let Some(max_age) = import.max_age {
ingest.max_age = Some(max_age.into());
}
if let Some(linger) = import.linger {
ingest.linger = linger.into();
}
ingest.bandwidth = bandwidth;
// The MoQ side every gateway publishes into, minted per source since each takes it
// by value onto its own task.
let target = |name: String| crate::moq::ImportTarget {
origin: origin.clone(),
name,
max_age,
linger,
bandwidth: bandwidth.clone(),
ingest: ingest.clone(),
};

let mut local = None;

if let Some(format) = import.source.stdin_format() {
warn_if_missing_format(&name);
let config = moq_mux::catalog::Config::default()
.with_max_age(max_age)
.with_bandwidth(bandwidth.clone());
let config = ingest.catalog();
let mut publish = if let ImportSource::Ts(TsImport {
program: Some(TsProgram::All),
..
Expand All @@ -780,7 +782,7 @@ fn spawn_import(
} else {
Publish::stdin(origin, &name, instance, &format, config)?
}
.with_linger(linger);
.with_linger(ingest.linger);
publish.announce()?;
local = Some(publish);
} else {
Expand Down Expand Up @@ -843,7 +845,7 @@ fn spawn_import(
moq_net::origin::RouteOptions::hidden().with_instance(instance, 0),
)
.context("failed to create broadcast")?;
let mut publish = Publish::capture(route, &capture, bandwidth.clone(), max_age)?;
let mut publish = Publish::capture(route, &capture, ingest.bandwidth.clone(), ingest.max_age)?;
publish.announce()?;
local = Some(publish);
}
Expand Down
18 changes: 4 additions & 14 deletions rs/moq-cli/src/moq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
//! and `Server::serve_publish`/`serve_consume`); this module carries the systemd
//! readiness notification used by every endpoint plus the MoQ side of an import.

/// The MoQ side of an import: where a gateway publishes, under what name, the
/// max age it declares on the media tracks it mints, how long a clean end stays
/// up, and the connection allocator those tracks claim on.
/// The MoQ side of an import: where a gateway publishes, under what name, and how
/// (`--max-age`, `--linger`, and the uplink's allocator).
///
/// They travel together rather than as loose arguments per entry point.
#[derive(Clone)]
Expand All @@ -17,17 +16,8 @@ pub struct ImportTarget {
/// The broadcast name to publish under.
pub name: String,

/// How long a superseded group of the published media tracks stays fresh
/// (`--max-age`, else hang's 30 s media max age), or `None` for no publisher limit.
pub max_age: Option<std::time::Duration>,

/// How long a cleanly ended broadcast stays up (`--linger`).
pub linger: std::time::Duration,

/// Connection allocator each passthrough track claims its peak-hold bitrate on,
/// so a co-resident encoder targets what is left. Unlimited when there is no
/// uplink estimate.
pub bandwidth: moq_net::bandwidth::Allocator,
/// How the gateway publishes the broadcast.
pub ingest: moq_mux::Ingest,
}

/// Set once the process takes a shutdown signal: it is draining from then on, not starting.
Expand Down
19 changes: 7 additions & 12 deletions rs/moq-cli/src/rtc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,8 @@ pub struct Listen {
/// WHIP server: accept incoming WebRTC publishes into the Origin as `target.name` (import).
pub async fn listen_import(target: ImportTarget, listen: Listen) -> anyhow::Result<()> {
let publisher = scope_producer(&target.origin, &target.name)?;
let mut config = server_config(&listen);
config.max_age = target.max_age;
config.bandwidth = target.bandwidth;
config.linger = target.linger;
let server = moq_webrtc::Server::new(config);
serve(server.publish_router(publisher), "WHIP", listen).await
let server = moq_webrtc::Server::new(server_config(&listen));
serve(server.publish_router(publisher, target.ingest), "WHIP", listen).await
}

/// WHEP server: serve WebRTC plays of `name` from the Origin (export).
Expand Down Expand Up @@ -104,11 +100,10 @@ pub async fn connect_import(target: ImportTarget, url: Url, instance: moq_net::I
tracing::info!(url = %RedactedUrl::new(&url), %name, "WHEP client pulling");
notify_ready();

let mut config = moq_webrtc::client::Config::default();
config.max_age = target.max_age;
config.bandwidth = target.bandwidth;
let client = moq_webrtc::Client::new(config)?;
client.subscribe(url, route.broadcast().clone()).await?;
let client = moq_webrtc::Client::new(moq_webrtc::client::Config::default())?;
client
.subscribe(url, route.broadcast().clone(), target.ingest.catalog())
.await?;
Ok(())
}

Expand All @@ -134,7 +129,7 @@ pub async fn connect_export(origin: moq_net::origin::Consumer, url: Url, name: S

fn server_config(listen: &Listen) -> moq_webrtc::server::Config {
let mut config = moq_webrtc::server::Config::default();
config.udp_bind = listen.udp_bind;
config.socket = moq_webrtc::server::Socket::Bind(listen.udp_bind);
config.ice_candidates.clone_from(&listen.public_addr);
config
}
Expand Down
26 changes: 5 additions & 21 deletions rs/moq-cli/src/rtmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,7 @@ impl ExportArgs {

/// Accept incoming RTMP publishes into the Origin as `target.name`; reject plays (import).
pub async fn listen_import(target: ImportTarget, addr: SocketAddr) -> anyhow::Result<()> {
let ImportTarget {
origin,
name,
max_age,
linger,
bandwidth,
} = target;
let ImportTarget { origin, name, ingest } = target;
let name = moq_net::Path::new(&name)?;
let mut server = Server::bind(addr).await?;
tracing::info!(%addr, %name, "RTMP listening (import)");
Expand All @@ -82,15 +76,9 @@ pub async fn listen_import(target: ImportTarget, addr: SocketAddr) -> anyhow::Re
Request::Publish(publish) => {
let origin = origin.clone();
let name = name.clone();
let bandwidth = bandwidth.clone();
let ingest = ingest.clone();
tokio::spawn(async move {
if let Err(err) = publish
.with_max_age(max_age)
.with_bandwidth(bandwidth)
.with_linger(linger)
.accept(&origin, &name)
.await
{
if let Err(err) = publish.accept(&origin, &name, &ingest).await {
tracing::warn!(%name, %err, "RTMP ingest ended with error");
}
});
Expand Down Expand Up @@ -152,12 +140,8 @@ pub async fn connect_import(target: ImportTarget, url: Url) -> anyhow::Result<()
tracing::info!(%addr, %app, %name, "RTMP client pulling");
notify_ready();

let client = Client::connect(addr, &app)
.await?
.with_max_age(target.max_age)
.with_bandwidth(target.bandwidth)
.with_linger(target.linger);
Ok(client.pull(&key, &target.origin, name).await?)
let client = Client::connect(addr, &app).await?;
Ok(client.pull(&key, &target.origin, name, &target.ingest).await?)
}

/// Push a broadcast from the Origin to a remote RTMP server (export).
Expand Down
5 changes: 1 addition & 4 deletions rs/moq-cli/src/rtsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ async fn run(target: &ImportTarget, client: &moq_rtsp::Client, published: &mut b
.origin
.route(&target.name, moq_net::origin::RouteOptions::hidden())
.context("failed to create broadcast")?;
let config = moq_mux::catalog::Config::default()
.with_max_age(target.max_age)
.with_bandwidth(target.bandwidth.clone());
let mut catalog = moq_mux::catalog::Producer::new(&mut route.broadcast().clone(), config)?;
let mut catalog = moq_mux::catalog::Producer::new(&mut route.broadcast().clone(), target.ingest.catalog())?;

// A relay asks for a broadcast's tracks the moment it is announced, so wait for the
// first keyframe to put them in the catalog.
Expand Down
31 changes: 9 additions & 22 deletions rs/moq-cli/src/srt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,7 @@ pub async fn listen_import(
latency: Duration,
program: Option<moq_srt::Program>,
) -> anyhow::Result<()> {
let ImportTarget {
origin,
name,
max_age,
linger,
bandwidth,
} = target;
let ImportTarget { origin, name, ingest } = target;
let name = moq_net::Path::new(&name)?;
let mut server = Server::bind(addr, latency).await?;
tracing::info!(%addr, %name, "SRT listening (import)");
Expand All @@ -111,16 +105,9 @@ pub async fn listen_import(
Request::Publish(publish) => {
let origin = origin.clone();
let name = name.clone();
let bandwidth = bandwidth.clone();
let ingest = ingest.clone();
tokio::spawn(async move {
if let Err(err) = publish
.with_max_age(max_age)
.with_bandwidth(bandwidth)
.with_program(program)
.with_linger(linger)
.accept(&origin, &name)
.await
{
if let Err(err) = publish.with_program(program).accept(&origin, &name, &ingest).await {
let err = suggest_program(err);
tracing::warn!(%name, err = format!("{err:#}"), "SRT ingest ended with error");
}
Expand Down Expand Up @@ -189,11 +176,11 @@ pub async fn connect_import(

let client = moq_srt::Client::new(addr, resource)
.with_latency(latency)
.with_max_age(target.max_age)
.with_bandwidth(target.bandwidth)
.with_program(program)
.with_linger(target.linger);
client.pull(&target.origin, name).await.map_err(suggest_program)
.with_program(program);
client
.pull(&target.origin, name, &target.ingest)
.await
.map_err(suggest_program)
}

/// Push a broadcast from the Origin to a remote SRT server (export).
Expand All @@ -212,7 +199,7 @@ pub async fn connect_export(
.with_latency(args.endpoint.latency.into())
.with_follow(args.follow.into())
.with_stitch(args.stitch);
Ok(client.publish(&origin, &name).await?)
Ok(client.publish(&origin, moq_srt::dial::Publish::new(name)).await?)
}

/// Parse `srt://host:port?streamid=<resource>` into a resolved address and resource.
Expand Down
Loading
Loading