Skip to content

Commit

Permalink
fix(DASH): Fix DASH_DUPLICATE_REPRESENTATION_ID error when using supp…
Browse files Browse the repository at this point in the history
…lemental codec (#7961)

Fixes #7948
  • Loading branch information
avelad committed Jan 29, 2025
1 parent 3f1fdbe commit b183197
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
16 changes: 13 additions & 3 deletions lib/dash/dash_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1983,6 +1983,10 @@ shaka.dash.DashParser = class {
// Duplicate representations with their supplementalCodecs
const obj = shaka.util.ObjectUtils.cloneObject(rep);
obj.attributes['codecs'] = supplementalCodecs.split(' ').join(',');
if (obj.attributes['id']) {
obj.attributes['supplementalId'] =
obj.attributes['id'] + '_supplementalCodecs';
}
supplementalRepresentations.push(obj);
}
}
Expand Down Expand Up @@ -2048,8 +2052,9 @@ shaka.dash.DashParser = class {
}

const repIds = representations
.map((node) => { return node.attributes['id']; })
.filter(shaka.util.Functional.isNotNull);
.map((node) => {
return node.attributes['supplementalId'] || node.attributes['id'];
}).filter(shaka.util.Functional.isNotNull);

return {
id: adaptationId,
Expand Down Expand Up @@ -2580,6 +2585,7 @@ shaka.dash.DashParser = class {
const evalDivision = TXml.evalDivision;

const id = elem.attributes['id'];
const supplementalId = elem.attributes['supplementalId'];
const uriObjs = TXml.findChildren(elem, 'BaseURL');
let calculatedBaseUris;
let someLocationValid = false;
Expand Down Expand Up @@ -2694,7 +2700,8 @@ shaka.dash.DashParser = class {
frameRate: frameRate,
pixelAspectRatio: pixelAspectRatio,
emsgSchemeIdUris: emsgSchemeIdUris,
id: id,
id: supplementalId || id,
originalId: id,
language: elem.attributes['lang'],
numChannels: numChannels,
audioSamplingRate: audioSamplingRate,
Expand Down Expand Up @@ -3243,6 +3250,7 @@ shaka.dash.DashParser.RequestSegmentCallback;
* pixelAspectRatio: (string|undefined),
* emsgSchemeIdUris: !Array<string>,
* id: ?string,
* originalId: ?string,
* position: (number|undefined),
* language: ?string,
* numChannels: ?number,
Expand Down Expand Up @@ -3284,6 +3292,8 @@ shaka.dash.DashParser.RequestSegmentCallback;
* emsg registered schemeIdUris.
* @property {?string} id
* The ID of the element.
* @property {?string} originalId
* The original ID of the element.
* @property {number|undefined} position
* Position of the element used for indexing in case of no id
* @property {?string} language
Expand Down
6 changes: 3 additions & 3 deletions lib/dash/segment_template.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ shaka.dash.SegmentTemplate = class {
shaka.log.debug(`Creating TSI with end ${periodEnd}`);
segmentIndex = new TimelineSegmentIndex(
info,
context.representation.id,
context.representation.originalId,
context.bandwidth,
context.representation.getBaseUris,
context.urlParams,
Expand Down Expand Up @@ -348,7 +348,7 @@ shaka.dash.SegmentTemplate = class {

goog.asserts.assert(info.indexTemplate, 'must be using index template');
const filledTemplate = MpdUtils.fillUriTemplate(
info.indexTemplate, context.representation.id,
info.indexTemplate, context.representation.originalId,
null, null, context.bandwidth || null, null);

const resolvedUris = ManifestParserUtils.resolveUris(
Expand Down Expand Up @@ -677,7 +677,7 @@ shaka.dash.SegmentTemplate = class {
}
initialization = shaka.util.StringUtils.htmlUnescape(initialization);

const repId = context.representation.id;
const repId = context.representation.originalId;
const bandwidth = context.bandwidth || null;
const getBaseUris = context.representation.getBaseUris;
const urlParams = context.urlParams;
Expand Down

0 comments on commit b183197

Please sign in to comment.