Bug 1711912 - Set flag on clear key CDM if created using special protection query key system. r=alwu

This lets the clear key CDM behave differently if it's created with the
protection query key system. The different behaviour will be implemented in
following patches and gated behind the member set here.

Differential Revision: https://phabricator.services.mozilla.com/D122632
This commit is contained in:
Bryce Seager van Dyk 2021-08-19 17:14:08 +00:00
Родитель 83332521e5
Коммит b7fc1c78ef
3 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -25,6 +25,7 @@ class ClearKeyCDM : public cdm::ContentDecryptionModule_10 {
#ifdef ENABLE_WMF
RefPtr<VideoDecoder> 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

Просмотреть файл

@ -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;
}