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.
This commit is contained in:
rlaphoenix 2024-05-11 22:11:43 +01:00
parent 345cc5aba6
commit dde55fd708
1 changed files with 2 additions and 2 deletions

View File

@ -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"),