BRANDON HUBBARD // ENGINEERING PORTAL
RUST · REAL-TIME AUDIO & WEBRTC

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
GitHub ↗

01 // INTERACTIVE WEBRTC JITTER BUFFER, WSOLA & PLC VOIP STUDIO

Click any frame in the Jitter Buffer chart to inspect its WSOLA / PLC waveform & NCC pitch lag
Target Delay (95%)
50.0 ms
RFC 3550 Jitter
14.2 ms
ITU-T G.107 MOS-LQ
3.94 / 4.50
WSOLA Stretch
14 Acc / 9 Exp
PLC + Merge Frames
12 PLC / 8 Mrg
Boundary Clicks
0 (vs 47 Naive)
JITTER BUFFER TIMELINE (120 FRAMES = 1.20s) // BUFFER DEPTH VS 95TH-%ILE TARGET DELAY & DECISION STATE RIBBON INSPECTING FRAME #24 (240ms) // OP: NORMAL
Normal Accelerate (WSOLA -1 Pitch Cycle) PreemptiveExpand (WSOLA +1 Pitch Cycle) Expand (PLC Extrapolation) Smooth Merge (Hann Crossfade) ComfortNoise (CNG)
WAVEFORM & NCC PITCH ESTIMATOR // LEFT: FRAME PCM WAVEFORM (NETEQ VS NAIVE DROPOUT)  |  RIGHT: O(1) NCC PITCH CORRELATION r(τ) MPM PITCH LAG: 110 SAMPLES (145.5 Hz) | CLARITY: 0.98

02 // EMPIRICAL PERFORMANCE BENCHMARKS

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/)

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.