Skip to content

Commit

Permalink
fix: Allow by default variants without pssh in the manifest (#6144)
Browse files Browse the repository at this point in the history
Fixes #5176
  • Loading branch information
avelad committed Jan 23, 2024
1 parent ee600c4 commit e1cd031
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
9 changes: 9 additions & 0 deletions lib/media/drm_engine.js
Expand Up @@ -542,6 +542,15 @@ shaka.media.DrmEngine = class {
}
}

/**
* Returns true if the manifest has init data.
*
* @return {boolean}
*/
hasManifestInitData() {
return !!this.manifestInitData_;
}

/**
* Sets the server certificate based on the current DrmInfo.
*
Expand Down
8 changes: 6 additions & 2 deletions lib/player.js
Expand Up @@ -6523,6 +6523,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
const restrictedStatuses = shaka.Player.restrictedStatuses_;
let tracksChanged = false;

goog.asserts.assert(this.drmEngine_, 'drmEngine should be non-null here.');

// Only filter tracks for keys if we have some key statuses to look at.
if (keyIds.length) {
for (const variant of this.manifest_.variants) {
Expand All @@ -6538,8 +6540,10 @@ shaka.Player = class extends shaka.util.FakeEventTarget {

for (const keyId of stream.keyIds) {
const keyStatus = keyStatusMap[isGlobalStatus ? '00' : keyId];
variant.allowedByKeySystem = variant.allowedByKeySystem &&
!!keyStatus && !restrictedStatuses.includes(keyStatus);
if (keyStatus || this.drmEngine_.hasManifestInitData()) {
variant.allowedByKeySystem = variant.allowedByKeySystem &&
!!keyStatus && !restrictedStatuses.includes(keyStatus);
}
}
}

Expand Down
7 changes: 7 additions & 0 deletions test/test/util/fake_drm_engine.js
Expand Up @@ -100,4 +100,11 @@ shaka.test.FakeDrmEngine = class {
// Copy the values to break the reference to the input value.
this.offlineSessions_ = sessions.map((s) => s);
}

/**
* @override
*/
hasManifestInitData() {
return true;
}
};

0 comments on commit e1cd031

Please sign in to comment.