diff options
author | Felix S <felix.von.s@posteo.de> | 2021-04-23 10:55:09 +0200 |
---|---|---|
committer | Felix S <felix.von.s@posteo.de> | 2021-04-28 17:21:35 +0530 |
commit | 15828bcf25adb2d9ce2e9e591cc527f695e50420 (patch) | |
tree | 78f80bacb0cbacec022305ca0562b3db9ce59019 | |
parent | 333217f43e58f93fc8088d4854044b907adddce5 (diff) | |
download | hypervideo-pre-15828bcf25adb2d9ce2e9e591cc527f695e50420.tar.lz hypervideo-pre-15828bcf25adb2d9ce2e9e591cc527f695e50420.tar.xz hypervideo-pre-15828bcf25adb2d9ce2e9e591cc527f695e50420.zip |
[downloader/hls] Handle MPEG-2 PES timestamp overflow
-rw-r--r-- | yt_dlp/downloader/hls.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/yt_dlp/downloader/hls.py b/yt_dlp/downloader/hls.py index c0e52d35d..270b33b22 100644 --- a/yt_dlp/downloader/hls.py +++ b/yt_dlp/downloader/hls.py @@ -351,7 +351,16 @@ class HlsFD(FragmentFD): # add the cue to the window dedup_window.append(cue) elif isinstance(block, webvtt.Magic): - # XXX: we do not handle MPEGTS overflow + # take care of MPEG PES timestamp overflow + if block.mpegts is None: + block.mpegts = 0 + extra_state.setdefault('webvtt_mpegts_adjust', 0) + block.mpegts += extra_state['webvtt_mpegts_adjust'] << 33 + if block.mpegts < extra_state.get('webvtt_mpegts_last', 0): + extra_state['webvtt_mpegts_adjust'] += 1 + block.mpegts += 1 << 33 + extra_state['webvtt_mpegts_last'] = block.mpegts + if frag_index == 1: extra_state['webvtt_mpegts'] = block.mpegts or 0 extra_state['webvtt_local'] = block.local or 0 |