Skip to content

Commit

Permalink
Merge pull request #1611 from canalplus/fix/same-key-system-type-cache
Browse files Browse the repository at this point in the history
Reuse cache even if key system type given in API is not the same
  • Loading branch information
peaBerberian authored Jan 7, 2025
2 parents 24b5958 + 8aec1c3 commit a117437
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/main_thread/decrypt/__tests__/find_key_system.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ describe("find_key_systems - ", () => {
it("should create a media key the first time and then reuse the previous one if it's the same configuration", async () => {
requestMediaKeySystemAccessMock.mockImplementation(() => {
return {
keySystem: "com.widevine.alpha",
createMediaKeys: () => ({
createSession: () => ({
// eslint-disable-next-line @typescript-eslint/no-empty-function
Expand Down Expand Up @@ -200,6 +201,7 @@ describe("find_key_systems - ", () => {
it("should create a media key the first time and then create another one if the previous is not compatible.", async () => {
requestMediaKeySystemAccessMock.mockImplementation(() => {
return {
keySystem: "com.widevine.alpha",
createMediaKeys: () => ({
createSession: () => ({
// eslint-disable-next-line @typescript-eslint/no-empty-function
Expand Down Expand Up @@ -258,6 +260,7 @@ describe("find_key_systems - ", () => {
it("should create a media key the first time and then reuse the previous one if it's a different configuration but it's a compatible configuration.", async () => {
requestMediaKeySystemAccessMock.mockImplementation(() => {
return {
keySystem: "com.widevine.alpha",
createMediaKeys: () => ({
createSession: () => ({
// eslint-disable-next-line @typescript-eslint/no-empty-function
Expand Down
2 changes: 1 addition & 1 deletion src/main_thread/decrypt/find_key_system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ export default function getMediaKeySystemAccess(
currentState !== null &&
!shouldRenewMediaKeySystemAccess() &&
// TODO: Do it with MediaKeySystemAccess.prototype.keySystem instead?
keyType === currentState.keySystemOptions.type &&
keyType === currentState.mediaKeySystemAccess.keySystem &&
eme.implementation === currentState.emeImplementation.implementation &&
isNewMediaKeySystemConfigurationCompatibleWithPreviousOne(
keySystemConfiguration,
Expand Down

0 comments on commit a117437

Please sign in to comment.