Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ function ProtectionController(config) {

logger.debug('DRM: initData:', String.fromCharCode.apply(null, new Uint8Array(abInitData)));

const supportedKS = protectionKeyController.getSupportedKeySystems(abInitData, protDataSet, sessionType);
const supportedKS = protectionKeyController.getSupportedKeySystemsFromSegmentPssh(abInitData, protDataSet, sessionType);
if (supportedKS.length === 0) {
logger.debug('DRM: Received needkey event with initData, but we don\'t support any of the key systems!');
return;
Expand Down
13 changes: 5 additions & 8 deletions src/streaming/protection/controllers/ProtectionKeyController.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ function ProtectionKeyController() {

/**
* Returns key systems supported by this player for the given PSSH
* initializationData. Only key systems supported by this player
* that have protection data present will be returned. Key systems are returned in priority order
* initializationData. Key systems are returned in priority order
* (highest priority first)
*
* @param {ArrayBuffer} initData Concatenated PSSH data for all DRMs
Expand All @@ -251,21 +250,19 @@ function ProtectionKeyController() {
* @memberof module:ProtectionKeyController
* @instance
*/
function getSupportedKeySystems(initData, protDataSet, sessionType) {
function getSupportedKeySystemsFromSegmentPssh(initData, protDataSet, sessionType) {
let supportedKS = [];
let pssh = CommonEncryption.parsePSSHList(initData);
let ks, keySystemString, shouldNotFilterOutKeySystem;
let ks, keySystemString;

for (let ksIdx = 0; ksIdx < keySystems.length; ++ksIdx) {
ks = keySystems[ksIdx];
keySystemString = ks.systemString;

shouldNotFilterOutKeySystem = (protDataSet) ? keySystemString in protDataSet : true;

// Get protection data that applies for current key system
const protData = _getProtDataForKeySystem(keySystemString, protDataSet);

if (ks.uuid in pssh && shouldNotFilterOutKeySystem) {
if (ks.uuid in pssh) {
supportedKS.push({
ks: ks,
initData: pssh[ks.uuid],
Expand Down Expand Up @@ -384,7 +381,7 @@ function ProtectionKeyController() {
setKeySystems,
getKeySystemBySystemString,
getSupportedKeySystemsFromContentProtection,
getSupportedKeySystems,
getSupportedKeySystemsFromSegmentPssh,
getLicenseServerModelInstance,
processClearKeyLicenseRequest,
setConfig
Expand Down