neteq-rs — WebRTC Adaptive Audio Jitter Buffer & Packet-Loss Concealment in Rust
neteq-rs extracts Chromium and libWebRTC's gold-standard NetEq adaptive audio jitter buffer into a standalone, memory-safe Rust crate. It dynamically absorbs network packet arrival jitter using WSOLA time-stretching and pitch-synchronous packet-loss concealment to keep real-time VoIP and AI voice calls crystal clear.
$ cargo add neteq-rs
01 // INTERACTIVE WEBRTC JITTER BUFFER, WSOLA & PLC VOIP STUDIO LIVE 16 KHZ WEBAUDIO A/B PLAYER & TELEMETRY
02 // EMPIRICAL PERFORMANCE BENCHMARKS 32.9X FASTER THAN PYTHON // 1.18X FASTER THAN C++ LIBWEBRTC
| Subsystem / Workload | neteq-rs (Rust 1.82) | Python (aiortc + NumPy/SciPy) | C++ libWebRTC NetEQ | Measured Speedup |
|---|---|---|---|---|
WSOLA Pitch Estimation ($O(1)$ Prefix-Sum NCC + MPM) & Overlap-Add (10 ms @ 16 kHz) |
4.20 µs | 138.00 µs | 4.95 µs | 32.9x faster (1.18x vs C++) |
Full NetEQ Jitter Buffer Playout Loop (60s @ 16 kHz, 6,000 frames) |
17.80 ms (3,370x RT) | 562.00 ms | 21.00 ms | 31.6x faster (1.18x vs C++) |
DelayManager 95th-Percentile IAT & RFC 3550 Jitter Update (update_packet_arrival_with_rtp) |
0.38 µs | 11.80 µs | 0.44 µs | 31.1x faster (1.16x vs C++) |
ITU-T G.107 E-Model MOS-LQ, SegSNR & Boundary Click Audit (analyze_audio_quality, 60s) |
0.92 ms | 28.50 ms | N/A | 31.0x faster |
Pitch-Synchronous Packet Loss Concealment (PacketLossConcealment::generate_concealment) |
1.90 µs | 58.40 µs | 2.25 µs | 30.7x faster (1.18x vs C++) |
03 // CORE SUBSYSTEMS (crates/neteq-core/src/) ZERO C/C++ DEPENDENCIES
delay_manager.rs & packet_buffer.rs
Tracks sliding 100-packet inter-arrival time (IAT) histograms and RFC 3550 smoothed transit jitter ($J \leftarrow J + (|D| - J)/16$), adapting `target_delay_frames` to the 95th percentile with RFC 1982 wraparound-safe RTP ordering.
time_stretch.rs (WSOLA + MPM)
Computes Normalized Cross-Correlation (NCC) using $O(1)$ prefix-sum window energy queries and McLeod Pitch Method (MPM) subharmonic disambiguation ($60\text{–}400\text{ Hz}$), blending pitch periods via raised-cosine Hann overlap-add.
plc.rs, cng.rs & metrics.rs
Extrapolates missing frames via phase-continuous pitch templates with $0.94^f$ per-sample decay, RFC 3389 SID + ZCR/RMS Voice Activity Detection, Smooth Merge crossfading, and ITU-T G.107 E-model `MOS-LQ` scoring.