rtciv0.5.0
rtci 0.5.0 · MSRV 1.89 · MIT OR Apache-2.0

WebRTC in Rust,
without the I/O.

rtci is a Rust implementation of WebRTC with a sans-I/O architecture: the protocol logic is separate from all I/O, so the application controls networking, threading and the async runtime. There is no ambient clock either: every method that needs the time takes an Instant from you, which makes a whole session reproducible in a test without a socket or a sleep.

cargo add [email protected]

rtci 0.5.0: the first release of the 0.5 line. The audit's last open MUST and SHOULD rows are closed, fifty-two defaults change (each with the setting that gives the 0.4 form where there is one), and two additions break exhaustive code: RTCCertificate gains a public origin field, and RTCLocalCandidatesNeededReason gains RolledBack. Moving from 0.4 is an edit of the version requirement (rtci = "0.5"), not a cargo update. What's new in 0.5.0.

loop {
    // Drain everything the connection wants to send.
    while let Some(msg) = pc.poll_write() {
        socket.send_to(&msg.message, msg.transport.peer_addr).await?;
    }

    // Drain state changes and notifications.
    while let Some(event) = pc.poll_event() { /* ... */ }

    // Drain inbound application messages.
    while let Some(TaggedRTCMessage { now, message }) = pc.poll_read() { /* ... */ }

    // Wait for whichever comes first: a packet or the next protocol deadline.
    let timeout = pc.poll_timeout().unwrap_or(Instant::now() + DEFAULT_TIMEOUT);
    // ... then pc.handle_timeout(Instant::now()) or pc.handle_read(datagram)
}
From README.md, Event Loop Example (excerpt)

What it covers

Peer connections with ICE, DTLS-SRTP, SCTP data channels, RTP/RTCP and JSEP negotiation. Each claim of the README's feature list has its specification section, its code and the test that proves it in docs/conformance.md.

ICE, STUN, TURN, mDNS

NAT traversal with STUN and TURN, trickle ICE and ICE restart, ICE over TCP (active, passive, simultaneous-open) and mDNS candidates. TURN over UDP, TCP, TLS and DTLS is run by the engine.

DTLS and SRTP

DTLS 1.2 and 1.3 with DTLS-SRTP key export; SRTP and SRTCP with AES-GCM and Cryptex. Cryptography goes through a pluggable provider: ring or aws-lc-rs built in, or your own.

SCTP data channels

SCTP (RFC 9260) under data channels, in-band (DCEP) and out-of-band, with ordered, unordered and partially reliable delivery.

RTP / RTCP media transport

Audio and video RTP transport, simulcast (RID-based, both ways), SVC signalling, RTX, FlexFEC and ULPFEC, and the RTCP session. Encoding, decoding, capture and playout are the application's.

JSEP and SDP

Offer/answer negotiation with Unified Plan SDP, BUNDLE, renegotiation and rollback.

Interceptors

A composable RTP/RTCP pipeline: NACK, TWCC and RFC 8888 feedback, GCC bandwidth estimation with a pacer, the RTP circuit breaker and key-frame requests by default.

Statistics

getStats per the W3C WebRTC Statistics API, for what a transport measures; members that need an encoder, decoder or playout are left out, not reported as 0.

Behaviour profiles

The defaults follow the RFCs. Every place where the engine and an RFC, or the engine and libwebrtc, choose differently is a setting, and a profile (Rfc, Chrome, StrictRfc, Performance) sets them all in one call.

The crate family

The engine decides and runs every protocol and never touches a socket or a clock. A host layer owns the sockets and timers; an FFI library carries it to JavaScript runtimes.

The engine

rtci 0.5.0

A sans-I/O WebRTC implementation: peer connections with ICE, DTLS-SRTP, SCTP data channels, RTP/RTCP and JSEP negotiation

and 17 protocol crates (rtci-ice, rtci-dtls, rtci-sctp, ...), each usable alone and re-exported by rtci, and the reference driver rtci-stream-driver.

Host I/O

rtci-host 0.2.0

The host I/O around the sans-I/O rtci WebRTC engine: sockets, timers, STUN/TURN clients, ICE-TCP, mDNS and media, behind a permission gate and a socket factory

Front ends build on it; rtci-ffi is one. Both still build against rtci 0.4 (their manifests), not 0.5.0.

FFI for JavaScript runtimes

rtci-ffi 0.1.0

rtci-host as a dynamic library for JavaScript runtimes that load WebRTC through FFI (dodo-bindgen)

Prebuilt for five targets on each GitHub release, with SHA-256 checksums.

Status, as released

Pre-1.0: while the version is 0.x, a minor version may break the API. From the audit's generated counts at v0.5.0 (COUNTS.md), across 113 audited specifications:

5217 of 5217

MUST rows that apply have their RFC behaviour tested (100.0 %); 5177 (99.2 %) as the default. 0 partial, 0 violated.

1060 of 1060

SHOULD rows that apply have their RFC behaviour tested (100.0 %); 1044 (98.5 %) as the default.

83 governed defaults

Where the engine and an RFC, or the engine and Chrome, choose differently: each one a setting, each with its value in all four profiles.

Interop gate

Browser and independent-peer cells (Chromium, Firefox, WebKit, Pion, str0m, aiortc) run in the test environment; the gate fails the run unless every cell is a pass or a cited n/a (a known engine gap may stand as a marked expected failure).

The audit's 0 open MUST and 0 open SHOULD rows cover the engine crates. They do not yet cover the socket duties of the reference driver rtci-stream-driver (the I/O the engine leaves to its driver); those are fixed for 0.6.0, which is not released yet.

Lineage

rtci descends from webrtc-rs rtc as of upstream commit 0fbcaa74 and is developed independently; its crates were renamed from rtc / rtc-* to rtci / rtci-* at 0.1.0. Upstream's licence and copyright notices are retained. FORK.md lists what it carries over upstream.

Install rtci →