Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: media/gpu/dxva_video_decode_accelerator_win.cc

Issue 2119773002: Use Microsoft's HMFT for VP9 decoding. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/gpu/dxva_video_decode_accelerator_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/dxva_video_decode_accelerator_win.cc
diff --git a/media/gpu/dxva_video_decode_accelerator_win.cc b/media/gpu/dxva_video_decode_accelerator_win.cc
index 9e60a0e8a4a8255a88708252b5dd190ba80988fe..871145de326916ca9ab333fd35f80aea6e1575f9 100644
--- a/media/gpu/dxva_video_decode_accelerator_win.cc
+++ b/media/gpu/dxva_video_decode_accelerator_win.cc
@@ -72,6 +72,8 @@ const wchar_t kVP9DecoderDLLName[] =
#error Unsupported Windows CPU Architecture
#endif
+const wchar_t kMSVP9DecoderDLLName[] = L"MSVP9DEC.dll";
+
const CLSID CLSID_WebmMfVp8Dec = {
0x451e3cb7,
0x2622,
@@ -693,6 +695,8 @@ bool DXVAVideoDecodeAccelerator::Initialize(const Config& config,
InitializeMediaFoundation();
+ config_ = config;
+
RETURN_AND_NOTIFY_ON_FAILURE(InitDecoder(config.profile),
"Failed to initialize decoder", PLATFORM_FAILURE,
false);
@@ -711,8 +715,6 @@ bool DXVAVideoDecodeAccelerator::Initialize(const Config& config,
"Send MFT_MESSAGE_NOTIFY_START_OF_STREAM notification failed",
PLATFORM_FAILURE, false);
- config_ = config;
-
config_change_detector_.reset(new H264ConfigChangeDetector);
SetState(kNormal);
@@ -1412,28 +1414,37 @@ bool DXVAVideoDecodeAccelerator::InitDecoder(VideoCodecProfile profile) {
profile == VP9PROFILE_PROFILE1 ||
profile == VP9PROFILE_PROFILE2 ||
profile == VP9PROFILE_PROFILE3)) {
- int program_files_key = base::DIR_PROGRAM_FILES;
- if (base::win::OSInfo::GetInstance()->wow64_status() ==
- base::win::OSInfo::WOW64_ENABLED) {
- program_files_key = base::DIR_PROGRAM_FILES6432;
+ if (profile != VP8PROFILE_ANY) {
+ codec_ = kCodecVP9;
+ clsid = CLSID_MSVPxDecoder;
+ decoder_dll = ::LoadLibrary(kMSVP9DecoderDLLName);
+ if (decoder_dll)
+ using_ms_vp9_mft_ = true;
}
+ if (!decoder_dll) {
+ int program_files_key = base::DIR_PROGRAM_FILES;
+ if (base::win::OSInfo::GetInstance()->wow64_status() ==
+ base::win::OSInfo::WOW64_ENABLED) {
+ program_files_key = base::DIR_PROGRAM_FILES6432;
+ }
- base::FilePath dll_path;
- RETURN_ON_FAILURE(PathService::Get(program_files_key, &dll_path),
- "failed to get path for Program Files", false);
+ base::FilePath dll_path;
+ RETURN_ON_FAILURE(PathService::Get(program_files_key, &dll_path),
+ "failed to get path for Program Files", false);
- dll_path = dll_path.Append(kVPXDecoderDLLPath);
- if (profile == VP8PROFILE_ANY) {
- codec_ = kCodecVP8;
- dll_path = dll_path.Append(kVP8DecoderDLLName);
- clsid = CLSID_WebmMfVp8Dec;
- } else {
- codec_ = kCodecVP9;
- dll_path = dll_path.Append(kVP9DecoderDLLName);
- clsid = CLSID_WebmMfVp9Dec;
+ dll_path = dll_path.Append(kVPXDecoderDLLPath);
+ if (profile == VP8PROFILE_ANY) {
+ codec_ = kCodecVP8;
+ dll_path = dll_path.Append(kVP8DecoderDLLName);
+ clsid = CLSID_WebmMfVp8Dec;
+ } else {
+ codec_ = kCodecVP9;
+ dll_path = dll_path.Append(kVP9DecoderDLLName);
+ clsid = CLSID_WebmMfVp9Dec;
+ }
+ decoder_dll = ::LoadLibraryEx(dll_path.value().data(), NULL,
+ LOAD_WITH_ALTERED_SEARCH_PATH);
}
- decoder_dll = ::LoadLibraryEx(dll_path.value().data(), NULL,
- LOAD_WITH_ALTERED_SEARCH_PATH);
RETURN_ON_FAILURE(decoder_dll, "vpx decoder dll is not loaded", false);
} else {
RETURN_ON_FAILURE(false, "Unsupported codec.", false);
@@ -1565,11 +1576,22 @@ bool DXVAVideoDecodeAccelerator::SetDecoderInputMediaType() {
}
RETURN_ON_HR_FAILURE(hr, "Failed to set subtype", false);
- // Not sure about this. msdn recommends setting this value on the input
- // media type.
- hr = media_type->SetUINT32(MF_MT_INTERLACE_MODE,
- MFVideoInterlace_MixedInterlaceOrProgressive);
- RETURN_ON_HR_FAILURE(hr, "Failed to set interlace mode", false);
+ if (using_ms_vp9_mft_) {
+ hr = MFSetAttributeSize(media_type.get(), MF_MT_FRAME_SIZE,
+ config_.initial_expected_coded_size.width(),
+ config_.initial_expected_coded_size.height());
+ RETURN_ON_HR_FAILURE(hr, "Failed to set attribute size", false);
+
+ hr = media_type->SetUINT32(MF_MT_INTERLACE_MODE,
+ MFVideoInterlace_Progressive);
+ RETURN_ON_HR_FAILURE(hr, "Failed to set interlace mode", false);
+ } else {
+ // Not sure about this. msdn recommends setting this value on the input
+ // media type.
+ hr = media_type->SetUINT32(MF_MT_INTERLACE_MODE,
+ MFVideoInterlace_MixedInterlaceOrProgressive);
+ RETURN_ON_HR_FAILURE(hr, "Failed to set interlace mode", false);
+ }
hr = decoder_->SetInputType(0, media_type.get(), 0); // No flags
RETURN_ON_HR_FAILURE(hr, "Failed to set decoder input type", false);
« no previous file with comments | « media/gpu/dxva_video_decode_accelerator_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698