]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[downloader/hls] Fix incorrect end byte in Range HTTP header for media segments with...
authorStefan Pöschel <basicmaster@users.noreply.github.com>
Thu, 17 Sep 2020 22:26:56 +0000 (00:26 +0200)
committerGitHub <noreply@github.com>
Thu, 17 Sep 2020 22:26:56 +0000 (05:26 +0700)
The end of the byte range is the first byte that is NOT part of the to
be downloaded range. So don't include it into the requested HTTP
download range, as this additional byte leads to a broken TS packet and
subsequently to e.g. visible video corruption.

Fixes #14748.

youtube_dl/downloader/hls.py

index 84bc349288052fe15e92be61e72645db007003d0..0f2c06f40414fd94154c69d2aad365880dcb0e20 100644 (file)
@@ -141,7 +141,7 @@ class HlsFD(FragmentFD):
                     count = 0
                     headers = info_dict.get('http_headers', {})
                     if byte_range:
-                        headers['Range'] = 'bytes=%d-%d' % (byte_range['start'], byte_range['end'])
+                        headers['Range'] = 'bytes=%d-%d' % (byte_range['start'], byte_range['end'] - 1)
                     while count <= fragment_retries:
                         try:
                             success, frag_content = self._download_fragment(