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
13 changes: 4 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ anyhow = "1"
arrayvec = "0.7.6"
ash = "0.38"
async-trait = "0.1"
aws-lc-rs = "1"
# Keep axum's defaults except tower-log, which enables tracing-to-log macros workspace-wide.
axum = { version = "0.8", default-features = false, features = [
"form",
Expand Down Expand Up @@ -102,7 +101,6 @@ crc = "3"
# (`fallback-dynamic-loading`), so nothing links against libcuda at build time.
cudarc = { version = "0.19", default-features = false, features = ["driver", "fallback-dynamic-loading", "cuda-12020"] }
data-encoding = "2.11"
der = "0.8"
dispatch2 = "0.3.1"
ebml-iterable = "0.7.1"
fastrand = "2"
Expand Down Expand Up @@ -221,7 +219,6 @@ rind-rustls = "0.1.12"
rustc-hash = "2.1.3"
rustls-native-certs = "0.8.5"
sd-notify = "0.5"
sec1 = "0.8"
send_wrapper = "0.6"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
Expand Down
2 changes: 1 addition & 1 deletion doc/bin/rtc.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ Once the original publisher leaves, the session ends with an error, and the
player or `export rtc --connect` must reconnect to reach the replacement.
`--connect` runs until its session ends.

Built on a vendored, trimmed copy of [str0m](https://github.com/algesten/str0m); the library is
Built on a vendored, trimmed copy of [str0m](https://github.com/algesten/str0m), with DTLS and SRTP on [rind](https://github.com/moq-dev/rind); the library is
[`moq-webrtc`](https://github.com/moq-dev/moq/tree/main/rs/moq-webrtc).
10 changes: 3 additions & 7 deletions quest/m1/rind/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# MoQ on rind
# [M] MoQ on rind

## Goal

Expand Down Expand Up @@ -49,8 +49,8 @@ instead, so every crate drops C, not just the relay.
CPUs without the crypto extensions (e2ee, which no binary links, switched
on 0.1.0). Relay ACME, the one area that waited on `rind-instant-acme`, is
removed for now instead (maintainer, 2026-11-03), and returns on rind in m5.
aws-lc-rs stays in the workspace until
the last area lands, which is when this epic removes it.
Every area has landed, and the workspace declares no aws-lc-rs dependency;
the epic's own work below removes what still reaches it.
- Split per area, each landing once rind covers it. Docs a change makes stale
(CPU requirements, removed features) are edited inline in that area's PR; no
separate docs page.
Expand All @@ -62,7 +62,3 @@ The epic's own work, once every child has merged:
crate.
- Add an `armv7-unknown-linux-gnueabihf` moq-cli release with v4l2, and point
`doc/bin/cli.md`'s board note at it for boards running a 32-bit OS.

## Required

- [moq-webrtc on rind](/quest/m1/rind/rtc.md) - str0m and dimpl run DTLS, SRTP, and STUN on rind
29 changes: 0 additions & 29 deletions quest/m1/rind/rtc.md

This file was deleted.

5 changes: 2 additions & 3 deletions quest/m3/webrtc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Decided 2026-10-30 with the maintainer (planning interview), after the str0m wor
- **Vendor, then replace.** Copy the upstream crates in, trim them, and fix them in-tree. Replacing a layer with our own (SDP, RTP/RTCP, SRTP, SCTP) is a later child once a concrete need appears; none is planned yet.
- **One crate.** The ICE driver (once `moq-ice`) and moq-tokio's former `webrtc` data-channel transport live in `moq-webrtc`, which depends on moq-tokio rather than the reverse, so moq-tokio needs no ICE or SCTP. The vendored crates become private modules, not separate published crates, keeping their MIT/Apache-2.0 notices (str0m's `packet/` carries webrtc-rs's Apache notice).
- **What goes** (from the 2026-10-30 inventory: we use frame mode, full ICE, and DTLS 1.2, and never enable str0m's BWE, pacer, or stats): GCC bandwidth estimation (8k lines; GCC is ported into `moq-congestion` as `moq_congestion::gcc`), the leaky pacer (replaced by moq-congestion's pacer, made public by [rtc-pacing](/quest/m3/rtc-pacing.md)), H.266, RED, DTMF, G.7xx and comfort noise, VLA and simulcast layers, RTCP app feedback, stats, internal test exports, and dimpl's DTLS 1.3 and version auto-selection. RTCP XR stays: its RRTR/DLRR blocks are the receive side's only RTT measurement, which sets NACK retries and the video recovery deadline. Roughly 17k of str0m's 72k lines and 11k of dimpl's 33k.
- **DTLS 1.2 only.** Every browser negotiates 1.2 today. [moq-webrtc on rind](/quest/m1/rind/rtc.md) narrows to 1.2 to match.
- **DTLS 1.2 only.** Every browser negotiates 1.2 today, and the vendored rind crypto provider offers 1.2 only to match.
- **SCTP stays**, for browser data channels in [P2P](/quest/m4/p2p/README.md), but compiles only with the data-channel feature, so WHIP/WHEP builds carry none of it. Vendored, it can later be simplified or put on moq-congestion.
- **Upstream fixes:** after vendoring, nobody merges upstream automatically. Record the vendored upstream versions in the crate docs; the release-cut audit checks the upstream changelogs for security fixes (malformed SRTP/RTCP input, for example) and ports them.
- Docs a change makes stale (crate names, `doc/lib/rs`, `doc/setup/upgrade.md`, other quests naming a crate or module) change in the PR that makes them stale.
Expand All @@ -26,9 +26,8 @@ Decided 2026-10-30 with the maintainer (planning interview), after the str0m wor
- [The stack takes kio clock time](/quest/m3/webrtc/clock.md) - the vendored code takes `kio::clock::Instant`, so sim tests drive it directly
- [WHIP/WHEP builds carry no SCTP](/quest/m3/webrtc/sctp-feature.md) - SCTP compiles only with the `p2p` feature
- [The vendored stack keeps only what browsers negotiate](/quest/m3/webrtc/browser-only.md) - PSK suites, `ccm`, and anything else no browser uses are gone
- [The vendored stack exposes only what moq-webrtc calls](/quest/m3/webrtc/dead-api.md) - dead upstream API is deleted once rind and clock settle the seams
- [The vendored stack exposes only what moq-webrtc calls](/quest/m3/webrtc/dead-api.md) - dead upstream API is deleted once clock settles the time seams

## Related

- [moq-webrtc paces WHEP viewers](/quest/m3/rtc-pacing.md) - adds the NACK hook and the shared pacer on the vendored stack
- [moq-webrtc on rind](/quest/m1/rind/rtc.md) - the vendored DTLS and SRTP take rind's crypto
5 changes: 2 additions & 3 deletions quest/m3/webrtc/dead-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ tests; dead upstream API is deleted.

Planned 2026-11-07 (maintainer, /quest-complete), a follow-up of
[moq-dev/moq#8163](https://github.com/moq-dev/moq/pull/8163). It waits on
the rind and clock quests, since both reshape the seams moq-webrtc calls
through. The vendored tree opens with `#![allow(warnings, reason = "vendored
the clock quest, which reshapes the time seams moq-webrtc calls through, as
the move to rind already did the crypto seams. The vendored tree opens with `#![allow(warnings, reason = "vendored
upstream code")]` (`rs/moq-webrtc/src/vendor/mod.rs`), so first narrow that
allow to let `dead_code` fire, then delete what the report shows unreached,
keeping upstream's tests for what stays.
Expand All @@ -19,5 +19,4 @@ Public API: none. Wire: none.

## Required

- [moq-webrtc on rind](/quest/m1/rind/rtc.md) - settles the crypto seams
- [The stack takes kio clock time](/quest/m3/webrtc/clock.md) - settles the time seams
4 changes: 2 additions & 2 deletions rs/moq-cli/src/rtc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub async fn connect_import(target: ImportTarget, url: Url, instance: moq_net::I
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);
let client = moq_webrtc::Client::new(config)?;
client.subscribe(url, route.broadcast().clone()).await?;
Ok(())
}
Expand All @@ -128,7 +128,7 @@ pub async fn connect_export(origin: moq_net::origin::Consumer, url: Url, name: S
tracing::info!(url = %RedactedUrl::new(&url), %name, "WHIP client pushing");
notify_ready();

let client = moq_webrtc::Client::new(moq_webrtc::client::Config::default());
let client = moq_webrtc::Client::new(moq_webrtc::client::Config::default())?;
client.publish(url, source).await?;
Ok(())
}
Expand Down
8 changes: 4 additions & 4 deletions rs/moq-relay/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1778,14 +1778,14 @@ mod tests {
fn a_peer_reports_its_lineage_to_the_listener_root() {
let root_key = rind_rcgen::KeyPair::generate(&rcgen::PKCS_ECDSA_P256_SHA256).unwrap();
let mut root_params = rcgen::CertificateParams::new(Vec::<String>::new()).unwrap();
root_params.serial_number = Some(1u64.into());
root_params.is_ca = rcgen::IsCa::Ca(rcgen::BasicConstraints::Unconstrained);
let root = root_params.self_signed(&root_key).unwrap();
let issuer = rcgen::Issuer::new(root_params, root_key);
let key = rind_rcgen::KeyPair::generate(&rcgen::PKCS_ECDSA_P256_SHA256).unwrap();
let leaf = rcgen::CertificateParams::new(vec!["edge0.invalid".to_string()])
.unwrap()
.signed_by(&key, &issuer)
.unwrap();
let mut leaf = rcgen::CertificateParams::new(vec!["edge0.invalid".to_string()]).unwrap();
leaf.serial_number = Some(2u64.into());
let leaf = leaf.signed_by(&key, &issuer).unwrap();

let dir = tempfile::tempdir().unwrap();
let path = dir.path().join("root.pem");
Expand Down
7 changes: 3 additions & 4 deletions rs/moq-relay/tests/integration/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ mod wire_stats;
/// A certificate handle for a web stack, which only reads it to publish fingerprints.
fn certificates() -> moq_tokio::tls::Certificates {
let key = rind_rcgen::KeyPair::generate(&rcgen::PKCS_ECDSA_P256_SHA256).expect("keypair");
let cert = rcgen::CertificateParams::new(vec!["localhost".into()])
.expect("cert params")
.self_signed(&key)
.expect("self-signed cert");
let mut params = rcgen::CertificateParams::new(vec!["localhost".into()]).expect("cert params");
params.serial_number = Some(1u64.into());
let cert = params.self_signed(&key).expect("self-signed cert");
moq_tokio::tls::Certificates::from_pem(cert.pem().as_bytes()).expect("certificates")
}

Expand Down
4 changes: 3 additions & 1 deletion rs/moq-tokio/src/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3060,6 +3060,7 @@ mod tests {
) -> (CertificateDer<'static>, rcgen::Issuer<'static, rind_rcgen::KeyPair>) {
let key = rind_rcgen::KeyPair::generate(&rcgen::PKCS_ECDSA_P256_SHA256).unwrap();
let mut params = rcgen::CertificateParams::new(Vec::<String>::new()).unwrap();
params.serial_number = Some(1u64.into());
params.is_ca = rcgen::IsCa::Ca(rcgen::BasicConstraints::Unconstrained);
let cert = match parent {
Some(parent) => params.signed_by(&key, parent).unwrap(),
Expand All @@ -3070,7 +3071,8 @@ mod tests {

fn lineage_leaf(issuer: &rcgen::Issuer<'_, rind_rcgen::KeyPair>) -> CertificateDer<'static> {
let key = rind_rcgen::KeyPair::generate(&rcgen::PKCS_ECDSA_P256_SHA256).unwrap();
let params = rcgen::CertificateParams::new(vec!["client.invalid".to_string()]).unwrap();
let mut params = rcgen::CertificateParams::new(vec!["client.invalid".to_string()]).unwrap();
params.serial_number = Some(1u64.into());
params.signed_by(&key, issuer).unwrap().into()
}

Expand Down
16 changes: 8 additions & 8 deletions rs/moq-webrtc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,21 @@ p2p = ["dep:if-addrs", "dep:mdns-sd", "dep:qmux", "moq-tokio/qmux"]
# The vendored stack's AES-CCM DTLS suites.
aes = { workspace = true }
arrayvec = { workspace = true }
# The vendored stack's crypto provider: DTLS, SRTP, and STUN MESSAGE-INTEGRITY.
aws-lc-rs = { workspace = true }
axum = { workspace = true, optional = true }
base64ct = { workspace = true }
bytes = { workspace = true }
ccm = { workspace = true }
# The vendored stack's SDP parser.
combine = { workspace = true }
crc = { workspace = true }
# The vendored DTLS's certificate and key parsing.
der = { workspace = true }
fastrand = { workspace = true }
hang = { workspace = true }
if-addrs = { workspace = true, optional = true }
# Drives each WebRTC connection over its UDP socket.
kio = { workspace = true, features = ["runtime"] }
mdns-sd = { workspace = true, optional = true }
# Refuses a CPU rind can't run on, and gives the WHIP/WHEP client rind's rustls provider.
moq-crypto = { workspace = true, features = ["provider"] }
moq-mux = { workspace = true, features = ["async"] }
moq-net = { workspace = true }
# `RedactedUrl` keeps a dialed URL's query token and userinfo out of the logs, and with
Expand All @@ -56,14 +54,15 @@ moq-tokio = { workspace = true }
# The vendored DTLS's record parser.
nom = { workspace = true }
once_cell = { workspace = true }
pkcs8 = { workspace = true, features = ["pem"] }
qmux = { workspace = true, optional = true }
rand = { workspace = true }
# The vendored DTLS's self-signed certificates.
rcgen = { workspace = true, features = ["aws_lc_rs"] }
reqwest = { workspace = true, features = ["rustls"] }
rcgen = { workspace = true }
reqwest = { workspace = true, features = ["rustls-no-provider"] }
# The vendored stack's crypto: DTLS, SRTP, and STUN MESSAGE-INTEGRITY.
rind = { workspace = true }
rind-rcgen = { workspace = true }
rustc-hash = { workspace = true }
sec1 = { workspace = true }
serde = { workspace = true }
slab = { workspace = true }
spki = { workspace = true }
Expand All @@ -76,6 +75,7 @@ tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true }
url = { workspace = true }
uuid = { version = "1", features = ["v4"] }
# The vendored DTLS's certificate parsing.
x509-cert = { workspace = true }

[dev-dependencies]
Expand Down
15 changes: 11 additions & 4 deletions rs/moq-webrtc/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,17 @@ impl Client {
/// [`reqwest::Client`] (with its connection pool and rustls config) is created
/// once here and reused across every [`subscribe`](Self::subscribe) /
/// [`publish`](Self::publish) call.
pub fn new(config: Config) -> Self {
Self {
///
/// Fails with [`Error::UnsupportedCpu`](crate::Error::UnsupportedCpu) on a CPU
/// rind can't run on.
pub fn new(config: Config) -> crate::Result<Self> {
// reqwest reads rustls's process default and panics without one, so install rind's
// unless the host already chose a provider.
moq_crypto::provider::install_default()?;
Ok(Self {
config,
http: reqwest::Client::new(),
}
http: reqwest::Client::builder().build()?,
})
}

pub(crate) fn config(&self) -> &Config {
Expand Down Expand Up @@ -111,6 +117,7 @@ mod tests {
.parse()
.expect("WHEP URL");
let err = Client::new(Config::default())
.unwrap()
.subscribe(url, broadcast.broadcast().clone())
.await
.expect_err("dial a closed port");
Expand Down
4 changes: 2 additions & 2 deletions rs/moq-webrtc/src/client/whep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

use crate::vendor::str0m;
use str0m::{
Candidate, Rtc,
Candidate,
change::SdpAnswer,
media::{Direction, MediaKind},
};
Expand All @@ -23,7 +23,7 @@ pub(crate) async fn dial(client: &Client, url: Url, broadcast: moq_net::broadcas
let sink = Box::new(IngestSink::new(broadcast, config)?);

let socket = session::bind_udp(&client.config().ice_candidates).await?;
let mut rtc = Rtc::new(kio::clock::now().into_std());
let mut rtc = session::rtc_config()?.build(kio::clock::now().into_std());
for addr in socket.locals() {
let cand = Candidate::host(*addr, "udp").map_err(Error::rtc)?;
rtc.add_local_candidate(cand);
Expand Down
2 changes: 1 addition & 1 deletion rs/moq-webrtc/src/client/whip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub(crate) async fn dial(client: &Client, url: Url, source: moq_mux::Source) ->
let socket = session::bind_udp(&client.config().ice_candidates).await?;
// Restrict to codecs the catalog can actually source so the remote
// answer doesn't pick a codec we have no rendition for.
let mut rtc = session::rtc_with_codecs(&codecs);
let mut rtc = session::rtc_with_codecs(&codecs)?;
for addr in socket.locals() {
let cand = Candidate::host(*addr, "udp").map_err(Error::rtc)?;
rtc.add_local_candidate(cand);
Expand Down
4 changes: 4 additions & 0 deletions rs/moq-webrtc/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ pub enum Error {
/// An internal video bridge could not be initialized.
#[error("video bridge initialization failed")]
BridgeFailed,

/// This CPU lacks a feature rind, the crypto under DTLS, SRTP, and HTTPS, requires.
#[error(transparent)]
UnsupportedCpu(#[from] moq_crypto::cpu::UnsupportedCpu),
}

impl From<reqwest::Error> for Error {
Expand Down
Loading
Loading