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

feat: Check encryptionScheme against MCap #6484

Merged
merged 5 commits into from May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
58 changes: 32 additions & 26 deletions lib/util/stream_utils.js
Expand Up @@ -927,38 +927,44 @@ shaka.util.StreamUtils = class {
}

if (audio) {
// See: https://github.com/shaka-project/shaka-player/issues/4659
if (info.audioRobustness != '') {
if (!keySystemConfig.audio) {
// KeySystemTrackConfiguration
keySystemConfig.audio = {
robustness: info.audioRobustness,
};
} else {
keySystemConfig.audio.robustness =
keySystemConfig.audio.robustness || info.audioRobustness;
}
} else if (!keySystemConfig.audio) {
if (!keySystemConfig.audio) {
// KeySystemTrackConfiguration
keySystemConfig.audio = {};
keySystemConfig.audio = {
encryptionScheme: info.encryptionScheme,
robustness: info.audioRobustness,
};
} else {
keySystemConfig.audio.encryptionScheme =
keySystemConfig.audio.encryptionScheme ||
info.encryptionScheme;
keySystemConfig.audio.robustness =
keySystemConfig.audio.robustness ||
info.audioRobustness;
}
// See: https://github.com/shaka-project/shaka-player/issues/4659
if (keySystemConfig.audio.robustness == '') {
delete keySystemConfig.audio.robustness;
}
}

if (video) {
// See: https://github.com/shaka-project/shaka-player/issues/4659
if (info.videoRobustness != '') {
if (!keySystemConfig.video) {
// KeySystemTrackConfiguration
keySystemConfig.video = {
robustness: info.videoRobustness,
};
} else {
keySystemConfig.video.robustness =
keySystemConfig.video.robustness || info.videoRobustness;
}
} else if (!keySystemConfig.video) {
if (!keySystemConfig.video) {
// KeySystemTrackConfiguration
keySystemConfig.video = {};
keySystemConfig.video = {
encryptionScheme: info.encryptionScheme,
robustness: info.videoRobustness,
};
} else {
keySystemConfig.video.encryptionScheme =
keySystemConfig.video.encryptionScheme ||
info.encryptionScheme;
keySystemConfig.video.robustness =
keySystemConfig.video.robustness ||
info.videoRobustness;
}
// See: https://github.com/shaka-project/shaka-player/issues/4659
if (keySystemConfig.video.robustness == '') {
delete keySystemConfig.video.robustness;
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -100,7 +100,7 @@
"prepublishOnly": "python build/checkversion.py && python build/all.py --force"
},
"dependencies": {
"eme-encryption-scheme-polyfill": "^2.1.1"
"eme-encryption-scheme-polyfill": "^2.1.2"
},
"engines": {
"node": ">=14"
Expand Down
5 changes: 5 additions & 0 deletions test/media/drm_engine_unit.js
Expand Up @@ -589,9 +589,11 @@ describe('DrmEngine', () => {
sessionTypes: ['persistent-license'],
initDataType: 'cenc',
audio: containing({
encryptionScheme: '',
robustness: 'good',
}),
video: containing({
encryptionScheme: '',
robustness: 'really_really_ridiculously_good',
}),
}),
Expand Down Expand Up @@ -621,6 +623,7 @@ describe('DrmEngine', () => {
drmInfos[0].persistentStateRequired = true;
drmInfos[0].audioRobustness = 'good';
drmInfos[0].videoRobustness = 'really_really_ridiculously_good';
drmInfos[0].encryptionScheme = 'bad';
});

config.advanced['drm.abc'] = {
Expand All @@ -647,9 +650,11 @@ describe('DrmEngine', () => {
keySystemConfiguration: containing({
keySystem: 'drm.abc',
audio: containing({
encryptionScheme: 'bad',
robustness: 'good',
}),
video: containing({
encryptionScheme: 'bad',
robustness: 'really_really_ridiculously_good',
}),
distinctiveIdentifier: 'required',
Expand Down