code wiki / (root) / nx_nack.nx

nx_nack.nx

buildroot/runtime/nx_nack.nx

1834 B27 linesdepth 0pulls 0 transitivereach 1 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_nack.nx -- SOVEREIGN NACK (negative-acknowledgement selective retransmit), the loss-recovery rung that partners FEC + the jitter buffer. BENCHMARK: WebRTC's rtx/NACK -- when a frame is lost and FEC can't cover it, the receiver ASKS for it again, but ONLY if a retransmit can still arrive before its playout deadline (otherwise the request is wasted bandwidth). Built from scratch, pure integer, no third party, transport-agnostic. The DECISION is the whole game: request iff (time-to-deadline >= one RTT + a frame), rate-limited to one request per RTT (a retransmit can't have arrived sooner), capped at NACK_MAX_RETRIES (give up, let concealment handle it -- no NACK storm). Sender keeps a small history ring so it can honor requests. license_tier: ORIGINAL

dependencies 0 imports · 1 importers

nx_nack.nx nx_nack_gate.nx

imports: none

imported by: nx_nack_gate.nx

structs

none

consts

10const NACK_MAX_RETRIES: i64 = 3

functions

13func nack_should_request(seq: i64, now: i64, anchor_play: i64, anchor_seq: i64, frame_us: i64,
called by 2: runmain
24func nack_hist_put(hist_seq: *i64, H: i64, seq: i64) -> i64 { hist_seq[seq % H] = seq; return 0 }
called by 1: main
25func nack_hist_has(hist_seq: *i64, H: i64, seq: i64) -> i64 { if hist_seq[seq % H] == seq { return 1 } return 0 }
called by 1: main
27func main() -> i64 { return 0 }