diff --git a/lib/util/stream_utils.js b/lib/util/stream_utils.js index c67fb8b96b..2799c4f858 100644 --- a/lib/util/stream_utils.js +++ b/lib/util/stream_utils.js @@ -461,15 +461,15 @@ shaka.util.StreamUtils = class { * @param {!Array} variants */ static overrideDolbyVisionCodecs(variants) { - /** @type {!Object} */ - const codecMap = { - 'dvav': 'avc3', - 'dva1': 'avc1', - 'dvhe': 'hev1', - 'dvh1': 'hvc1', - 'dvc1': 'vvc1', - 'dvi1': 'vvi1', - }; + /** @type {!Map} */ + const codecMap = new Map() + .set('dvav', 'avc3') + .set('dva1', 'avc1') + .set('dvhe', 'hev1') + .set('dvh1', 'hvc1') + .set('dvc1', 'vvc1') + .set('dvi1', 'vvi1'); + /** @type {!Set} */ const streams = new Set(); for (const variant of variants) { @@ -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; } }