summaryrefslogtreecommitdiffstats
path: root/dom/media/eme/EMEUtils.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /dom/media/eme/EMEUtils.cpp
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-upstream/125.0.1.tar.xz
firefox-upstream/125.0.1.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/eme/EMEUtils.cpp')
-rw-r--r--dom/media/eme/EMEUtils.cpp39
1 files changed, 32 insertions, 7 deletions
diff --git a/dom/media/eme/EMEUtils.cpp b/dom/media/eme/EMEUtils.cpp
index 294951e7e6..5a6b645df2 100644
--- a/dom/media/eme/EMEUtils.cpp
+++ b/dom/media/eme/EMEUtils.cpp
@@ -8,13 +8,13 @@
#include "jsfriendapi.h"
#include "MediaData.h"
+#include "KeySystemConfig.h"
#include "mozilla/StaticPrefs_media.h"
#include "mozilla/dom/KeySystemNames.h"
#include "mozilla/dom/UnionTypes.h"
#ifdef MOZ_WMF_CDM
# include "mozilla/PMFCDM.h"
-# include "KeySystemConfig.h"
#endif
namespace mozilla {
@@ -143,22 +143,35 @@ const char* ToMediaKeyStatusStr(dom::MediaKeyStatus aStatus) {
bool IsHardwareDecryptionSupported(
const dom::MediaKeySystemConfiguration& aConfig) {
- bool supportHardwareDecryption = false;
for (const auto& capabilities : aConfig.mAudioCapabilities) {
if (capabilities.mRobustness.EqualsLiteral("HW_SECURE_ALL")) {
- supportHardwareDecryption = true;
- break;
+ return true;
}
}
for (const auto& capabilities : aConfig.mVideoCapabilities) {
if (capabilities.mRobustness.EqualsLiteral("3000") ||
capabilities.mRobustness.EqualsLiteral("HW_SECURE_ALL") ||
capabilities.mRobustness.EqualsLiteral("HW_SECURE_DECODE")) {
- supportHardwareDecryption = true;
- break;
+ return true;
+ }
+ }
+ return false;
+}
+
+bool IsHardwareDecryptionSupported(const KeySystemConfig& aConfig) {
+ for (const auto& robustness : aConfig.mAudioRobustness) {
+ if (robustness.EqualsLiteral("HW_SECURE_ALL")) {
+ return true;
+ }
+ }
+ for (const auto& robustness : aConfig.mVideoRobustness) {
+ if (robustness.EqualsLiteral("3000") ||
+ robustness.EqualsLiteral("HW_SECURE_ALL") ||
+ robustness.EqualsLiteral("HW_SECURE_DECODE")) {
+ return true;
}
}
- return supportHardwareDecryption;
+ return false;
}
const char* EncryptionSchemeStr(const CryptoScheme& aScheme) {
@@ -245,4 +258,16 @@ bool CheckIfHarewareDRMConfigExists(
return foundHWDRMconfig;
}
+bool DoesKeySystemSupportHardwareDecryption(const nsAString& aKeySystem) {
+#ifdef MOZ_WMF_CDM
+ if (aKeySystem.EqualsLiteral(kPlayReadyKeySystemHardware) ||
+ aKeySystem.EqualsLiteral(kPlayReadyHardwareClearLeadKeySystemName) ||
+ aKeySystem.EqualsLiteral(kWidevineExperimentKeySystemName) ||
+ aKeySystem.EqualsLiteral(kWidevineExperiment2KeySystemName)) {
+ return true;
+ }
+#endif
+ return false;
+}
+
} // namespace mozilla