Only write segment data if the tfhd fix was necessary in DASH

This commit is contained in:
rlaphoenix 2023-05-17 01:22:59 +01:00
parent 681d69d5e5
commit 6d4be8620c
1 changed files with 4 additions and 3 deletions

View File

@ -450,13 +450,14 @@ class DASH:
if isinstance(track, Audio):
with open(segment_save_path, "rb+") as f:
segment_data = f.read()
segment_data = re.sub(
fixed_segment_data = re.sub(
b"(tfhd\x00\x02\x00\x1a\x00\x00\x00\x01\x00\x00\x00)\x02",
b"\\g<1>\x01",
segment_data
)
f.seek(0)
f.write(segment_data)
if fixed_segment_data != segment_data:
f.seek(0)
f.write(fixed_segment_data)
return data_size