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

Side by Side Diff: media/gpu/dxva_video_decode_accelerator_win.cc

Issue 2256933002: Don't attempt to use hardware video decoding if mf.dll doesn't exist. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/gpu/dxva_video_decode_accelerator_win.h" 5 #include "media/gpu/dxva_video_decode_accelerator_win.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #if !defined(OS_WIN) 9 #if !defined(OS_WIN)
10 #error This file should only be built on Windows. 10 #error This file should only be built on Windows.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 0x9990, 0x9991, 0x9992, 0x9993, 0x9994, 0x9995, 0x9996, 0x9997, 0x9998, 148 0x9990, 0x9991, 0x9992, 0x9993, 0x9994, 0x9995, 0x9996, 0x9997, 0x9998,
149 0x9999, 0x999a, 0x999b, 0x999c, 0x999d, 0x99a0, 0x99a2, 0x99a4, 149 0x9999, 0x999a, 0x999b, 0x999c, 0x999d, 0x99a0, 0x99a2, 0x99a4,
150 }; 150 };
151 151
152 // Legacy Intel GPUs (Second generation) which have trouble with resolutions 152 // Legacy Intel GPUs (Second generation) which have trouble with resolutions
153 // higher than 1920 x 1088 153 // higher than 1920 x 1088
154 static const DWORD g_IntelLegacyGPUList[] = { 154 static const DWORD g_IntelLegacyGPUList[] = {
155 0x102, 0x106, 0x116, 0x126, 155 0x102, 0x106, 0x116, 0x126,
156 }; 156 };
157 157
158 constexpr const wchar_t* const kMediaFoundationVideoDecoderDLLs[] = {
sandersd (OOO until July 31) 2016/08/18 00:05:59 This looks rather redundant. Does constexpr not im
159 L"mf.dll", L"mfplat.dll", L"msmpeg2vdec.dll",
160 };
161
158 } // namespace 162 } // namespace
159 163
160 namespace media { 164 namespace media {
161 165
162 static const VideoCodecProfile kSupportedProfiles[] = { 166 static const VideoCodecProfile kSupportedProfiles[] = {
163 H264PROFILE_BASELINE, H264PROFILE_MAIN, H264PROFILE_HIGH, 167 H264PROFILE_BASELINE, H264PROFILE_MAIN, H264PROFILE_HIGH,
164 VP8PROFILE_ANY, VP9PROFILE_PROFILE0, VP9PROFILE_PROFILE1, 168 VP8PROFILE_ANY, VP9PROFILE_PROFILE0, VP9PROFILE_PROFILE1,
165 VP9PROFILE_PROFILE2, VP9PROFILE_PROFILE3}; 169 VP9PROFILE_PROFILE2, VP9PROFILE_PROFILE3};
166 170
167 CreateDXGIDeviceManager 171 CreateDXGIDeviceManager
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 1037
1034 // static 1038 // static
1035 VideoDecodeAccelerator::SupportedProfiles 1039 VideoDecodeAccelerator::SupportedProfiles
1036 DXVAVideoDecodeAccelerator::GetSupportedProfiles( 1040 DXVAVideoDecodeAccelerator::GetSupportedProfiles(
1037 const gpu::GpuPreferences& preferences) { 1041 const gpu::GpuPreferences& preferences) {
1038 TRACE_EVENT0("gpu,startup", 1042 TRACE_EVENT0("gpu,startup",
1039 "DXVAVideoDecodeAccelerator::GetSupportedProfiles"); 1043 "DXVAVideoDecodeAccelerator::GetSupportedProfiles");
1040 1044
1041 // TODO(henryhsu): Need to ensure the profiles are actually supported. 1045 // TODO(henryhsu): Need to ensure the profiles are actually supported.
1042 SupportedProfiles profiles; 1046 SupportedProfiles profiles;
1047
1048 for (const wchar_t* mfdll : kMediaFoundationVideoDecoderDLLs) {
1049 if (!::GetModuleHandle(mfdll)) {
1050 // Windows N is missing the media foundation DLLs unless the media
1051 // feature pack is installed.
1052 DVLOG(ERROR) << mfdll << " is required for hardware video decoding";
1053 return profiles;
1054 }
1055 }
1043 for (const auto& supported_profile : kSupportedProfiles) { 1056 for (const auto& supported_profile : kSupportedProfiles) {
1044 if (!preferences.enable_accelerated_vpx_decode && 1057 if (!preferences.enable_accelerated_vpx_decode &&
1045 (supported_profile >= VP8PROFILE_MIN) && 1058 (supported_profile >= VP8PROFILE_MIN) &&
1046 (supported_profile <= VP9PROFILE_MAX)) { 1059 (supported_profile <= VP9PROFILE_MAX)) {
1047 continue; 1060 continue;
1048 } 1061 }
1049 std::pair<int, int> min_resolution = GetMinResolution(supported_profile); 1062 std::pair<int, int> min_resolution = GetMinResolution(supported_profile);
1050 std::pair<int, int> max_resolution = GetMaxResolution(supported_profile); 1063 std::pair<int, int> max_resolution = GetMaxResolution(supported_profile);
1051 1064
1052 SupportedProfile profile; 1065 SupportedProfile profile;
1053 profile.profile = supported_profile; 1066 profile.profile = supported_profile;
1054 profile.min_resolution.SetSize(min_resolution.first, min_resolution.second); 1067 profile.min_resolution.SetSize(min_resolution.first, min_resolution.second);
1055 profile.max_resolution.SetSize(max_resolution.first, max_resolution.second); 1068 profile.max_resolution.SetSize(max_resolution.first, max_resolution.second);
1056 profiles.push_back(profile); 1069 profiles.push_back(profile);
1057 } 1070 }
1058 return profiles; 1071 return profiles;
1059 } 1072 }
1060 1073
1061 // static 1074 // static
1062 void DXVAVideoDecodeAccelerator::PreSandboxInitialization() { 1075 void DXVAVideoDecodeAccelerator::PreSandboxInitialization() {
1063 ::LoadLibrary(L"MFPlat.dll"); 1076 for (const wchar_t* mfdll : kMediaFoundationVideoDecoderDLLs)
1064 ::LoadLibrary(L"msmpeg2vdec.dll"); 1077 ::LoadLibrary(mfdll);
1065 ::LoadLibrary(L"mf.dll");
1066 ::LoadLibrary(L"dxva2.dll"); 1078 ::LoadLibrary(L"dxva2.dll");
1067 1079
1068 if (base::win::GetVersion() > base::win::VERSION_WIN7) { 1080 if (base::win::GetVersion() > base::win::VERSION_WIN7) {
1069 LoadLibrary(L"msvproc.dll"); 1081 LoadLibrary(L"msvproc.dll");
1070 } else { 1082 } else {
1071 #if defined(ENABLE_DX11_FOR_WIN7) 1083 #if defined(ENABLE_DX11_FOR_WIN7)
1072 LoadLibrary(L"mshtmlmedia.dll"); 1084 LoadLibrary(L"mshtmlmedia.dll");
1073 #endif 1085 #endif
1074 } 1086 }
1075 } 1087 }
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after
2628 SetState(kConfigChange); 2640 SetState(kConfigChange);
2629 Invalidate(); 2641 Invalidate();
2630 Initialize(config_, client_); 2642 Initialize(config_, client_);
2631 decoder_thread_task_runner_->PostTask( 2643 decoder_thread_task_runner_->PostTask(
2632 FROM_HERE, 2644 FROM_HERE,
2633 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, 2645 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers,
2634 base::Unretained(this))); 2646 base::Unretained(this)));
2635 } 2647 }
2636 2648
2637 } // namespace media 2649 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698