summaryrefslogtreecommitdiffstats
path: root/dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.cpp')
-rw-r--r--dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.cpp39
1 files changed, 37 insertions, 2 deletions
diff --git a/dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.cpp b/dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.cpp
index e71632e6d3..4c74fa8723 100644
--- a/dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.cpp
+++ b/dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.cpp
@@ -11,6 +11,9 @@
#include "GMPVideoDecoder.h"
#include "MP4Decoder.h"
#include "VPXDecoder.h"
+#ifdef MOZ_AV1
+# include "AOMDecoder.h"
+#endif
namespace mozilla {
@@ -45,6 +48,21 @@ static uint32_t ToCDMH264Profile(uint8_t aProfile) {
return cdm::VideoCodecProfile::kUnknownVideoCodecProfile;
}
+#ifdef MOZ_AV1
+static uint32_t ToCDMAV1Profile(uint8_t aProfile) {
+ switch (aProfile) {
+ case 0:
+ return cdm::VideoCodecProfile::kAv1ProfileMain;
+ case 1:
+ return cdm::VideoCodecProfile::kAv1ProfileHigh;
+ case 2:
+ return cdm::VideoCodecProfile::kAv1ProfilePro;
+ default:
+ return cdm::VideoCodecProfile::kUnknownVideoCodecProfile;
+ }
+}
+#endif
+
RefPtr<MediaDataDecoder::InitPromise> ChromiumCDMVideoDecoder::Init() {
if (!mCDMParent) {
// Must have failed to get the CDMParent from the ChromiumCDMProxy
@@ -60,6 +78,16 @@ RefPtr<MediaDataDecoder::InitPromise> ChromiumCDMVideoDecoder::Init() {
ToCDMH264Profile(mConfig.mExtraData->SafeElementAt(1, 0));
config.mExtraData() = mConfig.mExtraData->Clone();
mConvertToAnnexB = true;
+#ifdef MOZ_AV1
+ } else if (AOMDecoder::IsAV1(mConfig.mMimeType)) {
+ AOMDecoder::AV1SequenceInfo seqInfo;
+ MediaResult seqHdrResult;
+ AOMDecoder::TryReadAV1CBox(mConfig.mExtraData, seqInfo, seqHdrResult);
+ config.mCodec() = cdm::VideoCodec::kCodecAv1;
+ config.mProfile() = NS_SUCCEEDED(seqHdrResult.Code())
+ ? ToCDMAV1Profile(seqInfo.mProfile)
+ : cdm::VideoCodecProfile::kUnknownVideoCodecProfile;
+#endif
} else if (VPXDecoder::IsVP8(mConfig.mMimeType)) {
config.mCodec() = cdm::VideoCodec::kCodecVp8;
config.mProfile() = cdm::VideoCodecProfile::kProfileNotNeeded;
@@ -105,9 +133,16 @@ nsCString ChromiumCDMVideoDecoder::GetDescriptionName() const {
nsCString ChromiumCDMVideoDecoder::GetCodecName() const {
if (MP4Decoder::IsH264(mConfig.mMimeType)) {
return "h264"_ns;
- } else if (VPXDecoder::IsVP8(mConfig.mMimeType)) {
+ }
+#ifdef MOZ_AV1
+ if (AOMDecoder::IsAV1(mConfig.mMimeType)) {
+ return "av1"_ns;
+ }
+#endif
+ if (VPXDecoder::IsVP8(mConfig.mMimeType)) {
return "vp8"_ns;
- } else if (VPXDecoder::IsVP9(mConfig.mMimeType)) {
+ }
+ if (VPXDecoder::IsVP9(mConfig.mMimeType)) {
return "vp9"_ns;
}
return "unknown"_ns;