Expand description
The half of a Vector call that runs anywhere: the wire format, the jitter buffer, the rate ladder, and the small signal-processing pieces that need no device. Everything that touches a microphone, a speaker, a codec library or a socket lives in the client that embeds this crate.
No clock: every function that reasons about time takes milliseconds in, so the same code runs under tokio, on a thread, and in a browser.
Modules§
- declick
- Removes the click a microphone makes when its cable is pulled or pushed in: a sample-to-sample slam that speech never produces, followed by a short offset tail. Runs a couple of milliseconds behind the input so the samples just before the slam can go too.
- jitter
- The adaptive jitter buffer: holds a few frames so the network’s unevenness is smoothed out before the decoder, grows on late arrivals, and takes the latency back when the path settles. Time comes in as milliseconds from the caller.
- link
- The link between the media engine and whatever captures, encodes, decodes and paints video (a webview over a loopback socket, or an in-process port). Binary messages, the first byte says what follows.
- rate
- Bitrate control for the encoder, fed by QUIC’s own loss accounting: every datagram rides in a packet the peer acknowledges, so the sender learns what went missing without a report channel. A lossy link steps the ladder down at once; a clean one climbs back a rung at a time.
- resample
- A streaming linear resampler: carries its phase and last sample across blocks so a live stream has no seam where one block ends and the next begins.
- ring
- A single-producer, single-consumer sample ring the audio callbacks can touch: no lock, no allocation, a dropped sample on overflow rather than a stall.
- share
- A shared screen’s sound on its way to the engine: interleaved samples at the capture’s own rate. Lives on the call, not the engine, so a device change does not lose what was in flight.
- stats
- The counters one call keeps for its whole life, shared by the media threads, the liveness check and the stats line. Atomics so no thread waits on another.
- wire
- The call’s wire format over one Iroh connection: a reliable control stream for the few messages that must arrive, unreliable QUIC datagrams for audio, where a late frame is worth less than nothing, and one unidirectional QUIC stream per video frame, so a keyframe always lands whole and a stale delta can be reset.
Constants§
- AEC_
TAIL_ MS - How late the echo may arrive after its far-end reference: device buffers plus room.
- ENGINE_
RATE - Fullband: what the devices run at, so the microphone and speaker paths usually need no resampling, and Opus keeps everything the microphone heard.
- FRAME
- FRAME_
MS