summaryrefslogtreecommitdiffstats
path: root/dom/media
diff options
context:
space:
mode:
Diffstat (limited to 'dom/media')
-rw-r--r--dom/media/platforms/agnostic/AOMDecoder.cpp13
-rw-r--r--dom/media/platforms/agnostic/AOMDecoder.h3
-rw-r--r--dom/media/webm/WebMDecoder.cpp8
3 files changed, 24 insertions, 0 deletions
diff --git a/dom/media/platforms/agnostic/AOMDecoder.cpp b/dom/media/platforms/agnostic/AOMDecoder.cpp
index 3ab5004e3..d1b45cf7f 100644
--- a/dom/media/platforms/agnostic/AOMDecoder.cpp
+++ b/dom/media/platforms/agnostic/AOMDecoder.cpp
@@ -212,6 +212,19 @@ AOMDecoder::IsAV1(const nsACString& aMimeType)
/* static */
bool
+AOMDecoder::IsSupportedCodec(const nsAString& aCodecType)
+{
+ // While AV1 is under development, we describe support
+ // for a specific aom commit hash so sites can check
+ // compatibility.
+ auto version = NS_ConvertASCIItoUTF16("av1.experimental.");
+ version.AppendLiteral("4d668d7feb1f8abd809d1bca0418570a7f142a36");
+ return aCodecType.EqualsLiteral("av1") ||
+ aCodecType.Equals(version);
+}
+
+/* static */
+bool
AOMDecoder::IsKeyframe(Span<const uint8_t> aBuffer) {
aom_codec_stream_info_t info;
PodZero(&info);
diff --git a/dom/media/platforms/agnostic/AOMDecoder.h b/dom/media/platforms/agnostic/AOMDecoder.h
index ec6b1f95a..1e2b76c2c 100644
--- a/dom/media/platforms/agnostic/AOMDecoder.h
+++ b/dom/media/platforms/agnostic/AOMDecoder.h
@@ -34,6 +34,9 @@ public:
// by our demuxers to identify AV1 streams.
static bool IsAV1(const nsACString& aMimeType);
+ // Return true if aCodecType is a supported codec description.
+ static bool IsSupportedCodec(const nsAString& aCodecType);
+
// Return true if a sample is a keyframe.
static bool IsKeyframe(Span<const uint8_t> aBuffer);
diff --git a/dom/media/webm/WebMDecoder.cpp b/dom/media/webm/WebMDecoder.cpp
index b41de6d40..d721a8ccc 100644
--- a/dom/media/webm/WebMDecoder.cpp
+++ b/dom/media/webm/WebMDecoder.cpp
@@ -5,6 +5,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Preferences.h"
+#ifdef MOZ_AV1
+#include "AOMDecoder.h"
+#endif
#include "MediaDecoderStateMachine.h"
#include "WebMDemuxer.h"
#include "WebMDecoder.h"
@@ -65,6 +68,11 @@ WebMDecoder::CanHandleMediaType(const nsACString& aMIMETypeExcludingCodecs,
continue;
}
+#ifdef MOZ_AV1
+ if (isVideo && AOMDecoder::IsSupportedCodec(codec)) {
+ continue;
+ }
+#endif
// Some unsupported codec.
return false;
}