summaryrefslogtreecommitdiff
path: root/dom/media/webm/WebMDecoder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/media/webm/WebMDecoder.cpp')
-rw-r--r--dom/media/webm/WebMDecoder.cpp30
1 files changed, 25 insertions, 5 deletions
diff --git a/dom/media/webm/WebMDecoder.cpp b/dom/media/webm/WebMDecoder.cpp
index cbe9ffdb78..b4cc794e76 100644
--- a/dom/media/webm/WebMDecoder.cpp
+++ b/dom/media/webm/WebMDecoder.cpp
@@ -12,6 +12,7 @@
#include "MediaDecoderStateMachine.h"
#include "WebMDemuxer.h"
#include "WebMDecoder.h"
+#include "PDMFactory.h"
#include "VideoUtils.h"
#include "nsContentTypeParser.h"
@@ -66,11 +67,30 @@ WebMDecoder::CanHandleMediaType(const nsACString& aMIMETypeExcludingCodecs,
}
// Note: Only accept VP8/VP9 in a video content type, not in an audio
// content type.
- if ((isWebMVideo || isMatroskaVideo) &&
- (codec.EqualsLiteral("vp8") || codec.EqualsLiteral("vp8.0") ||
- codec.EqualsLiteral("vp9") || codec.EqualsLiteral("vp9.0"))) {
-
- continue;
+ if (isWebMVideo || isMatroskaVideo) {
+ UniquePtr<TrackInfo> trackInfo;
+ if (IsVP9CodecString(codec)) {
+ trackInfo = CreateTrackInfoWithMIMEType(
+ NS_LITERAL_CSTRING("video/vp9"));
+ } else if (IsVP8CodecString(codec)) {
+ trackInfo = CreateTrackInfoWithMIMEType(
+ NS_LITERAL_CSTRING("video/vp8"));
+ }
+ // If it is vp8 or vp9, check the bit depth.
+ if (trackInfo) {
+ uint8_t profile = 0;
+ uint8_t level = 0;
+ uint8_t bitDepth = 0;
+ if (ExtractVPXCodecDetails(codec, profile, level, bitDepth)) {
+ trackInfo->GetAsVideoInfo()->mBitDepth = bitDepth;
+ }
+ // Verify that we have a PDM that supports this bit depth.
+ RefPtr<PDMFactory> platform = new PDMFactory();
+ if (!platform->Supports(*trackInfo, nullptr)) {
+ return false;
+ }
+ continue;
+ }
}
#ifdef MOZ_AV1
if (MediaPrefs::AV1Enabled() && IsAV1CodecString(codec)) {