code wiki / _hdl_build / nx_room_jitterbuf.nx
nx_room_jitterbuf.nx
buildroot/runtime/_hdl_build/nx_room_jitterbuf.nx
about
nx_room_jitterbuf.nx -- X-ROOM (overseas-grade): sovereign DETERMINISTIC ADAPTIVE
JITTER BUFFER. After loss (handled by nx_room_fec), JITTER is the other killer of
intercontinental calls: packets over a long-haul path arrive with variable delay,
so a fixed buffer is either too small (late packets dropped = choppy) or too big
(constant added latency). This sizes the buffer from MEASURED jitter, causally.
MODEL: r[i] = packet i's arrival delay RELATIVE to its ideal playout slot (ms),
anchored at packet 0 (clock-offset-free). A packet is ON-TIME iff r[i] <= target
depth chosen from PAST jitter (env = peak-hold with linear decay): target =
clamp(env+margin, min, max). Late packets are counted (they'd be concealed).
latency cost = the buffer depth (target); loss = #late.
EXCEED axis (honest) vs Zoom/WebRTC/Teams jitter buffers: a deterministic,
audit-replayable depth controller that PARETO-DOMINATES fixed buffers on the same
trace -- fewer late-losses than a fixed-SMALL buffer AND lower average latency than
a fixed-LARGE buffer that achieves the same loss. Sovereign, integer-exact.
main() is the SELF-VALIDATING GATE. Evidence -> knowledge/status/room_jitterbuf.log.
HONEST SCOPE: causal depth control on a relative-delay trace; full RFC3550 inter-
arrival estimator + playout-clock resync = deeper rung. license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 23 | const JB_LOG: *u8 = "knowledge/status/room_jitterbuf.log" |
functions
| 25 | func jw(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 } |
| 26 | func jwn(fd: i64, v: i64) -> i64 { let bb: *u8 = sys_mmap(28); var m: i64=v; if m<0 {m=0-m; sys_write(fd,"-" as *u8,1)}; let t: *u8 = sys_mmap(28); var k: i64=0; if m==0 {t[0]=48;k=1}; while m>0 {t[k]=(48+(m%10)) as u8; m=m/10; k=k+1}; var i: i64=0; while i<k {bb[i]=t[k-1-i]; i=i+1}; sys_write(fd, bb, k); return 0 } |
| 30 | func jb_run(r: *i64, N: i64, fixed_target: i64, margin: i64, mind: i64, maxd: i64, decay: i64, out: *i64) -> i64 called by 1: main |
| 54 | func main() -> i64 |