Skip to content

Commit

Permalink
fix(DASH): Correct SegmentTemplate range stop value
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rlaphoenix committed May 11, 2024
1 parent 345cc5a commit dde55fd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions devine/core/manifests/dash.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def download_track(
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((
Expand All @@ -347,7 +347,7 @@ def download_track(
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"),
Expand Down

0 comments on commit dde55fd

Please sign in to comment.