Skip to content

Commit 933a4f2

Browse files
srikieonlineSrikanth Peddibhotla
andauthored
fix: Support more Dolby codec notations (#8387)
Player errors out for Dolby contents in adaptive streaming because correct mimetype is not identified. This change adds ac3, ac-3, eac3, ec-3, and ac-4 mimetype support. --------- Co-authored-by: Srikanth Peddibhotla <[email protected]>
1 parent 7e827ac commit 933a4f2

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

lib/util/manifest_parser_utils.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ shaka.util.ManifestParserUtils.AUDIO_CODEC_REGEXPS_ = [
315315
/^dts[cex]$/, // DTS Digital Surround (dtsc), DTS Express (dtse), DTS:X (dtsx)
316316
/^iamf/,
317317
/^mhm[12]/, // MPEG-H Audio LC
318+
/^ac3$/, // sometimes ac3 is used instead of ac-3
319+
/^eac3$/, // sometimes "eac3" is used instead of "ec-3"
318320
];
319321

320322

lib/util/mime_utils.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,15 @@ shaka.util.MimeUtils = class {
159159
case base === 'mp4a' && profile === '40.42': // Extended HE-AAC
160160
return 'aac';
161161
case base === 'mp4a' && profile === 'a5':
162+
case base === 'ac3':
163+
case base === 'ac-3':
162164
return 'ac-3'; // Dolby Digital
163165
case base === 'mp4a' && profile === 'a6':
166+
case base === 'eac3':
167+
case base === 'ec-3':
164168
return 'ec-3'; // Dolby Digital Plus
169+
case base === 'ac-4':
170+
return 'ac-4'; // Dolby AC-4
165171
case base === 'mp4a' && profile === 'b2':
166172
return 'dtsx'; // DTS:X
167173
case base === 'mp4a' && profile === 'a9':

test/util/mime_utils_unit.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@ describe('MimeUtils', () => {
2626
expect(getNormalizedCodec('mp4a.40.42')).toBe('aac');
2727

2828
expect(getNormalizedCodec('ac-3')).toBe('ac-3');
29+
expect(getNormalizedCodec('ac3')).toBe('ac-3');
2930
expect(getNormalizedCodec('mp4a.a5')).toBe('ac-3');
3031
expect(getNormalizedCodec('mp4a.A5')).toBe('ac-3');
3132

3233
expect(getNormalizedCodec('ec-3')).toBe('ec-3');
34+
expect(getNormalizedCodec('eac3')).toBe('ec-3');
35+
expect(getNormalizedCodec('ac-4')).toBe('ac-4');
36+
3337
expect(getNormalizedCodec('mp4a.a6')).toBe('ec-3');
3438
expect(getNormalizedCodec('mp4a.A6')).toBe('ec-3');
3539

0 commit comments

Comments
 (0)