nx_mediapath.nx
buildroot/runtime/nx_mediapath.nx
about
nx_mediapath.nx -- self-healing BEST-MEDIA-PATH selection: the unifier.
Generalizes the proven self-heal decision pattern (nx_netscope_heal:
KEEP/SWITCH/GIVEUP + anti-flap hysteresis) from "best DNS resolver" to
"best media path/relay", ranking candidates by MEASURED link quality
(nx_linkqual lq_score) instead of reachability. So a game match or a
video call given N candidate paths auto-migrates to the best-quality one
when the current path degrades -- WITHOUT flapping on noise.
Pure/deterministic (decide over a frozen set of LinkFlows) -> KAT-able.
Integer-only, imports only nx_linkqual (-> nx_syscalls); sovereign, no
new deps. Concepts: Happy-Eyeballs best-of-N + hysteresis (already
researched for the resolver case); quality = the link-quality score.
license_tier: ORIGINAL
dependencies 1 imports · 2 importers
imports: nx_linkqual.nx
imported by: nx_mediapath_test.nxnx_pathstripe.nx
structs
| 32 | struct MediaDecision { action: i64, target_idx: i64, target_score: i64, reason: i64 } |
consts
| 18 | const MP_KEEP: i64 = 0 |
| 19 | const MP_SWITCH: i64 = 1 |
| 20 | const MP_GIVEUP: i64 = 2 |
| 22 | const MP_R_HEALTHY: i64 = 0 // incumbent still best -> stay |
| 23 | const MP_R_DEGRADED: i64 = 1 // incumbent dropped below usable -> move to best |
| 24 | const MP_R_BETTER: i64 = 2 // a meaningfully better path appeared |
| 25 | const MP_R_NONE: i64 = 3 // no usable path (stuck on least-bad / no candidates) |
| 29 | const MP_QUALITY_FLOOR: i64 = 40 // below = FAIR/POOR boundary = unusable |
| 30 | const MP_SWITCH_MARGIN: i64 = 15 // only switch a usable path for >=15 pts gain |
| 33 | const MP_DECISION_BYTES: i64 = 32 |
functions
| 37 | func mp_select_best(flows: *i64, n: i64) -> i64 |
| 50 | func mp_decide(flows: *i64, n: i64, incumbent_idx: i64, out: *MediaDecision) -> i64 |
| 98 | func mp_render(out: *MediaDecision) -> i64 |