rtciv0.5.0

The crate family

19 crates published from the rtci workspace at 0.5.0, plus rtci-host 0.2.0 and rtci-ffi 0.1.0, each in a repository of its own.

  your application (signalling, the loop)        a JavaScript runtime (Deno.dlopen)
                 |                                              |
                 |                                         rtci-ffi 0.1.0
                 |                                              |
                 |                     rtci-host 0.2.0  (sockets, timers, STUN/TURN
                 |                         |        clients, ICE-TCP, mDNS, media, events)
                 v                         v
  rtci 0.5.0  the engine: JSEP, ICE, DTLS, SCTP, data channels, SRTP, RTP/RTCP
                 |      (never opens a socket, arms a timer or reads the clock)
                 +-- rtci-ice  rtci-stun  rtci-turn  rtci-mdns  rtci-dtls  rtci-srtp
                 +-- rtci-sctp  rtci-datachannel  rtci-rtp  rtci-rtcp  rtci-sdp
                 +-- rtci-interceptor (+ -derive)  rtci-media  rtci-sframe
                 +-- rtci-shared  rtci-crypto (ring | aws-lc-rs | your provider)

  rtci-stream-driver 0.5.0: an optional tokio (or other runtime) driver that owns the
  engine's TCP sockets, or a whole peer connection's sockets (feature peer)

Engine and driver

The engine (rtci) decides and runs every protocol: which TCP candidates exist, which connections to open and when to close them, RFC 4571 and TURN framing, TLS and DTLS to TURN servers, the TURN client, STUN Binding requests, the Happy Eyeballs race, NAPTR / SRV resolution order, ICE, DTLS, SCTP and SRTP. It names listeners and connections by id and never touches a socket or a clock. A driver owns the sockets and nothing else: it binds, connects, accepts, reads, writes, closes and resolves names when the engine says so, and reports what happened. The application owns its UDP sockets, signalling and the loop (README, "Driving the Engine").

The rtci workspace

The engine is the root crate, rtci; each protocol is a crate of its own, usable alone and re-exported by rtci (rtci::ice, rtci::dtls, ...). Each crate's README lists the specifications it implements; its API page here renders that README.

CrateWhat it is (its manifest)
rtciA sans-I/O WebRTC implementation: peer connections with ICE, DTLS-SRTP, SCTP data channels, RTP/RTCP and JSEP negotiationcrates.io · docs.rs
rtci-cryptoProvider-neutral cryptography interface of a sans-I/O WebRTC stack, with ring and aws-lc-rs providerscrates.io · docs.rs
rtci-datachannelWebRTC data channels and the Data Channel Establishment Protocol (RFC 8831, RFC 8832), sans-I/Ocrates.io · docs.rs
rtci-dtlsSans-I/O DTLS 1.2 and 1.3 (RFC 6347, RFC 9147) with DTLS-SRTP key export, for WebRTCcrates.io · docs.rs
rtci-iceSans-I/O ICE agent (RFC 8445) with trickle ICE, ICE-TCP and consent freshness, for WebRTCcrates.io · docs.rs
rtci-interceptorSans-I/O RTP/RTCP interceptor pipeline for WebRTC: RTCP reports, NACK, TWCC, congestion control, pacing, FECcrates.io · docs.rs
rtci-interceptor-deriveDerive and attribute macros for the interceptor traits of a sans-I/O WebRTC stackcrates.io · docs.rs
rtci-mediaMedia samples and container readers and writers (IVF, Ogg Opus, H.264 / H.265 Annex B) for WebRTCcrates.io · docs.rs
rtci-mdnsSans-I/O mDNS (RFC 6762) querier and responder, as used for WebRTC mDNS ICE candidatescrates.io · docs.rs
rtci-rtcpRTCP packet parsing and serialization (RFC 3550, RFC 4585, RFC 5104, RFC 3611, RFC 8888) for WebRTCcrates.io · docs.rs
rtci-rtpRTP packets, header extensions (RFC 3550, RFC 8285) and codec payload formats for WebRTCcrates.io · docs.rs
rtci-sctpSans-I/O SCTP (RFC 9260) with partial reliability and stream reconfiguration, for WebRTC data channelscrates.io · docs.rs
rtci-sdpSDP parsing and serialization (RFC 8866) with the attributes WebRTC negotiation usescrates.io · docs.rs
rtci-sframeSans-I/O SFrame (RFC 9605) end-to-end media encryptioncrates.io · docs.rs
rtci-sharedShared types of a sans-I/O WebRTC stack: marshalling traits, transport context, replay detection, the stream transport interfacecrates.io · docs.rs
rtci-srtpSans-I/O SRTP and SRTCP (RFC 3711, RFC 7714 AES-GCM, RFC 9335 Cryptex) for WebRTCcrates.io · docs.rs
rtci-stunSTUN messages, attributes and a sans-I/O client (RFC 8489), for WebRTCcrates.io · docs.rs
rtci-turnSans-I/O TURN client (RFC 8656, RFC 6062 TCP allocations) for WebRTCcrates.io · docs.rs

The reference driver

rtci-stream-driverA socket driver for a sans-I/O WebRTC engine (ICE-TCP, TURN over TCP and TLS, whole peer connections) on an async runtime of your choicecrates.io · docs.rs

Unlike the other crates of the workspace this one does I/O, through the async runtime it is given (runtime::Runtime; tokio, smol and a virtual-time mock are built in behind features). It carries out the engine's stream commands (listen, connect, close, reset, resolve), and with the default feature peer, peer::PeerDriver drives a whole peer connection over sockets it owns, its UDP host sockets included. It also has what a server decides and the engine does not: port ranges, which local addresses get candidates, one UDP port and one passive ICE-TCP port shared by many peer connections.

rtci-host

rtci-hostThe 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 factorycrates.io · docs.rs

rtci-host gives each Peer (one RTCPeerConnection) its UDP sockets, timers and driver task, STUN/TURN clients over UDP, TCP and TLS, ICE-TCP in both roles and mDNS, media (transceivers, packetizing, frame assembly, encoded frames, DTMF, stats and fake capture devices for tests) and a queue of W3C events for the front end. Two traits stand between the engine and the network: NetGate, the permission gate (there is no allowing default), and NetIo, the socket factory. It was extracted from the Denext-Deno fork's ext/webrtc; that fork's built-in extension and rtci-ffi are its two front ends. Source: Brainwires/rtci-host. See Using rtci-host.

rtci-ffi

rtci-ffirtci-host as a dynamic library for JavaScript runtimes that load WebRTC through FFI (dodo-bindgen)crates.io · docs.rs

The native half of WebRTC for runtimes that load it through plain FFI (Deno.dlopen), built with dodo-bindgen 2.0: one class, Engine, and buildId. Every value crosses in caller-provided buffers, so a host needs only Deno.dlopen and symbol calls. The JavaScript half, the shim that installs RTCPeerConnection and the rest of the W3C API over it, lives with the runtime that uses it. Source: Brainwires/rtci-ffi. See rtci-ffi from JavaScript and the prebuilt libraries.

Not published

rtci-video, rtci-video-interop, rtci-custom-runtime-example. The README names rtci-video, the receive-side video pipeline, as in development and not part of the 0.5.0 release; the others are example, interop and test crates (as are the examples' signalling helper, the fuzz crates and the benchmark).