Skip to content

Commit 34b69fa

Browse files
authored
fix(HLS): Fix audio detection when there is no audio data but it appears in PMT (#7838)
1 parent 5b13332 commit 34b69fa

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

lib/media/segment_utils.js

+20-10
Original file line numberDiff line numberDiff line change
@@ -64,24 +64,34 @@ shaka.media.SegmentUtils = class {
6464
switch (tsCodecs.audio) {
6565
case 'aac':
6666
case 'aac-loas':
67-
codecs.push('mp4a.40.2');
68-
hasAudio = true;
67+
if (tsParser.getAudioData().length) {
68+
codecs.push('mp4a.40.2');
69+
hasAudio = true;
70+
}
6971
break;
7072
case 'mp3':
71-
codecs.push('mp4a.40.34');
72-
hasAudio = true;
73+
if (tsParser.getAudioData().length) {
74+
codecs.push('mp4a.40.34');
75+
hasAudio = true;
76+
}
7377
break;
7478
case 'ac3':
75-
codecs.push('ac-3');
76-
hasAudio = true;
79+
if (tsParser.getAudioData().length) {
80+
codecs.push('ac-3');
81+
hasAudio = true;
82+
}
7783
break;
7884
case 'ec3':
79-
codecs.push('ec-3');
80-
hasAudio = true;
85+
if (tsParser.getAudioData().length) {
86+
codecs.push('ec-3');
87+
hasAudio = true;
88+
}
8189
break;
8290
case 'opus':
83-
codecs.push('opus');
84-
hasAudio = true;
91+
if (tsParser.getAudioData().length) {
92+
codecs.push('opus');
93+
hasAudio = true;
94+
}
8595
break;
8696
}
8797
}

0 commit comments

Comments
 (0)