Bug 1407919 - Part6 - Check bit depth in WebMDecoder to determine if we support HDR. r=gerald

MozReview-Commit-ID: Jq569mlINNh

--HG--
extra : rebase_source : 57a352d9e621fc9a204f8865784332ec9aab96a5
This commit is contained in:
James Cheng 2017-10-17 15:45:09 +08:00
Родитель fe306cda12
Коммит 638d7ea11b
1 изменённых файлов: 25 добавлений и 3 удалений

Просмотреть файл

@ -10,6 +10,7 @@
#include "AOMDecoder.h"
#endif
#include "MediaContainerType.h"
#include "PDMFactory.h"
#include "VideoUtils.h"
namespace mozilla {
@ -41,10 +42,31 @@ WebMDecoder::IsSupportedType(const MediaContainerType& aContainerType)
// Note: Only accept VP8/VP9 in a video container type, not in an audio
// container type.
if (isVideo &&
(IsVP8CodecString(codec) || IsVP9CodecString(codec))) {
if (isVideo) {
UniquePtr<TrackInfo> trackInfo;
if (IsVP9CodecString(codec)) {
trackInfo = CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
NS_LITERAL_CSTRING("video/vp9"), aContainerType);
} else if (IsVP8CodecString(codec)) {
trackInfo = CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
NS_LITERAL_CSTRING("video/vp8"), aContainerType);
}
// 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 (isVideo && AOMDecoder::IsSupportedCodec(codec)) {
continue;