Skip to content

Commit

Permalink
fix(HLS): Remove init segment on formats without init segment (#7060)
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed Jul 18, 2024
1 parent 2fe4dcc commit ee179ad
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/hls/hls_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3657,6 +3657,9 @@ shaka.hls.HlsParser = class {
const pMimeType = getMimeType(pUri);
if (pMimeType) {
partial.mimeType = pMimeType;
if (HlsParser.MIME_TYPES_WITHOUT_INIT_SEGMENT_.has(pMimeType)) {
partial.initSegmentReference = null;
}
}
partialSegmentRefs.push(partial);

Expand Down Expand Up @@ -3768,6 +3771,9 @@ shaka.hls.HlsParser = class {
const mimeType = getMimeType(hlsSegment.verbatimSegmentUri);
if (mimeType) {
reference.mimeType = mimeType;
if (HlsParser.MIME_TYPES_WITHOUT_INIT_SEGMENT_.has(mimeType)) {
reference.initSegmentReference = null;
}
}

if (segmentWithByteRangeOptimization) {
Expand Down Expand Up @@ -4969,6 +4975,19 @@ shaka.hls.HlsParser.EXTENSION_MAP_BY_CONTENT_TYPE_ = {
};


/**
* MIME types without init segment.
*
* @const {!Set.<string>}
* @private
*/
shaka.hls.HlsParser.MIME_TYPES_WITHOUT_INIT_SEGMENT_ = new Set([
'video/mp2t',
// Containerless types
...shaka.util.MimeUtils.RAW_FORMATS,
]);


/**
* @typedef {function(!shaka.hls.Tag, string):?shaka.extern.DrmInfo}
* @private
Expand Down

0 comments on commit ee179ad

Please sign in to comment.