nx_bwe.nx
buildroot/runtime/nx_bwe.nx
about
nx_bwe.nx -- SOVEREIGN bandwidth estimator (the "adapt to the pipe" rung). BENCHMARK: WebRTC's GCC
(Google Congestion Control) = a delay-based signal (queuing delay TREND: is one-way delay rising =
a queue building ahead of us?) + a loss-based signal, combined into an AIMD controller (additive
increase when the path is clear, multiplicative decrease the instant congestion appears). Rebuilt from
scratch, pure integer, no third party, transport-agnostic. Output = an available-bitrate estimate that
feeds nx_media_budget's uplink input, so the ladder rides the REAL pipe instead of a static guess.
bwe_on_arrival(send_ts, arr_ts) : per-packet inter-arrival delay variation -> EWMA trend
bwe_report_loss(lost, total) : windowed loss -> EWMA loss rate
bwe_update() : one AIMD step -> new estimate (call ~1x/RTT)
license_tier: ORIGINAL
dependencies 0 imports · 1 importers
imports: none
imported by: nx_bwe_gate.nx
structs
| none |
consts
| 12 | const BW_EST: i64 = 0 |
| 13 | const BW_LOSS: i64 = 1 // EWMA loss, permille |
| 14 | const BW_TREND: i64 = 2 // EWMA inter-arrival delay variation (rising = queue building) |
| 15 | const BW_PSEND: i64 = 3 |
| 16 | const BW_PARR: i64 = 4 |
| 17 | const BW_HAVE: i64 = 5 |
| 18 | const BW_MIN: i64 = 6 |
| 19 | const BW_MAX: i64 = 7 |
| 20 | const BW_INC: i64 = 8 |
| 22 | const BW_TREND_THRESH: i64 = 50 // delay-variation units above which a queue is deemed building |
| 23 | const BW_LOSS_HI: i64 = 100 // 10% -> congested |
| 24 | const BW_LOSS_LO: i64 = 20 // 2% -> safe to probe up |
| 25 | const BW_DEC_NUM: i64 = 85 // multiplicative decrease = x0.85 (fast back-off, GCC-style) |
| 26 | const BW_DEC_DEN: i64 = 100 |
functions
| 28 | func bwe_init(bw: *i64, min_kbps: i64, max_kbps: i64, start_kbps: i64, inc_kbps: i64) -> i64 called by 1: run |
| 40 | func bwe_on_arrival(bw: *i64, send_ts: i64, arr_ts: i64) -> i64 called by 1: run |
| 50 | func bwe_report_loss(bw: *i64, lost: i64, total: i64) -> i64 called by 1: run |
| 57 | func bwe_update(bw: *i64) -> i64 called by 1: run |
| 71 | func bwe_estimate(bw: *i64) -> i64 { return bw[BW_EST] } called by 1: run |
| 73 | func main() -> i64 { return 0 } |