code wiki / _hdl_build / nx_room_sfu.nx
nx_room_sfu.nx
buildroot/runtime/_hdl_build/nx_room_sfu.nx
about
nx_room_sfu.nx -- X-ROOM (GEN-ROOM-sfu-selective-forward): sovereign DETERMINISTIC
SFU bandwidth ALLOCATOR -- the selective-forwarding intelligence of a multi-party
video room, benchmarked HEAD-TO-HEAD against Jitsi Videobridge's PUBLISHED algorithm.
RESEARCH-GROUNDED (jitsi-videobridge/doc/allocation.md + BandwidthAllocator.kt):
Jitsi orders sources by speech activity (dominant speaker first), applies last-N
(sources beyond N get maxHeight=0), then runs an ITERATIVE GREEDY allocation: loop
sources in priority order, improve() each to its highest affordable layer before
moving on. Jitsi's doc ADMITS: "No explicit fairness mechanism ensures equal
distribution among same-priority sources." => under constrained bandwidth the greedy
pass STARVES lower-priority participants (0 layers = NO video for that person).
EXCEED axis (honest, measured): same last-N + dominant-speaker ordering, but a
BASE-LAYER FAIRNESS guarantee FIRST (every in-frame participant gets the base layer
if the budget covers all bases), THEN prioritized improvement with the remainder.
Result at the SAME bandwidth: NO starvation (everyone visible) where Jitsi's greedy
leaves several participants with no video at all -- plus deterministic + audit-
replayable (same inputs -> same allocation, which a runtime-BWE greedy cannot promise).
HONEST SCOPE: allocation algorithm head-to-head (fairness/determinism); NOT a
throughput bench on Jitsi's hardware (Xeon E5-1620v2, 1056 streams/550Mbps/20% CPU).
main() is the SELF-VALIDATING GATE. Evidence -> knowledge/status/room_sfu.log.
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
| 26 | const SFU_LOG: *u8 = "knowledge/status/room_sfu.log" |
functions
| 28 | func uw(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 } |
| 29 | func uwn(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 } |
| 35 | func sfu_alloc(base: i64, mid: i64, high: i64, N: i64, last_n: i64, budget: i64, mode: i64, alloc: *i64) -> i64 called by 1: main |
| 70 | func sfu_total(alloc: *i64, N: i64) -> i64 called by 1: main |
| 76 | func sfu_visible(alloc: *i64, N: i64) -> i64 { // #endpoints getting ANY video called by 1: main |
| 83 | func main() -> i64 |