feat(downloader): fan large segment batches across worker processes

One CPython interpreter caps sustained segment throughput at ~160 MB/s;
spawned children each run the existing thread-pool path on a contiguous
chunk of the batch, reaching NIC line rate on fast CDNs. Opt-in via
--download-processes (default 1), engaged only for 24+ segment batches.
Sessions are rebuilt per child from a picklable spec; RnetSession falls
back to a single process when it has no impersonate preset.
This commit is contained in:
imSp4rky
2026-07-16 10:26:44 -06:00
parent 2adf8bad87
commit f0e0c6d39e
10 changed files with 277 additions and 2 deletions
+2
View File
@@ -247,6 +247,7 @@ class Subtitle(Track):
cdm: Optional[object] = None,
no_proxy_download: bool = False,
adaptive_workers: bool = False,
download_processes: int = 1,
):
super().download(
session,
@@ -256,6 +257,7 @@ class Subtitle(Track):
cdm=cdm,
no_proxy_download=no_proxy_download,
adaptive_workers=adaptive_workers,
download_processes=download_processes,
)
if not self.path:
return