Skip to main content

Module interleave

Module interleave 

Source
Expand description

Block interleaving: a sender-side transmit-order permutation that converts a burst loss into a spread loss the per-block FEC can recover.

Without interleaving, the k+r datagrams of one block ship consecutively, so a burst that drops B consecutive packets removes B shards from one block - and if B > r, that block is unrecoverable. With interleave depth D, the datagrams of D blocks ship column-major: shard 0 of blocks 0..D, then shard 1 of blocks 0..D, and so on. The datagrams of any one block are then spaced D apart on the wire, so a burst of up to D consecutive losses removes at most ONE shard from each block - back inside FEC’s r-parity budget.

This is purely a sender-side reordering. The receiver routes every datagram by its (block_id, shard_index) header (crate::reliable_udp::Decoder), so it reassembles correctly regardless of arrival order and needs no de-interleave logic.

Cost: the interleaver buffers up to D blocks before emitting the first datagram, trading D-block latency for burst tolerance. D is a control-table knob (crate::control_table::ControlTable); D = 1 is pass-through with no added latency.

Structs§

Interleaver
Buffers up to depth blocks of datagrams and emits them column-major so each block’s shards are spaced depth apart on the wire.