|
@@ -13,52 +13,50 @@ AOMDecoder shouldn't know anything about containers (e.g. mp4 or webm)
|
|
diff --git a/dom/media/VideoUtils.cpp b/dom/media/VideoUtils.cpp
|
|
diff --git a/dom/media/VideoUtils.cpp b/dom/media/VideoUtils.cpp
|
|
--- a/dom/media/VideoUtils.cpp
|
|
--- a/dom/media/VideoUtils.cpp
|
|
+++ b/dom/media/VideoUtils.cpp
|
|
+++ b/dom/media/VideoUtils.cpp
|
|
-@@ -710,16 +710,22 @@ IsVP9CodecString(const nsAString& aCodec
|
|
|
|
|
|
+@@ -634,16 +634,21 @@ bool IsVP9CodecString(const nsAString& a
|
|
|
|
+ uint8_t profile = 0;
|
|
uint8_t level = 0;
|
|
uint8_t level = 0;
|
|
uint8_t bitDepth = 0;
|
|
uint8_t bitDepth = 0;
|
|
- return aCodec.EqualsLiteral("vp9") ||
|
|
|
|
- aCodec.EqualsLiteral("vp9.0") ||
|
|
|
|
|
|
+ return aCodec.EqualsLiteral("vp9") || aCodec.EqualsLiteral("vp9.0") ||
|
|
(StartsWith(NS_ConvertUTF16toUTF8(aCodec), "vp09") &&
|
|
(StartsWith(NS_ConvertUTF16toUTF8(aCodec), "vp09") &&
|
|
ExtractVPXCodecDetails(aCodec, profile, level, bitDepth));
|
|
ExtractVPXCodecDetails(aCodec, profile, level, bitDepth));
|
|
}
|
|
}
|
|
|
|
|
|
-+bool
|
|
|
|
-+IsAV1CodecString(const nsAString& aCodec)
|
|
|
|
|
|
++bool IsAV1CodecString(const nsAString& aCodec)
|
|
+{
|
|
+{
|
|
+ return aCodec.EqualsLiteral("av1"); // AV1
|
|
+ return aCodec.EqualsLiteral("av1"); // AV1
|
|
+}
|
|
+}
|
|
+
|
|
+
|
|
- UniquePtr<TrackInfo>
|
|
|
|
- CreateTrackInfoWithMIMEType(const nsACString& aCodecMIMEType)
|
|
|
|
- {
|
|
|
|
|
|
+ UniquePtr<TrackInfo> CreateTrackInfoWithMIMEType(
|
|
|
|
+ const nsACString& aCodecMIMEType) {
|
|
UniquePtr<TrackInfo> trackInfo;
|
|
UniquePtr<TrackInfo> trackInfo;
|
|
if (StartsWith(aCodecMIMEType, "audio/")) {
|
|
if (StartsWith(aCodecMIMEType, "audio/")) {
|
|
trackInfo.reset(new AudioInfo());
|
|
trackInfo.reset(new AudioInfo());
|
|
trackInfo->mMimeType = aCodecMIMEType;
|
|
trackInfo->mMimeType = aCodecMIMEType;
|
|
} else if (StartsWith(aCodecMIMEType, "video/")) {
|
|
} else if (StartsWith(aCodecMIMEType, "video/")) {
|
|
|
|
+ trackInfo.reset(new VideoInfo());
|
|
diff --git a/dom/media/VideoUtils.h b/dom/media/VideoUtils.h
|
|
diff --git a/dom/media/VideoUtils.h b/dom/media/VideoUtils.h
|
|
--- a/dom/media/VideoUtils.h
|
|
--- a/dom/media/VideoUtils.h
|
|
+++ b/dom/media/VideoUtils.h
|
|
+++ b/dom/media/VideoUtils.h
|
|
-@@ -356,16 +356,19 @@ bool
|
|
|
|
- IsAACCodecString(const nsAString& aCodec);
|
|
|
|
|
|
+@@ -322,16 +322,18 @@ bool ParseCodecsString(const nsAString&
|
|
|
|
+ bool IsH264CodecString(const nsAString& aCodec);
|
|
|
|
|
|
- bool
|
|
|
|
- IsVP8CodecString(const nsAString& aCodec);
|
|
|
|
|
|
+ bool IsAACCodecString(const nsAString& aCodec);
|
|
|
|
|
|
- bool
|
|
|
|
- IsVP9CodecString(const nsAString& aCodec);
|
|
|
|
|
|
+ bool IsVP8CodecString(const nsAString& aCodec);
|
|
|
|
|
|
-+bool
|
|
|
|
-+IsAV1CodecString(const nsAString& aCodec);
|
|
|
|
|
|
+ bool IsVP9CodecString(const nsAString& aCodec);
|
|
|
|
+
|
|
|
|
++bool IsAV1CodecString(const nsAString& aCodec);
|
|
+
|
|
+
|
|
// Try and create a TrackInfo with a given codec MIME type.
|
|
// Try and create a TrackInfo with a given codec MIME type.
|
|
- UniquePtr<TrackInfo>
|
|
|
|
- CreateTrackInfoWithMIMEType(const nsACString& aCodecMIMEType);
|
|
|
|
|
|
+ UniquePtr<TrackInfo> CreateTrackInfoWithMIMEType(
|
|
|
|
+ const nsACString& aCodecMIMEType);
|
|
|
|
|
|
// Try and create a TrackInfo with a given codec MIME type, and optional extra
|
|
// Try and create a TrackInfo with a given codec MIME type, and optional extra
|
|
// parameters from a container type (its MIME type and codecs are ignored).
|
|
// parameters from a container type (its MIME type and codecs are ignored).
|
|
- UniquePtr<TrackInfo>
|
|
|
|
- CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
|
|
|
|
|
|
+ UniquePtr<TrackInfo> CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
|
|
|
|
+ const nsACString& aCodecMIMEType, const MediaContainerType& aContainerType);
|
|
diff --git a/dom/media/mediasource/MediaSource.cpp b/dom/media/mediasource/MediaSource.cpp
|
|
diff --git a/dom/media/mediasource/MediaSource.cpp b/dom/media/mediasource/MediaSource.cpp
|
|
--- a/dom/media/mediasource/MediaSource.cpp
|
|
--- a/dom/media/mediasource/MediaSource.cpp
|
|
+++ b/dom/media/mediasource/MediaSource.cpp
|
|
+++ b/dom/media/mediasource/MediaSource.cpp
|
|
@@ -82,21 +80,22 @@ diff --git a/dom/media/mediasource/MediaSource.cpp b/dom/media/mediasource/Media
|
|
#include "MediaResult.h"
|
|
#include "MediaResult.h"
|
|
#include "MediaSourceDemuxer.h"
|
|
#include "MediaSourceDemuxer.h"
|
|
#include "MediaSourceUtils.h"
|
|
#include "MediaSourceUtils.h"
|
|
-@@ -130,19 +127,19 @@ MediaSource::IsTypeSupported(const nsASt
|
|
|
|
|
|
+@@ -117,20 +114,19 @@ nsresult MediaSource::IsTypeSupported(co
|
|
|
|
+ }
|
|
return NS_OK;
|
|
return NS_OK;
|
|
}
|
|
}
|
|
if (mimeType == MEDIAMIMETYPE("video/webm")) {
|
|
if (mimeType == MEDIAMIMETYPE("video/webm")) {
|
|
if (!(Preferences::GetBool("media.mediasource.webm.enabled", false) ||
|
|
if (!(Preferences::GetBool("media.mediasource.webm.enabled", false) ||
|
|
- StaticPrefs::MediaCapabilitiesEnabled() ||
|
|
|
|
containerType->ExtendedType().Codecs().Contains(
|
|
containerType->ExtendedType().Codecs().Contains(
|
|
- NS_LITERAL_STRING("vp8")) ||
|
|
|
|
|
|
+ NS_LITERAL_STRING("vp8")) ||
|
|
#ifdef MOZ_AV1
|
|
#ifdef MOZ_AV1
|
|
- // FIXME: Temporary comparison with the full codecs attribute.
|
|
- // FIXME: Temporary comparison with the full codecs attribute.
|
|
- // See bug 1377015.
|
|
- // See bug 1377015.
|
|
-- AOMDecoder::IsSupportedCodec(containerType->ExtendedType().Codecs().AsString()) ||
|
|
|
|
-+ (StaticPrefs::MediaAv1Enabled() &&
|
|
|
|
-+ IsAV1CodecString(
|
|
|
|
-+ containerType->ExtendedType().Codecs().AsString())) ||
|
|
|
|
|
|
+- AOMDecoder::IsSupportedCodec(
|
|
|
|
+- containerType->ExtendedType().Codecs().AsString()) ||
|
|
|
|
+++ (StaticPrefs::MediaAv1Enabled() &&
|
|
|
|
+++ IsAV1CodecString(
|
|
|
|
+++ containerType->ExtendedType().Codecs().AsString())) ||
|
|
#endif
|
|
#endif
|
|
IsWebMForced(aDiagnostics))) {
|
|
IsWebMForced(aDiagnostics))) {
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
@@ -108,35 +107,38 @@ diff --git a/dom/media/mediasource/MediaSource.cpp b/dom/media/mediasource/Media
|
|
diff --git a/dom/media/platforms/agnostic/AOMDecoder.cpp b/dom/media/platforms/agnostic/AOMDecoder.cpp
|
|
diff --git a/dom/media/platforms/agnostic/AOMDecoder.cpp b/dom/media/platforms/agnostic/AOMDecoder.cpp
|
|
--- a/dom/media/platforms/agnostic/AOMDecoder.cpp
|
|
--- a/dom/media/platforms/agnostic/AOMDecoder.cpp
|
|
+++ b/dom/media/platforms/agnostic/AOMDecoder.cpp
|
|
+++ b/dom/media/platforms/agnostic/AOMDecoder.cpp
|
|
-@@ -337,23 +337,16 @@ AOMDecoder::Drain()
|
|
|
|
- bool
|
|
|
|
- AOMDecoder::IsAV1(const nsACString& aMimeType)
|
|
|
|
- {
|
|
|
|
|
|
+@@ -297,26 +297,16 @@ RefPtr<MediaDataDecoder::DecodePromise>
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* static */
|
|
|
|
+ bool AOMDecoder::IsAV1(const nsACString& aMimeType) {
|
|
return aMimeType.EqualsLiteral("video/av1");
|
|
return aMimeType.EqualsLiteral("video/av1");
|
|
}
|
|
}
|
|
|
|
|
|
/* static */
|
|
/* static */
|
|
- bool
|
|
|
|
--AOMDecoder::IsSupportedCodec(const nsAString& aCodecType)
|
|
|
|
--{
|
|
|
|
-- return aCodecType.EqualsLiteral("av1");
|
|
|
|
|
|
+-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("70bffc7d824b299cfdb16e3c96f277ab6475836f");
|
|
|
|
+- return aCodecType.EqualsLiteral("av1") || aCodecType.Equals(version);
|
|
-}
|
|
-}
|
|
-
|
|
-
|
|
-/* static */
|
|
-/* static */
|
|
--bool
|
|
|
|
- AOMDecoder::IsKeyframe(Span<const uint8_t> aBuffer) {
|
|
|
|
|
|
+ bool AOMDecoder::IsKeyframe(Span<const uint8_t> aBuffer) {
|
|
aom_codec_stream_info_t info;
|
|
aom_codec_stream_info_t info;
|
|
PodZero(&info);
|
|
PodZero(&info);
|
|
|
|
|
|
- auto res = aom_codec_peek_stream_info(aom_codec_av1_dx(),
|
|
|
|
- aBuffer.Elements(),
|
|
|
|
- aBuffer.Length(),
|
|
|
|
- &info);
|
|
|
|
|
|
+ auto res = aom_codec_peek_stream_info(aom_codec_av1_dx(), aBuffer.Elements(),
|
|
|
|
+ aBuffer.Length(), &info);
|
|
|
|
+ if (res != AOM_CODEC_OK) {
|
|
|
|
+ LOG_STATIC_RESULT(
|
|
diff --git a/dom/media/platforms/agnostic/AOMDecoder.h b/dom/media/platforms/agnostic/AOMDecoder.h
|
|
diff --git a/dom/media/platforms/agnostic/AOMDecoder.h b/dom/media/platforms/agnostic/AOMDecoder.h
|
|
--- a/dom/media/platforms/agnostic/AOMDecoder.h
|
|
--- a/dom/media/platforms/agnostic/AOMDecoder.h
|
|
+++ b/dom/media/platforms/agnostic/AOMDecoder.h
|
|
+++ b/dom/media/platforms/agnostic/AOMDecoder.h
|
|
-@@ -32,19 +32,16 @@ public:
|
|
|
|
- {
|
|
|
|
|
|
+@@ -29,19 +29,16 @@ class AOMDecoder : public MediaDataDecod
|
|
|
|
+ nsCString GetDescriptionName() const override {
|
|
return NS_LITERAL_CSTRING("av1 libaom video decoder");
|
|
return NS_LITERAL_CSTRING("av1 libaom video decoder");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -153,28 +155,5 @@ diff --git a/dom/media/platforms/agnostic/AOMDecoder.h b/dom/media/platforms/agn
|
|
// Return the frame dimensions for a sample.
|
|
// Return the frame dimensions for a sample.
|
|
static gfx::IntSize GetFrameSize(Span<const uint8_t> aBuffer);
|
|
static gfx::IntSize GetFrameSize(Span<const uint8_t> aBuffer);
|
|
|
|
|
|
- private:
|
|
|
|
|
|
+ private:
|
|
~AOMDecoder();
|
|
~AOMDecoder();
|
|
-diff --git a/dom/media/webm/WebMDecoder.cpp b/dom/media/webm/WebMDecoder.cpp
|
|
|
|
---- a/dom/media/webm/WebMDecoder.cpp
|
|
|
|
-+++ b/dom/media/webm/WebMDecoder.cpp
|
|
|
|
-@@ -60,17 +60,17 @@ WebMDecoder::GetTracksInfo(const MediaCo
|
|
|
|
- if (ExtractVPXCodecDetails(codec, profile, level, bitDepth)) {
|
|
|
|
- trackInfo->GetAsVideoInfo()->mBitDepth = bitDepth;
|
|
|
|
- }
|
|
|
|
- tracks.AppendElement(std::move(trackInfo));
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- #ifdef MOZ_AV1
|
|
|
|
-- if (AOMDecoder::IsSupportedCodec(codec)) {
|
|
|
|
-+ if (StaticPrefs::MediaAv1Enabled() && IsAV1CodecString(codec)) {
|
|
|
|
- tracks.AppendElement(
|
|
|
|
- CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
|
|
|
|
- NS_LITERAL_CSTRING("video/av1"), aType));
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- #endif
|
|
|
|
- // Unknown codec
|
|
|
|
- aError =
|
|
|
|
-
|
|
|