fix(ism): emit two stsd entries so sample_description_index 2 resolves

Smooth fragments set tfhd sample_description_index=2 against a server init carrying a second, identical sample entry. A lone entry left that dangling: mp4decrypt skipped every such fragment silently and demuxers stopped after the first, yielding a file that looked fine but was almost entirely encrypted.
This commit is contained in:
imSp4rky
2026-07-25 12:59:55 -06:00
parent 8cf1700684
commit b7029c343e
2 changed files with 80 additions and 1 deletions
+4 -1
View File
@@ -773,7 +773,10 @@ def build_init_segment(
else:
raise NotImplementedError(f"Unsupported text FourCC: {fourcc}")
stsd = full_box(b"stsd", 0, 0, u32.pack(1) + sample_entry_box)
# Fragments may set tfhd sample_description_index=2 (server inits carry a second,
# identical entry). A lone entry leaves that dangling: mp4decrypt skips those
# fragments and demuxers stop after the first.
stsd = full_box(b"stsd", 0, 0, u32.pack(2) + sample_entry_box * 2)
# --- empty sample tables (fragmented: real samples live in moof/traf) ---
stbl = box(