Rust workspace with 7 crates implementing a custom VoIP protocol designed for extremely lossy connections (5-70% loss, 100-500kbps, 300-800ms RTT). 89 tests passing across all crates. Crates: - wzp-proto: Wire format, traits, adaptive quality controller, jitter buffer, session FSM - wzp-codec: Opus encoder/decoder (audiopus), Codec2 stubs, adaptive switching, resampling - wzp-fec: RaptorQ fountain codes, interleaving, block management (proven 30-70% loss recovery) - wzp-crypto: X25519+ChaCha20-Poly1305, Warzone identity compatible, anti-replay, rekeying - wzp-transport: QUIC via quinn with DATAGRAM frames, path monitoring, signaling streams - wzp-relay: Integration stub (Phase 2) - wzp-client: Integration stub (Phase 2) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
46 lines
1.8 KiB
Rust
46 lines
1.8 KiB
Rust
//! WarzonePhone FEC Layer
|
|
//!
|
|
//! Forward Error Correction using RaptorQ fountain codes with temporal interleaving.
|
|
//!
|
|
//! This crate provides:
|
|
//! - [`RaptorQFecEncoder`] — accumulates audio frames into FEC blocks and generates repair symbols
|
|
//! - [`RaptorQFecDecoder`] — reassembles source blocks from received source and repair symbols
|
|
//! - [`Interleaver`] — spreads symbols across blocks to mitigate burst losses
|
|
//! - [`BlockManager`](block_manager) — tracks block lifecycle on encoder and decoder sides
|
|
//! - [`AdaptiveFec`] — maps quality profiles to FEC parameters
|
|
|
|
pub mod adaptive;
|
|
pub mod block_manager;
|
|
pub mod decoder;
|
|
pub mod encoder;
|
|
pub mod interleave;
|
|
|
|
pub use adaptive::AdaptiveFec;
|
|
pub use block_manager::{DecoderBlockManager, DecoderBlockState, EncoderBlockManager, EncoderBlockState};
|
|
pub use decoder::RaptorQFecDecoder;
|
|
pub use encoder::RaptorQFecEncoder;
|
|
pub use interleave::Interleaver;
|
|
|
|
pub use wzp_proto::{FecDecoder, FecEncoder, QualityProfile};
|
|
|
|
/// Create an encoder/decoder pair configured for the given quality profile.
|
|
pub fn create_fec_pair(
|
|
profile: &QualityProfile,
|
|
) -> (RaptorQFecEncoder, RaptorQFecDecoder) {
|
|
let cfg = AdaptiveFec::from_profile(profile);
|
|
let encoder = cfg.build_encoder();
|
|
let decoder = RaptorQFecDecoder::new(cfg.frames_per_block, cfg.symbol_size);
|
|
(encoder, decoder)
|
|
}
|
|
|
|
/// Create an encoder configured for the given quality profile.
|
|
pub fn create_encoder(profile: &QualityProfile) -> RaptorQFecEncoder {
|
|
AdaptiveFec::from_profile(profile).build_encoder()
|
|
}
|
|
|
|
/// Create a decoder configured for the given quality profile.
|
|
pub fn create_decoder(profile: &QualityProfile) -> RaptorQFecDecoder {
|
|
let cfg = AdaptiveFec::from_profile(profile);
|
|
RaptorQFecDecoder::new(cfg.frames_per_block, cfg.symbol_size)
|
|
}
|