Thanks to visit codestin.com
Credit goes to github.com

Skip to content

stream.hls: move sequence counter to base class#6707

Merged
bastimeyer merged 4 commits into
streamlink:masterfrom
bastimeyer:stream/segmented/sequence
Nov 5, 2025
Merged

stream.hls: move sequence counter to base class#6707
bastimeyer merged 4 commits into
streamlink:masterfrom
bastimeyer:stream/segmented/sequence

Conversation

@bastimeyer

@bastimeyer bastimeyer commented Nov 1, 2025

Copy link
Copy Markdown
Member

The goal of this code refactor (and upcoming ones) is to move as much common code from the HLS and DASH implementations to their common base class. This is one of the first steps.


  1. Move the sequence counter from HLSStreamWorker to the base SegmentedStreamWorker, so that the DASH implementation can utilize the same logic later (stream.segmented: add --stream-segmented-duration #6705 from last week has already moved the duration counter). None of the Writer/Worker/Reader/Stream code is considered a public interface apart from the main Stream constructor and respective classmethod, so renaming attributes is not considered a breaking change, even though some of Streamlink's plugins require an update. If this breaks third party plugins, then those will require a fix. I'm always a bit careful about this...
  2. Move the sequence gap warning from the HLS implementation to the base class and reword the warning message. Keep the gap check function call in the HLS implementation for now.
  3. Use the sequence counter of the base class in the DASHStreamWorker and pass it to the MPD parser's segments() generator, so SegmentList manifests which require reloads don't have to pass the sequence counter from MPD object to MPD object. This also removes the gap warnings from the parser and re-uses the worker's gap warnings.
  4. Finally move the sequence gap check to the base class's run loop

Upcoming changes will (hopefully) be

  • init segment rework
  • data reload rework
  • better debug logging

Rename `playlist_sequence` to `sequence` and move it to its base class
- Pass the worker's `sequence` to the segments iterator,
  so the MPD doesn't need to remember the `SegmentList` sequence
  when reloading the manifest.
- Remove the sequence gap warning from the parser
  and instead use the worker's warnings, according to the segment number
- Remove duplicate `self.closed` check in the segments iterator
- Update tests
Move `check_sequence_gap()` from the HLS/DASH workers to the base class
@bastimeyer bastimeyer force-pushed the stream/segmented/sequence branch from 232dee0 to fd2f141 Compare November 1, 2025 17:11
@bastimeyer bastimeyer marked this pull request as ready for review November 5, 2025 17:40
@bastimeyer bastimeyer merged commit 066537d into streamlink:master Nov 5, 2025
18 checks passed
@bastimeyer bastimeyer deleted the stream/segmented/sequence branch November 5, 2025 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant