Skip to content

Commit

Permalink
Account for lower case laUrl in MPDs (#4460)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsilhavy committed Apr 16, 2024
1 parent e28a604 commit 3138e16
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/dash/constants/DashConstants.js
Expand Up @@ -95,6 +95,7 @@ export default {
INITIALIZATION: 'Initialization',
INITIALIZATION_MINUS: 'initialization',
LA_URL: 'Laurl',
LA_URL_LOWER_CASE: 'laurl',
LABEL: 'Label',
LANG: 'lang',
LOCATION: 'Location',
Expand Down
3 changes: 2 additions & 1 deletion src/dash/vo/ContentProtection.js
Expand Up @@ -43,6 +43,7 @@ class ContentProtection extends DescriptorType {
this.refId = null;
this.robustness = null;
this.keyId = null;
this.cencDefaultKid = null;
this.pssh = null;
this.pro = null;
this.laUrl = null;
Expand All @@ -58,7 +59,7 @@ class ContentProtection extends DescriptorType {
this.cencDefaultKid = data.hasOwnProperty(DashConstants.CENC_DEFAULT_KID) ? data[DashConstants.CENC_DEFAULT_KID] : null;
this.pssh = data.hasOwnProperty(DashConstants.PSSH) ? data[DashConstants.PSSH] : null;
this.pro = data.hasOwnProperty(DashConstants.PRO) ? data[DashConstants.PRO] : null;
this.laUrl = data.hasOwnProperty(DashConstants.LA_URL) ? data[DashConstants.LA_URL] : null;
this.laUrl = data.hasOwnProperty(DashConstants.LA_URL) ? data[DashConstants.LA_URL] : data.hasOwnProperty(DashConstants.LA_URL_LOWER_CASE) ? data[DashConstants.LA_URL_LOWER_CASE] : null;
}
}

Expand Down
138 changes: 138 additions & 0 deletions test/unit/test/dash/dash.vo.ContentProtection.js
@@ -0,0 +1,138 @@
import {expect} from 'chai';
import ContentProtection from '../../../../src/dash/vo/ContentProtection.js';

describe('Content Protection', () => {

it('should be constructed with null values', () => {
const contentProtection = new ContentProtection();
expect(contentProtection).to.deep.equal({
schemeIdUri: null,
value: null,
id: null,
ref: null,
refId: null,
robustness: null,
keyId: null,
cencDefaultKid: null,
pssh: null,
pro: null,
laUrl: null,
});
});

it('should initialise with correct base values', () => {
const contentProtection = new ContentProtection();
contentProtection.init({
schemeIdUri: 'testScheme',
value: '1',
});
expect(contentProtection).to.deep.equal({
schemeIdUri: 'testScheme',
value: '1',
id: null,
ref: null,
refId: null,
robustness: null,
keyId: null,
cencDefaultKid: null,
pssh: null,
pro: null,
laUrl: null
});
});

it('should initialise with correct complete values', () => {
const contentProtection = new ContentProtection();
contentProtection.init({
schemeIdUri: 'testScheme',
value: '1',
ref: 'ref',
refId: 'refId',
robustness: 'robustness',
keyId: null,
'cenc:default_KID': 'keyId',
pssh: 'pssh',
pro: 'pro',
Laurl: 'laUrl'
});
expect(contentProtection).to.deep.equal({
schemeIdUri: 'testScheme',
value: '1',
id: null,
ref: 'ref',
refId: 'refId',
robustness: 'robustness',
keyId: null,
cencDefaultKid: 'keyId',
pssh: 'pssh',
pro: 'pro',
laUrl: 'laUrl'
});
});

it('should handle lowercase laurl', () => {
const contentProtection = new ContentProtection();
contentProtection.init({
schemeIdUri: 'testScheme',
value: '1',
ref: 'ref',
refId: 'refId',
robustness: 'robustness',
'cenc:default_KID': 'keyId',
pssh: 'pssh',
pro: 'pro',
laurl: 'laUrl'
});
expect(contentProtection).to.deep.equal({
schemeIdUri: 'testScheme',
value: '1',
id: null,
ref: 'ref',
refId: 'refId',
robustness: 'robustness',
keyId: null,
cencDefaultKid: 'keyId',
pssh: 'pssh',
pro: 'pro',
laUrl: 'laUrl'
});
});

it('merge attributes from reference', () => {
const contentProtection = new ContentProtection();
contentProtection.init({
schemeIdUri: 'testScheme',
ref: 'ref',
refId: 'refId',
pssh: 'pssh',
pro: 'pro',
laurl: 'laUrl'
});
contentProtection.mergeAttributesFromReference({
schemeIdUri: 'scheme-new',
value: 'value-new',
id: 'id-new',
robustness: 'robustness-new',
cencDefaultKid: 'keyId-new',
pssh: 'pssh-new',
pro: 'pro-new',
laUrl: 'laUrl-new',
ref: 'ref-new'
})
console.log(contentProtection)
expect(contentProtection).to.deep.equal({
schemeIdUri: 'testScheme',
value: 'value-new',
id: 'id-new',
robustness: 'robustness-new',
cencDefaultKid: 'keyId-new',
keyId: null,
pssh: 'pssh',
pro: 'pro',
laUrl: 'laUrl',
ref: 'ref',
refId: 'refId',
});
});

});

0 comments on commit 3138e16

Please sign in to comment.