code wiki / (root) / nx_jitterbuf.nx

nx_jitterbuf.nx

buildroot/runtime/nx_jitterbuf.nx

2095 B35 linesdepth 0pulls 0 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_jitterbuf.nx -- sovereign ADAPTIVE PLAYOUT DELAY (jitter buffer) sizing for the snapshot interpolator (nx_interp). The interp playout delay is the latency/smoothness dial: too small -> the buffer starves (peer freezes/extrapolates) under jitter; too large -> needless lag. This sizes it to MEASURED jitter (RFC 3550 interarrival-jitter smoothing) and GROWS FAST / SHRINKS SLOW so a jitter spike is covered immediately but latency creeps back down as the link calms. 100% nx, no syscalls -> wasm-friendly. The host only timestamps arrivals; all control logic is here. State jb[*i64]: [0]=last_recv_ms [1]=jitter_acc(~16x mean|D|) [2]=send_interval [3]=playout_delay [4]=min_delay [5]=max_delay [6]=count license_tier: ORIGINAL

dependencies 0 imports · 2 importers

nx_jitterbuf.nx nx_adverse_net_gate.nx nx_jitterbuf_gate.nx

imports: none

imported by: nx_adverse_net_gate.nxnx_jitterbuf_gate.nx

structs

none

consts

none

functions

12func jb_init(jb: *i64, send_interval: i64, min_delay: i64, max_delay: i64) -> i64
called by 2: mainmain
16func jb_jitter(jb: *i64) -> i64 { return jb[1] / 16 } // smoothed mean deviation of interarrival
called by 1: main
17func jb_playout(jb: *i64) -> i64 { return jb[3] }
called by 2: mainmain
21func jb_on_recv(jb: *i64, recv_ms: i64) -> i64
called by 2: mainmain