Skip to content

Commit c7bfd90

Browse files
authored
bugfix + hardend unit test (#4687)
1 parent 9cddbe5 commit c7bfd90

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

src/dash/models/DashManifestModel.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ function DashManifestModel() {
610610
// repr.legth is always >= 2
611611
return propertiesOfFirstRepresentation.filter( prop => {
612612
return repr.slice(1).every( currRep => {
613-
return currRep[propertyType].some( e => {
613+
return currRep.hasOwnProperty(propertyType) && currRep[propertyType].some( e => {
614614
return e.schemeIdUri === prop.schemeIdUri && e.value === prop.value;
615615
});
616616
});

test/unit/test/dash/dash.DashAdapter.js

+38
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,28 @@ const manifest_with_supplemental_properties_on_repr = {
152152
}]
153153
}]
154154
};
155+
const manifest_with_supplemental_properties_on_not_all_repr = {
156+
loadedTime: new Date(),
157+
mediaPresentationDuration: 10,
158+
Period: [{
159+
AdaptationSet: [{
160+
id: 0, mimeType: Constants.VIDEO,
161+
[DashConstants.REPRESENTATION]: [
162+
{
163+
id: 10, bandwidth: 128000,
164+
[DashConstants.SUPPLEMENTAL_PROPERTY]: [
165+
{ schemeIdUri: 'test:scheme', value: 'value1' },
166+
{ schemeIdUri: 'test:scheme', value: 'value2' },
167+
{ schemeIdUri: 'test:scheme', value: 'value3' }
168+
]
169+
},
170+
{
171+
id: 11, bandwidth: 160000
172+
}
173+
]
174+
}]
175+
}]
176+
};
155177
const manifest_with_essential_properties_on_only_one_repr = {
156178
loadedTime: new Date(),
157179
mediaPresentationDuration: 10,
@@ -740,6 +762,22 @@ describe('DashAdapter', function () {
740762
expect(mediaInfoArray[0].supplementalProperties[1].value).equals('value2');
741763
});
742764

765+
it('supplemental properties should be filled if set on all representations', function () {
766+
const mediaInfoArray = dashAdapter.getAllMediaInfoForType({
767+
id: 'defaultId_0',
768+
index: 0
769+
}, Constants.VIDEO, manifest_with_supplemental_properties_on_not_all_repr);
770+
771+
expect(mediaInfoArray).to.be.instanceOf(Array);
772+
expect(mediaInfoArray.length).equals(1);
773+
774+
expect(mediaInfoArray[0].representationCount).equals(2);
775+
expect(mediaInfoArray[0].codec).not.to.be.null;
776+
777+
expect(mediaInfoArray[0].supplementalProperties).to.be.instanceOf(Array);
778+
expect(mediaInfoArray[0].supplementalProperties.length).equals(0);
779+
});
780+
743781
it('supplemental properties should not be filled if not set on all representations', function () {
744782
const mediaInfoArray = dashAdapter.getAllMediaInfoForType({
745783
id: 'defaultId_0',

0 commit comments

Comments
 (0)