summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-04-27 12:34:59 +0000
committerMoonchild <moonchild@palemoon.org>2022-04-27 12:34:59 +0000
commit983a87a9d7d01c8a8750fe070ebc790f12614a63 (patch)
tree26c5b2fc84f2793c15b79ac28e19c442ddff9fd0
parentbf8359c70453d9f68a6e14cf04fd6ad132329129 (diff)
downloaduxp-983a87a9d7d01c8a8750fe070ebc790f12614a63.tar.gz
Issue #1820 - Part 7: Check bit depth in WebMDecoder to determine if we support HDR.
-rw-r--r--dom/media/webm/WebMDecoder.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/dom/media/webm/WebMDecoder.cpp b/dom/media/webm/WebMDecoder.cpp
index f0686577d6..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,10 +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) &&
- (IsVP8CodecString(codec) || IsVP9CodecString(codec))) {
-
- 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)) {