Skip to content

Commit

Permalink
chore: Stop using "Object" in DV codecs mapping (#7946)
Browse files Browse the repository at this point in the history
Related to #1672
  • Loading branch information
tykus160 authored Jan 24, 2025
1 parent 97832b7 commit 16e6687
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/util/stream_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,15 +461,15 @@ shaka.util.StreamUtils = class {
* @param {!Array<!shaka.extern.Variant>} variants
*/
static overrideDolbyVisionCodecs(variants) {
/** @type {!Object<string, string>} */
const codecMap = {
'dvav': 'avc3',
'dva1': 'avc1',
'dvhe': 'hev1',
'dvh1': 'hvc1',
'dvc1': 'vvc1',
'dvi1': 'vvi1',
};
/** @type {!Map<string, string>} */
const codecMap = new Map()
.set('dvav', 'avc3')
.set('dva1', 'avc1')
.set('dvhe', 'hev1')
.set('dvh1', 'hvc1')
.set('dvc1', 'vvc1')
.set('dvi1', 'vvi1');

/** @type {!Set<!shaka.extern.Stream>} */
const streams = new Set();
for (const variant of variants) {
Expand All @@ -478,9 +478,9 @@ shaka.util.StreamUtils = class {
}
}
for (const video of streams) {
for (const dvCodec of Object.keys(codecMap)) {
for (const [dvCodec, replacement] of codecMap) {
if (video.codecs.includes(dvCodec)) {
video.codecs = video.codecs.replace(dvCodec, codecMap[dvCodec]);
video.codecs = video.codecs.replace(dvCodec, replacement);
break;
}
}
Expand Down

0 comments on commit 16e6687

Please sign in to comment.