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:
- reads the EXT-X-BYTERANGE line and sets segmentByteRangeLength and segmentByteRangeOffset
- reads urlA and resets segmentByteRangeLength (line 792 in the java file), but not segmentByteRangeOffset
- 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;
}