webrtc-core-0.5.35 has been yanked.
webrtc-core
Production-ready, low-latency core for realtime audio pipelines: slab-based packet buffers, jitter handling, SRTP (AES‑GCM) protection, and RTCP feedback (NACK / TWCC). Designed for high-throughput, low-footprint deployments.
[1] Why this crate
- Purpose-built API for high-throughput, low-latency production systems (VoIP, conferencing, and realtime media services).
- Highly concurrent, low-allocation primitives: slab allocator, index/byte rings, jitter buffer and RTCP queue — engineered to minimize pause and allocation jitter.
- In-place SRTP (AES‑GCM) protection to avoid extra copies on the hot path.
[2] Enterprise readiness
- Deterministic memory usage via preallocated slabs and ring buffers.
- Thread-safe, cache-padded atomics and minimal locking for scalable multi-threaded ingestion.
- Small runtime and dependency surface to ease embeddability and auditability.
- Designed for easy horizontal scaling: stateless ingest + small per-worker footprint.
Design philosophy: optimize the real-time audio fast path while keeping memory bounded and latency predictable.
[3] Quickstart
Minimal usage
use EngineHandle;
let handle = builder.build;
let payload = vec!;
handle.feed_packet.ok;
Provide SRTP key (in-place protection for future packets)
let key = ;
handle.provide_keying_material;
RTCP sender (async example)
use SocketAddr;
use Arc;
use UdpSocket;
use EngineHandle;
async
[4] Core API
EngineHandle— ergonomic entry point: builder,feed_packet,provide_keying_material,start_rtcp_sender,shutdown.MediaEngine— internal processing loop: jitter handling, packet processing, RTCP emission.SrtpContext— AES‑GCM SRTP helpers (in-place protect/unprotect).SlabAllocator,IndexRing,AudioJitterBuffer,RtcpSendQueue— low-level primitives for high-throughput audio.
[5] Notes
- Emphasizes predictable latency over generality; uses preallocated slabs and ring buffers to avoid allocations in the hot path.
- RTCP generation is conservative and designed to be driven by the jitter buffer's gap detection.
[6] Performance
Measured snapshot (this environment)
- Command run:
cargo run --release --example bench_micro - Observed (release build on this Windows dev machine):
- avg protect_inplace: 31 ns
- implied theoretical protects/sec: ~32M (1_000_000_000 / 31)
[7] Profiling tips
- Build with
--releaseand useperf(Linux) or Windows Performance Analyzer for hotspots. - For host-optimized results set
RUSTFLAGS='-C target-cpu=native'when building.
[8] Example behaviors
examples/bench_micro.rsprints micro-benchmark metrics (see above).examples/discord_clone.rsis a simple UDP+RTCP demo and starts a long-running RTCP sender loop - it will run until interrupted.
[9] Credits
- xbl1e - creator and maintainer