code wiki / _hdl_build / nx_robust_dl.nx
nx_robust_dl.nx
buildroot/runtime/_hdl_build/nx_robust_dl.nx
about
nx_robust_dl.nx -- the ROBUST segment-download core (the "keep downloading, no broken fragments" engine),
grounded in the download-SOTA corpus (yt-dlp fragment-retries, aria2 max-tries/continue, HTTP Range resume,
TS sync-byte integrity, exponential backoff). Format-agnostic (HLS .ts, DASH .m4s, direct) via a fetch
CALLBACK, so nx_hls_get / a DASH orchestrator / the API daemon all wrap it, and the gate injects failures.
rdl_verify -- reject a truncated/corrupt fragment BEFORE it's stitched (the anti-broken-fragment gate)
rdl_fetch_retry -- fetch a fragment with up to max_tries attempts + integrity-verify each + backoff
rdl_state_* -- a persisted done-bitmap so an interrupted download RESUMES (skips done, never holes)
dependencies 1 imports · 5 importers
imports: nx_syscalls.nx
imported by: nx_dash_get.nxnx_dash_get_gate.nxnx_pardl.nxnx_pardl_gate.nxnx_robust_dl_gate.nx
structs
| none |
consts
| 11 | const RDL_GENERIC: i64 = 0 |
| 12 | const RDL_TS: i64 = 1 // MPEG-TS: 188-byte packets, each starting with the 0x47 sync byte |
functions
| 15 | func rdl_verify_ts(bytes: *u8, len: i64) -> i64 |
| 27 | func rdl_verify(bytes: *u8, len: i64, kind: i64) -> i64 |
| 38 | func rdl_fetch_retry(url: *u8, urllen: i64, out: *u8, outcap: i64, kind: i64, |
| 55 | func rdl_state_mark(state: *u8, idx: i64) -> i64 { state[idx] = 1 as u8; return 0 } |
| 56 | func rdl_state_done(state: *u8, idx: i64) -> i64 { if (state[idx] & 0xff) == 1 { return 1 } return 0 } |
| 57 | func rdl_state_count(state: *u8, n: i64) -> i64 { var c: i64 = 0; var i: i64 = 0; while i < n { if (state[i] & 0xff) == 1 { c = c + 1 } i = i + 1 } return c } |
| 59 | func rdl_state_save(path: *u8, state: *u8, n: i64) -> i64 |
| 68 | func rdl_state_load(path: *u8, state: *u8, n: i64) -> i64 |