mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-12-23 16:38:57 +00:00
[fd/hls] Fix format_index=0 parsing with --hls-split-discontinuity
When treating each discontinuity as a separate format, this code should
only consider items within the requested discontinuity. But when the
requested discontinuity has index 0, it currently considers everything
because 0 is not truthy.
Fix the issue by explicitly checking for non-`None` `format_index`,
which indicates that `--hls-split-discontinuity` was passed.
Fixes: 310c2ed2c6 ("Better support HLS media discontinuity and fully support media initialization (#105)")
This commit is contained in:
@@ -198,7 +198,7 @@ class HlsFD(FragmentFD):
|
||||
line = line.strip()
|
||||
if line:
|
||||
if not line.startswith('#'):
|
||||
if format_index and discontinuity_count != format_index:
|
||||
if format_index is not None and discontinuity_count != format_index:
|
||||
continue
|
||||
if ad_frag_next:
|
||||
continue
|
||||
@@ -224,7 +224,7 @@ class HlsFD(FragmentFD):
|
||||
byte_range = {}
|
||||
|
||||
elif line.startswith('#EXT-X-MAP'):
|
||||
if format_index and discontinuity_count != format_index:
|
||||
if format_index is not None and discontinuity_count != format_index:
|
||||
continue
|
||||
if frag_index > 0:
|
||||
self.report_error(
|
||||
|
||||
Reference in New Issue
Block a user