Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#156] fix: DASH content protection schemeIdUri as lowercase #157

Merged
merged 4 commits into from
Apr 4, 2022

Conversation

mhk-etn
Copy link
Contributor

@mhk-etn mhk-etn commented Mar 8, 2022

Original issue

DASH ContentProtection schemeIdUri attributes are converted to lowercase on input to avoid keySystems mismatch since UUIDs should be handled case-insensitively.

Copy link
Member

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

CHANGELOG.md Outdated
@@ -1,3 +1,10 @@
### TODO add version
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be reverted? The changelog is generated automatically from commits on release.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted

@@ -9,6 +9,7 @@ import { stringToMpdXml } from '../src/stringToMpdXml';
import errors from '../src/errors';
import QUnit from 'qunit';
import { toPlaylists } from '../src/toPlaylists';
import decodeB64ToUint8Array from '@videojs/vhs-utils/cjs/decode-b64-to-uint8-array';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in inheritAttributes, we import the es version, it would be better to stay consistent.

import decodeB64ToUint8Array from '@videojs/vhs-utils/es/decode-b64-to-uint8-array';

Suggested change
import decodeB64ToUint8Array from '@videojs/vhs-utils/cjs/decode-b64-to-uint8-array';
import decodeB64ToUint8Array from '@videojs/vhs-utils/es/decode-b64-to-uint8-array';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion applied

@@ -2065,3 +2066,175 @@ QUnit.test('Test to check use of either Segment Template or Segment List when bo
assert.equal(actual.length, 1);
assert.deepEqual(actual, expected);
});

QUnit.test('keySystem info for representation - lowercase UUIDs', function(assert) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for writing tests!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem. I was wondering how thorough I should have been (all available keySystems, empty ContentProtection xml segment etc,,,)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good enough.

@mhk-etn mhk-etn requested a review from gkatsev March 11, 2022 10:29
@@ -2065,3 +2066,175 @@ QUnit.test('Test to check use of either Segment Template or Segment List when bo
assert.equal(actual.length, 1);
assert.deepEqual(actual, expected);
});

QUnit.test('keySystem info for representation - lowercase UUIDs', function(assert) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good enough.

@mhk-etn
Copy link
Contributor Author

mhk-etn commented Apr 1, 2022

@gkatsev is there something left for me to do, or are we just waiting before someone else merges/builds it? Just to be sure, this is my 1st PR.

Copy link
Contributor

@brandonocasey brandonocasey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment, I think the code looks great and we can move ahead with or without it, but documenting reasoning could be helpful.

@@ -175,6 +175,11 @@ export const inheritBaseUrls =
const generateKeySystemInformation = (contentProtectionNodes) => {
return contentProtectionNodes.reduce((acc, node) => {
const attributes = parseAttributes(node);

// case-insensitive schemeIdUris
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to add reasoning why here. perhaps your original reasoning from the issue:

Although it could be argued that according to the UUID RFC spec the UUID string (a-f chars) should be generated as a lowercase string it also mentions it should be treated as case-insensitive on input. Since the key system UUIDs in the keySystemsMap are hardcoded as lowercase in the codebase there isn't any reason not to do .toLowerCase() on the input UUID string from the manifest (at least I could not think of one).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codecov
Copy link

codecov bot commented Apr 4, 2022

Codecov Report

Merging #157 (2d35fb4) into main (fb0d298) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #157   +/-   ##
=======================================
  Coverage   94.30%   94.30%           
=======================================
  Files          18       18           
  Lines         772      773    +1     
  Branches      240      241    +1     
=======================================
+ Hits          728      729    +1     
  Misses         44       44           
Impacted Files Coverage Δ
src/inheritAttributes.js 97.35% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fb0d298...2d35fb4. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants