diff --git a/media/gmp-clearkey/0.1/ClearKeyCDM.cpp b/media/gmp-clearkey/0.1/ClearKeyCDM.cpp index 4a222e0d1848..e0b02fd6e4c3 100644 --- a/media/gmp-clearkey/0.1/ClearKeyCDM.cpp +++ b/media/gmp-clearkey/0.1/ClearKeyCDM.cpp @@ -160,3 +160,9 @@ void ClearKeyCDM::Destroy() { #endif delete this; } + +void ClearKeyCDM::EnableProtectionQuery() { + MOZ_ASSERT(!mIsProtectionQueryEnabled, + "Should not be called more than once per CDM"); + mIsProtectionQueryEnabled = true; +} diff --git a/media/gmp-clearkey/0.1/ClearKeyCDM.h b/media/gmp-clearkey/0.1/ClearKeyCDM.h index d3c8ba658a6b..dc73a87a7a98 100644 --- a/media/gmp-clearkey/0.1/ClearKeyCDM.h +++ b/media/gmp-clearkey/0.1/ClearKeyCDM.h @@ -25,6 +25,7 @@ class ClearKeyCDM : public cdm::ContentDecryptionModule_10 { #ifdef ENABLE_WMF RefPtr mVideoDecoder; #endif + bool mIsProtectionQueryEnabled = false; protected: cdm::Host_10* mHost; @@ -94,6 +95,8 @@ class ClearKeyCDM : public cdm::ContentDecryptionModule_10 { uint32_t aStorageIdSize) override; void Destroy() override; + + void EnableProtectionQuery(); }; #endif diff --git a/media/gmp-clearkey/0.1/gmp-clearkey.cpp b/media/gmp-clearkey/0.1/gmp-clearkey.cpp index df0df9740841..59fadfe9090e 100644 --- a/media/gmp-clearkey/0.1/gmp-clearkey.cpp +++ b/media/gmp-clearkey/0.1/gmp-clearkey.cpp @@ -22,6 +22,7 @@ #include "ClearKeyCDM.h" #include "ClearKeySessionManager.h" +#include "mozilla/dom/KeySystemNames.h" // This include is required in order for content_decryption_module to work // on Unix systems. #include "stddef.h" @@ -84,6 +85,12 @@ void* CreateCdmInstance(int cdm_interface_version, const char* key_system, CK_LOGE("Created ClearKeyCDM instance!"); + if (strncmp(key_system, mozilla::kClearKeyWithProtectionQueryKeySystemName, + key_system_size) == 0) { + CK_LOGE("Enabling protection query on ClearKeyCDM instance!"); + clearKey->EnableProtectionQuery(); + } + return clearKey; }