fix(sample): stop a malformed sidx from hanging the download

pymp4 loops forever on a sidx that counts more references than it holds. Manifest errors in download threads now raise instead of sys.exit.
This commit is contained in:
imSp4rky
2026-10-24 12:46:19 -06:00
parent 1036528fa3
commit bcef9ff87a
4 changed files with 18 additions and 11 deletions
+6
View File
@@ -345,6 +345,12 @@ def test_parse_sidx_refuses_what_it_cannot_cut() -> None:
assert parse_sidx(sidx_box(count=3)[:-4], 0) == (0, [])
def test_parse_sidx_refuses_a_box_that_counts_more_references_than_it_holds() -> None:
box = bytearray(sidx_box(count=3))
box[30:32] = (5).to_bytes(2, "big")
assert parse_sidx(bytes(box) + bytes(100), 0) == (0, [])
def test_a_single_file_dash_track_is_cut_by_its_segment_index(monkeypatch: pytest.MonkeyPatch) -> None:
box = sidx_box()
requested: list[str] = []