summaryrefslogtreecommitdiffstats
path: root/dom
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2018-10-20 14:49:17 -0500
committertrav90 <travawine@palemoon.org>2018-10-20 14:49:17 -0500
commite5b30fc95e191a50da4b8735aaf52baa8d384a0e (patch)
tree9331c72c00171437a79932f5765812fee29b35c9 /dom
parent6ddf66542bfbc90056ca86023da7bdefcec31aa8 (diff)
downloadUXP-e5b30fc95e191a50da4b8735aaf52baa8d384a0e.tar
UXP-e5b30fc95e191a50da4b8735aaf52baa8d384a0e.tar.gz
UXP-e5b30fc95e191a50da4b8735aaf52baa8d384a0e.tar.lz
UXP-e5b30fc95e191a50da4b8735aaf52baa8d384a0e.tar.xz
UXP-e5b30fc95e191a50da4b8735aaf52baa8d384a0e.zip
Fix canPlayType/isTypeSupported for AV1 content
Diffstat (limited to 'dom')
-rw-r--r--dom/media/VideoUtils.cpp8
-rw-r--r--dom/media/VideoUtils.h5
-rw-r--r--dom/media/platforms/agnostic/AOMDecoder.cpp41
-rw-r--r--dom/media/platforms/agnostic/AOMDecoder.h3
-rw-r--r--dom/media/platforms/agnostic/AgnosticDecoderModule.cpp8
-rw-r--r--dom/media/webm/WebMDecoder.cpp3
6 files changed, 35 insertions, 33 deletions
diff --git a/dom/media/VideoUtils.cpp b/dom/media/VideoUtils.cpp
index b1a202c03..2c8b67a9d 100644
--- a/dom/media/VideoUtils.cpp
+++ b/dom/media/VideoUtils.cpp
@@ -458,6 +458,14 @@ IsVP9CodecString(const nsAString& aCodec)
aCodec.EqualsLiteral("vp9.0");
}
+#ifdef MOZ_AV1
+bool
+IsAV1CodecString(const nsAString& aCodec)
+{
+ return aCodec.EqualsLiteral("av1");
+}
+#endif
+
template <int N>
static bool
StartsWith(const nsACString& string, const char (&prefix)[N])
diff --git a/dom/media/VideoUtils.h b/dom/media/VideoUtils.h
index 441b63792..aaf0e9903 100644
--- a/dom/media/VideoUtils.h
+++ b/dom/media/VideoUtils.h
@@ -345,6 +345,11 @@ IsVP8CodecString(const nsAString& aCodec);
bool
IsVP9CodecString(const nsAString& aCodec);
+#ifdef MOZ_AV1
+bool
+IsAV1CodecString(const nsAString& aCodec);
+#endif
+
// Try and create a TrackInfo with a given codec MIME type.
UniquePtr<TrackInfo>
CreateTrackInfoWithMIMEType(const nsACString& aCodecMIMEType);
diff --git a/dom/media/platforms/agnostic/AOMDecoder.cpp b/dom/media/platforms/agnostic/AOMDecoder.cpp
index d4ce299b4..7a5fba052 100644
--- a/dom/media/platforms/agnostic/AOMDecoder.cpp
+++ b/dom/media/platforms/agnostic/AOMDecoder.cpp
@@ -49,6 +49,7 @@ RefPtr<MediaDataDecoder::InitPromise>
AOMDecoder::Init()
{
int decode_threads = 2;
+
aom_codec_iface_t* dx = aom_codec_av1_dx();
if (mInfo.mDisplay.width >= 2048) {
decode_threads = 8;
@@ -231,23 +232,22 @@ AOMDecoder::DoDecode(MediaRawData* aSample)
RESULT_DETAIL("AOM Unknown image format"));
}
- RefPtr<VideoData> v;
- v = VideoData::CreateAndCopyData(mInfo,
- mImageContainer,
- aSample->mOffset,
- aSample->mTime,
- aSample->mDuration,
- b,
- aSample->mKeyframe,
- aSample->mTimecode,
- mInfo.ScaledImageRect(img->d_w,
- img->d_h));
+ RefPtr<VideoData> v =
+ VideoData::CreateAndCopyData(mInfo,
+ mImageContainer,
+ aSample->mOffset,
+ aSample->mTime,
+ aSample->mDuration,
+ b,
+ aSample->mKeyframe,
+ aSample->mTimecode,
+ mInfo.ScaledImageRect(img->d_w,
+ img->d_h));
if (!v) {
- LOG(
- "Image allocation error source %ux%u display %ux%u picture %ux%u",
- img->d_w, img->d_h, mInfo.mDisplay.width, mInfo.mDisplay.height,
- mInfo.mImage.width, mInfo.mImage.height);
+ LOG("Image allocation error source %ux%u display %ux%u picture %ux%u",
+ img->d_w, img->d_h, mInfo.mDisplay.width, mInfo.mDisplay.height,
+ mInfo.mImage.width, mInfo.mImage.height);
return MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__);
}
mCallback->Output(v);
@@ -296,15 +296,8 @@ AOMDecoder::Drain()
bool
AOMDecoder::IsAV1(const nsACString& aMimeType)
{
- return aMimeType.EqualsLiteral("video/webm; codecs=av1")
- || aMimeType.EqualsLiteral("video/av1");
-}
-
-/* static */
-bool
-AOMDecoder::IsSupportedCodec(const nsAString& aCodecType)
-{
- return aCodecType.EqualsLiteral("av1");
+ return aMimeType.EqualsLiteral("video/webm; codecs=av1") ||
+ aMimeType.EqualsLiteral("video/av1");
}
/* static */
diff --git a/dom/media/platforms/agnostic/AOMDecoder.h b/dom/media/platforms/agnostic/AOMDecoder.h
index 1e2b76c2c..ec6b1f95a 100644
--- a/dom/media/platforms/agnostic/AOMDecoder.h
+++ b/dom/media/platforms/agnostic/AOMDecoder.h
@@ -34,9 +34,6 @@ 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/platforms/agnostic/AgnosticDecoderModule.cpp b/dom/media/platforms/agnostic/AgnosticDecoderModule.cpp
index 51ca4e9de..cf5ed3d22 100644
--- a/dom/media/platforms/agnostic/AgnosticDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/AgnosticDecoderModule.cpp
@@ -25,15 +25,15 @@ AgnosticDecoderModule::SupportsMimeType(const nsACString& aMimeType,
{
bool supports =
VPXDecoder::IsVPX(aMimeType) ||
+ OpusDataDecoder::IsOpus(aMimeType) ||
+ VorbisDataDecoder::IsVorbis(aMimeType) ||
+ WaveDataDecoder::IsWave(aMimeType) ||
+ TheoraDecoder::IsTheora(aMimeType);
#ifdef MOZ_AV1
if (MediaPrefs::AV1Enabled()) {
supports |= AOMDecoder::IsAV1(aMimeType);
}
#endif
- OpusDataDecoder::IsOpus(aMimeType) ||
- VorbisDataDecoder::IsVorbis(aMimeType) ||
- WaveDataDecoder::IsWave(aMimeType) ||
- TheoraDecoder::IsTheora(aMimeType);
MOZ_LOG(sPDMLog, LogLevel::Debug, ("Agnostic decoder %s requested type",
supports ? "supports" : "rejects"));
return supports;
diff --git a/dom/media/webm/WebMDecoder.cpp b/dom/media/webm/WebMDecoder.cpp
index 5a32793ac..9575d6e42 100644
--- a/dom/media/webm/WebMDecoder.cpp
+++ b/dom/media/webm/WebMDecoder.cpp
@@ -70,8 +70,7 @@ WebMDecoder::CanHandleMediaType(const nsACString& aMIMETypeExcludingCodecs,
continue;
}
#ifdef MOZ_AV1
- if (isWebMVideo && MediaPrefs::AV1Enabled() &&
- AOMDecoder::IsSupportedCodec(codec)) {
+ if (MediaPrefs::AV1Enabled() && IsAV1CodecString(codec)) {
continue;
}
#endif