Spaces:
Running
Running
Z Agent commited on
Commit ·
f9e41f8
1
Parent(s): 4a90d00
booster: 6 parallel ranges (measured: parallel connections keep ~430KB/s each)
Browse files303 unmodified lines304305306307308309310311312313314303 unmodified linesreturn hasync def _boosted_segment(u: str, headers: dict, total: int, parts: int = 4):"""Fetch a binary segment as `parts` parallel HTTP Range requests andreassemble. Returns the full bytes on success, or None on ANY problem(caller falls back to the normal single-stream path). Segments arebounded (a few MB), so buffering the reassembled body is fine."""step = total // partsif step < 256 * 1024:return None303 unmodified lines304305306307308309310311312313314315316317318319303 unmodified linesreturn hasync def _boosted_segment(u: str, headers: dict, total: int, parts: int = 6):"""Fetch a binary segment as `parts` parallel HTTP Range requests andreassemble. Returns the full bytes on success, or None on ANY problem(caller falls back to the normal single-stream path). Segments arebounded (a few MB), so buffering the reassembled body is fine.parts=6: measured per-connection throttle is ~450KB/s and parallelconnections keep most of their individual rate (3 concurrent ≈ 433KB/seach), so 6 parts ≈ 2.2MB/s aggregate — a 10s/5MB segment lands in~2-3s instead of 11s, comfortably inside hls.js's fragment budget."""step = total // partsif step < 256 * 1024:return None
main.py+7-2