HLS: Don't merge on discontinuity, if it's the first segment

How the m3u8 parser handles/groups #EXT-X to segment objects means the #EXT-X-DISCONTINUITY (`discontinuity` property) is tied to whatever segment is below it's line. Therefore, there's never a scenario where we need to merge+decrypt and the first every segment of the for loop, as there's no segments before it.

This can happen from just slightly off-spec playlists (can't blame it) but also from the OnSegmentFilter filtering out all segments before the first EXT-X-DISCONTINUITY. Common to happen when filtering out bumpers/intros.
This commit is contained in:
rlaphoenix 2024-02-16 00:15:36 +00:00
parent eac5ed5b61
commit 6a37fe9d1b
1 changed files with 1 additions and 1 deletions

View File

@ -382,7 +382,7 @@ class HLS:
encode("utf8")
segment_file_path.write_bytes(segment_data)
if segment.discontinuity:
if segment.discontinuity and i != 0:
if encryption_data:
decrypt(include_this_segment=False)
merge_discontinuity()