Skip to content

Commit

Permalink
Fix a bug when iterating over key Ids. Assume that only one of the ke…
Browse files Browse the repository at this point in the history
…yIds need to be usable. (#4626)
  • Loading branch information
dsilhavy authored Nov 11, 2024
1 parent a38ea0b commit 8f9a7f3
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/streaming/protection/controllers/ProtectionController.js
Original file line number Diff line number Diff line change
Expand Up @@ -1163,14 +1163,10 @@ function ProtectionController(config) {
return true;
}

let usable = true

normalizedKeyIds.forEach((normalizedKeyId) => {
const keyStatus = keyStatusMap.get(normalizedKeyId)
usable = keyStatus && keyStatus !== ProtectionConstants.MEDIA_KEY_STATUSES.INTERNAL_ERROR && keyStatus !== ProtectionConstants.MEDIA_KEY_STATUSES.OUTPUT_RESTRICTED;
})

return usable
return [...normalizedKeyIds].some((normalizedKeyId) => {
const keyStatus = keyStatusMap.get(normalizedKeyId);
return keyStatus && keyStatus !== ProtectionConstants.MEDIA_KEY_STATUSES.INTERNAL_ERROR && keyStatus !== ProtectionConstants.MEDIA_KEY_STATUSES.OUTPUT_RESTRICTED;
});
} catch (error) {
logger.error(error);
return true
Expand Down

0 comments on commit 8f9a7f3

Please sign in to comment.