Skip to content

Commit

Permalink
fix(DASH): Fix bad error on DASH DAI (#6047)
Browse files Browse the repository at this point in the history
Fixes #6010
  • Loading branch information
avelad authored Jan 9, 2024
1 parent b463e39 commit a371f43
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion lib/util/periods.js
Original file line number Diff line number Diff line change
Expand Up @@ -790,11 +790,34 @@ shaka.util.PeriodCombiner = class {
for (const codec of match.codecs.split(',')) {
codecs.add(codec);
}
outputStream.codecs = Array.from(codecs).join(',');
const PeriodCombiner = shaka.util.PeriodCombiner;
outputStream.codecs = PeriodCombiner.filterDuplicateCodecs_(
Array.from(codecs)).join(',');
}
}
}

/**
* @param {!Array.<string>} codecs
* @return {!Array.<string>} codecs
* @private
*/
static filterDuplicateCodecs_(codecs) {
// Filter out duplicate codecs.
const seen = new Set();
const ret = [];
for (const codec of codecs) {
const shortCodec = shaka.util.MimeUtils.getCodecBase(codec);
if (!seen.has(shortCodec)) {
ret.push(codec);
seen.add(shortCodec);
} else {
shaka.log.debug('Ignoring duplicate codec');
}
}
return ret;
}

/**
* Clone a Stream to make an output Stream for combining others across
* periods.
Expand Down

0 comments on commit a371f43

Please sign in to comment.