From dde55fd708ef4faec048cd45496c385ce3c28373 Mon Sep 17 00:00:00 2001 From: rlaphoenix <17136956+rlaphoenix@users.noreply.github.com> Date: Sat, 11 May 2024 22:11:43 +0100 Subject: [PATCH] fix(DASH): Correct SegmentTemplate range stop value Since range(start, stop) is start-inclusive but stop-exclusive, and DASH startNumber of SegmentTemplate typically will be 1 or not specified (defaulting to 1) it effectively worked by coincidence. However, if startNumber was anything other than 1 than we will have a problem. --- devine/core/manifests/dash.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devine/core/manifests/dash.py b/devine/core/manifests/dash.py index b3a556a..49d3ee7 100644 --- a/devine/core/manifests/dash.py +++ b/devine/core/manifests/dash.py @@ -328,7 +328,7 @@ class DASH: for _ in range(1 + (int(s.get("r") or 0))): segment_durations.append(current_time) current_time += int(s.get("d")) - seg_num_list = list(range(start_number, len(segment_durations) + start_number)) + seg_num_list = list(range(start_number, len(segment_durations) + 1)) for t, n in zip(segment_durations, seg_num_list): segments.append(( @@ -347,7 +347,7 @@ class DASH: segment_duration = float(segment_template.get("duration")) or 1 total_segments = math.ceil(period_duration / (segment_duration / segment_timescale)) - for s in range(start_number, start_number + total_segments): + for s in range(start_number, total_segments + 1): segments.append(( DASH.replace_fields( segment_template.get("media"),