code wiki / _hdl_build / nx_robust_dl.nx

nx_robust_dl.nx

buildroot/runtime/_hdl_build/nx_robust_dl.nx

4416 B74 linesdepth 2pulls 2 transitivereach 5 importersview sourcekind library
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_robust_dl.nx nx_dash_get.nx nx_dash_get_gate.nx nx_pardl.nx nx_pardl_gate.nx nx_robust_dl_gate.nx

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

11const RDL_GENERIC: i64 = 0
12const RDL_TS: i64 = 1 // MPEG-TS: 188-byte packets, each starting with the 0x47 sync byte

functions

15func rdl_verify_ts(bytes: *u8, len: i64) -> i64
27func rdl_verify(bytes: *u8, len: i64, kind: i64) -> i64
called by 1: rdl_fetch_retry calls 1: rdl_verify_ts
38func rdl_fetch_retry(url: *u8, urllen: i64, out: *u8, outcap: i64, kind: i64,
called by 1: dg_download calls 2: rdl_verifysys_sleep_ms
55func rdl_state_mark(state: *u8, idx: i64) -> i64 { state[idx] = 1 as u8; return 0 }
56func rdl_state_done(state: *u8, idx: i64) -> i64 { if (state[idx] & 0xff) == 1 { return 1 } return 0 }
57func 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 }
59func rdl_state_save(path: *u8, state: *u8, n: i64) -> i64
68func rdl_state_load(path: *u8, state: *u8, n: i64) -> i64