Skip to content

Commit d503e88

Browse files
committed
fix(HLS): Fix playback of content with mixed containers (mp4 and ts) (#8837)
We currently have many integrated transmuxers, so we should avoid assigning the same mimetype to all unloaded variants. We can dynamically transmux all content; we just need a compatible codec. Partial reverts #4601
1 parent 6c81c23 commit d503e88

File tree

2 files changed

+2
-28
lines changed

2 files changed

+2
-28
lines changed

lib/hls/hls_parser.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2528,7 +2528,6 @@ shaka.hls.HlsParser = class {
25282528
firstSequenceNumber: -1,
25292529
nextMediaSequence: -1,
25302530
nextPart: -1,
2531-
loadedOnce: false,
25322531
};
25332532

25342533
const getUris = () => {
@@ -2631,7 +2630,6 @@ shaka.hls.HlsParser = class {
26312630
realStreamInfo.mediaSequenceToStartTime;
26322631
streamInfo.nextMediaSequence = realStreamInfo.nextMediaSequence;
26332632
streamInfo.nextPart = realStreamInfo.nextPart;
2634-
streamInfo.loadedOnce = true;
26352633
stream.segmentIndex = realStream.segmentIndex;
26362634
stream.encrypted = realStream.encrypted;
26372635
stream.drmInfos = realStream.drmInfos;
@@ -2673,18 +2671,6 @@ shaka.hls.HlsParser = class {
26732671
this.manifest_);
26742672
}
26752673

2676-
if (type == ContentType.VIDEO || type == ContentType.AUDIO) {
2677-
for (const otherStreamInfo of this.uriToStreamInfosMap_.values()) {
2678-
if (!otherStreamInfo.loadedOnce && otherStreamInfo.type == type &&
2679-
!otherStreamInfo.stream.isAudioMuxedInVideo) {
2680-
// To aid manifest filtering, assume before loading that all video
2681-
// renditions have the same MIME type. (And likewise for audio.)
2682-
otherStreamInfo.stream.mimeType = realStream.mimeType;
2683-
this.setFullTypeForStream_(otherStreamInfo.stream);
2684-
}
2685-
}
2686-
}
2687-
26882674
if (type == ContentType.TEXT) {
26892675
const firstSegment = realStream.segmentIndex.earliestReference();
26902676
if (firstSegment && firstSegment.initSegmentReference) {
@@ -3101,7 +3087,6 @@ shaka.hls.HlsParser = class {
31013087
nextMediaSequence,
31023088
nextPart,
31033089
mediaSequenceToStartTime,
3104-
loadedOnce: false,
31053090
};
31063091
}
31073092

@@ -5195,7 +5180,6 @@ shaka.hls.HlsParser = class {
51955180
* firstSequenceNumber: number,
51965181
* nextMediaSequence: number,
51975182
* nextPart: number,
5198-
* loadedOnce: boolean,
51995183
* }}
52005184
*
52015185
* @description
@@ -5231,8 +5215,6 @@ shaka.hls.HlsParser = class {
52315215
* The next media sequence.
52325216
* @property {number} nextPart
52335217
* The next part.
5234-
* @property {boolean} loadedOnce
5235-
* True if the stream has been loaded at least once.
52365218
*/
52375219
shaka.hls.HlsParser.StreamInfo;
52385220

test/hls/hls_parser_unit.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5789,12 +5789,8 @@ describe('HlsParser', () => {
57895789

57905790
await actualVideo0.createSegmentIndex();
57915791

5792-
// After loading just ONE stream, all MIME types agree again, and have been
5793-
// updated to reflect the TS content found inside the loaded playlist.
5794-
// This is how we avoid having the unloaded tracks filtered out during
5795-
// startup.
57965792
expect(actualVideo0.mimeType).toBe('video/mp2t');
5797-
expect(actualVideo1.mimeType).toBe('video/mp2t');
5793+
expect(actualVideo1.mimeType).toBe('video/mp4');
57985794
});
57995795

58005796
it('lazy-loads AAC content without filtering it out', async () => {
@@ -5849,13 +5845,9 @@ describe('HlsParser', () => {
58495845

58505846
await actualAudio0.createSegmentIndex();
58515847

5852-
// After loading just ONE stream, all MIME types agree again, and have been
5853-
// updated to reflect the AAC content found inside the loaded playlist.
5854-
// This is how we avoid having the unloaded tracks filtered out during
5855-
// startup.
58565848
expect(actualAudio0.mimeType).toBe('audio/aac');
58575849
expect(actualAudio0.codecs).toBe('mp4a');
5858-
expect(actualAudio1.mimeType).toBe('audio/aac');
5850+
expect(actualAudio1.mimeType).toBe('audio/mp4');
58595851
expect(actualAudio1.codecs).toBe('mp4a');
58605852
});
58615853

0 commit comments

Comments
 (0)