Skip to content

In HLS playlists byte range is sometimes assigned by mistake to init segments without a byte range #8783

@sruditsky

Description

@sruditsky

Let's assume we have an HLS media playlist containing the following sequence:

...
#EXT-X-BYTERANGE:n@o
urlA
#EXT-X-DISCONTINUITY
#EXT-X-MAP:URI="uriB"
...

in other words it has a media segment with a byte range followed by an init segment without a byte range.

We use ExoPlayer r2.12.3 and when it parses such a sequence HlsPlaylistParser:

  1. reads the EXT-X-BYTERANGE line and sets segmentByteRangeLength and segmentByteRangeOffset
  2. reads urlA and resets segmentByteRangeLength (line 792 in the java file), but not segmentByteRangeOffset
  3. reads EXT-X-MAP, this line does not have a byte range and segmentByteRangeOffset is erroneously kept from the previous segment. I.e. the init segment is created with a byte range while it should not have it.

Duplicating the following passage which is already present (at line 741) just before the initializationSegment constructing code in line 640 seems to solve this issue:

        if (segmentByteRangeLength == C.LENGTH_UNSET) {
          // The segment is not byte range defined.
          segmentByteRangeOffset = 0;
        }

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions