Bug 1853448 - part1 : support HEVC in WMF decoder module. r=media-playback-reviewers,padenot

HEVC playback will be supported via the Media Foundation Transform (MFT)
and WMF decoder module will check if there is any avaliable MFT which
can be used for HEVC then reports the support information.

Differential Revision: https://phabricator.services.mozilla.com/D188389
This commit is contained in:
alwu 2023-09-27 19:03:16 +00:00
Родитель 46e1a00d59
Коммит 314bac5c91
4 изменённых файлов: 25 добавлений и 2 удалений

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

@ -177,6 +177,7 @@ HRESULT WMFDecoderModule::CreateMFTDecoder(const WMFStreamType& aType,
case WMFStreamType::VP8:
case WMFStreamType::VP9:
case WMFStreamType::AV1:
case WMFStreamType::HEVC:
return E_FAIL;
default:
break;
@ -235,6 +236,12 @@ HRESULT WMFDecoderModule::CreateMFTDecoder(const WMFStreamType& aType,
return aDecoder->Create(MFT_CATEGORY_VIDEO_DECODER, MFVideoFormat_AV1,
MFVideoFormat_NV12);
#endif
case WMFStreamType::HEVC:
if (!StaticPrefs::media_wmf_hevc_enabled() || !sDXVAEnabled) {
return E_FAIL;
}
return SUCCEEDED(aDecoder->Create(
MFT_CATEGORY_VIDEO_DECODER, MFVideoFormat_HEVC, MFVideoFormat_NV12));
case WMFStreamType::MP3:
return aDecoder->Create(CLSID_CMP3DecMediaObject);
case WMFStreamType::AAC:
@ -275,6 +282,11 @@ bool WMFDecoderModule::CanCreateMFTDecoder(const WMFStreamType& aType) {
}
break;
#endif
case WMFStreamType::HEVC:
if (!StaticPrefs::media_wmf_hevc_enabled()) {
return false;
}
break;
case WMFStreamType::MP3:
// Prefer ffvpx mp3 decoder over WMF.
if (StaticPrefs::media_ffvpx_mp3_enabled()) {
@ -293,6 +305,7 @@ bool WMFDecoderModule::CanCreateMFTDecoder(const WMFStreamType& aType) {
case WMFStreamType::VP8:
case WMFStreamType::VP9:
case WMFStreamType::AV1:
case WMFStreamType::HEVC:
return false;
default:
break;

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

@ -103,6 +103,8 @@ const GUID& WMFVideoMFTManager::GetMediaSubtypeGUID() {
return MFVideoFormat_VP90;
case WMFStreamType::AV1:
return MFVideoFormat_AV1;
case WMFStreamType::HEVC:
return MFVideoFormat_HEVC;
default:
return GUID_NULL;
};
@ -310,7 +312,8 @@ MediaResult WMFVideoMFTManager::InitInternal() {
}
if (mStreamType == WMFStreamType::VP9 ||
mStreamType == WMFStreamType::VP8 ||
mStreamType == WMFStreamType::AV1) {
mStreamType == WMFStreamType::AV1 ||
mStreamType == WMFStreamType::HEVC) {
return MediaResult(
NS_ERROR_DOM_MEDIA_FATAL_ERR,
RESULT_DETAIL("Use VP8/VP9/AV1 MFT only if HW acceleration "
@ -490,6 +493,9 @@ WMFVideoMFTManager::Input(MediaRawData* aSample) {
case WMFStreamType::AV1:
flag |= MediaInfoFlag::VIDEO_AV1;
break;
case WMFStreamType::HEVC:
flag |= MediaInfoFlag::VIDEO_HEVC;
break;
default:
break;
};
@ -1010,6 +1016,8 @@ nsCString WMFVideoMFTManager::GetCodecName() const {
return "vp9"_ns;
case WMFStreamType::AV1:
return "av1"_ns;
case WMFStreamType::HEVC:
return "hevc"_ns;
default:
return "unknown"_ns;
};

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

@ -49,7 +49,8 @@ class WMFVideoMFTManager : public MFTManager {
nsCString GetCodecName() const override;
MediaDataDecoder::ConversionRequired NeedsConversion() const override {
return mStreamType == WMFStreamType::H264
return mStreamType == WMFStreamType::H264 ||
mStreamType == WMFStreamType::HEVC
? MediaDataDecoder::ConversionRequired::kNeedAnnexB
: MediaDataDecoder::ConversionRequired::kNeedNone;
}

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

@ -70,6 +70,7 @@ enum class MediaInfoFlag : uint16_t {
VIDEO_VP8 = (1 << 6),
VIDEO_VP9 = (1 << 7),
VIDEO_THEORA = (1 << 8),
VIDEO_HEVC = (1 << 9),
};
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(MediaInfoFlag)