From 6a37fe9d1b72c632eaa1812817f30c70597fd848 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Fri, 16 Feb 2024 00:15:36 +0000 Subject: [PATCH] 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. --- devine/core/manifests/hls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devine/core/manifests/hls.py b/devine/core/manifests/hls.py index 5166876..b384a2f 100644 --- a/devine/core/manifests/hls.py +++ b/devine/core/manifests/hls.py @@ -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()