Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "content/common/gpu/media/dxva_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #if !defined(OS_WIN) | 7 #if !defined(OS_WIN) |
| 8 #error This file should only be built on Windows. | 8 #error This file should only be built on Windows. |
| 9 #endif // !defined(OS_WIN) | 9 #endif // !defined(OS_WIN) |
| 10 | 10 |
| 11 #include <ks.h> | 11 #include <ks.h> |
| 12 #include <codecapi.h> | 12 #include <codecapi.h> |
| 13 #include <mfapi.h> | 13 #include <mfapi.h> |
| 14 #include <mferror.h> | 14 #include <mferror.h> |
| 15 #include <wmcodecdsp.h> | 15 #include <wmcodecdsp.h> |
| 16 | 16 |
| 17 #include "base/bind.h" | 17 #include "base/bind.h" |
| 18 #include "base/callback.h" | 18 #include "base/callback.h" |
| 19 #include "base/command_line.h" | 19 #include "base/command_line.h" |
| 20 #include "base/debug/trace_event.h" | 20 #include "base/debug/trace_event.h" |
| 21 #include "base/file_version_info.h" | |
| 21 #include "base/logging.h" | 22 #include "base/logging.h" |
| 22 #include "base/memory/scoped_ptr.h" | 23 #include "base/memory/scoped_ptr.h" |
| 23 #include "base/memory/shared_memory.h" | 24 #include "base/memory/shared_memory.h" |
| 24 #include "base/message_loop/message_loop.h" | 25 #include "base/message_loop/message_loop.h" |
| 25 #include "base/win/windows_version.h" | 26 #include "base/win/windows_version.h" |
| 26 #include "media/video/video_decode_accelerator.h" | 27 #include "media/video/video_decode_accelerator.h" |
| 27 #include "ui/gl/gl_bindings.h" | 28 #include "ui/gl/gl_bindings.h" |
| 28 #include "ui/gl/gl_surface_egl.h" | 29 #include "ui/gl/gl_surface_egl.h" |
| 29 #include "ui/gl/gl_switches.h" | 30 #include "ui/gl/gl_switches.h" |
| 30 | 31 |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 631 | 632 |
| 632 // We mimic the steps CoCreateInstance uses to instantiate the object. This | 633 // We mimic the steps CoCreateInstance uses to instantiate the object. This |
| 633 // was previously done because it failed inside the sandbox, and now is done | 634 // was previously done because it failed inside the sandbox, and now is done |
| 634 // as a more minimal approach to avoid other side-effects CCI might have (as | 635 // as a more minimal approach to avoid other side-effects CCI might have (as |
| 635 // we are still in a reduced sandbox). | 636 // we are still in a reduced sandbox). |
| 636 HMODULE decoder_dll = ::LoadLibrary(L"msmpeg2vdec.dll"); | 637 HMODULE decoder_dll = ::LoadLibrary(L"msmpeg2vdec.dll"); |
| 637 RETURN_ON_FAILURE(decoder_dll, | 638 RETURN_ON_FAILURE(decoder_dll, |
| 638 "msmpeg2vdec.dll required for decoding is not loaded", | 639 "msmpeg2vdec.dll required for decoding is not loaded", |
| 639 false); | 640 false); |
| 640 | 641 |
| 642 // Check version of DLL, version 6.7.7140 is blacklisted due to high crash | |
| 643 // rates in browsers loading that DLL. If that is the version installed we | |
| 644 // fall back to software decoding. | |
|
scherkus (not reviewing)
2014/08/26 20:31:44
nit: link to crbug
luken
2014/08/26 22:59:25
Done.
| |
| 645 FileVersionInfo* version_info = | |
| 646 FileVersionInfo::CreateFileVersionInfoForModule(decoder_dll); | |
| 647 RETURN_ON_FAILURE(version_info, | |
| 648 "unable to get version of msmpeg2vdec.dll", | |
| 649 false); | |
| 650 base::string16 file_version = version_info->file_version(); | |
| 651 RETURN_ON_FAILURE(file_version.find(L"6.1.7140") == base::string16::npos, | |
| 652 "blacklisted version of msmpeg2vdec.dll 6.7.7140", | |
| 653 false); | |
| 654 | |
| 641 typedef HRESULT(WINAPI * GetClassObject)( | 655 typedef HRESULT(WINAPI * GetClassObject)( |
| 642 const CLSID & clsid, const IID & iid, void * *object); | 656 const CLSID & clsid, const IID & iid, void * *object); |
| 643 | 657 |
| 644 GetClassObject get_class_object = reinterpret_cast<GetClassObject>( | 658 GetClassObject get_class_object = reinterpret_cast<GetClassObject>( |
| 645 GetProcAddress(decoder_dll, "DllGetClassObject")); | 659 GetProcAddress(decoder_dll, "DllGetClassObject")); |
| 646 RETURN_ON_FAILURE( | 660 RETURN_ON_FAILURE( |
| 647 get_class_object, "Failed to get DllGetClassObject pointer", false); | 661 get_class_object, "Failed to get DllGetClassObject pointer", false); |
| 648 | 662 |
| 649 base::win::ScopedComPtr<IClassFactory> factory; | 663 base::win::ScopedComPtr<IClassFactory> factory; |
| 650 HRESULT hr = get_class_object(__uuidof(CMSH264DecoderMFT), | 664 HRESULT hr = get_class_object(__uuidof(CMSH264DecoderMFT), |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1177 | 1191 |
| 1178 for (index = picture_buffers.begin(); | 1192 for (index = picture_buffers.begin(); |
| 1179 index != picture_buffers.end(); | 1193 index != picture_buffers.end(); |
| 1180 ++index) { | 1194 ++index) { |
| 1181 DVLOG(1) << "Dismissing picture id: " << index->second->id(); | 1195 DVLOG(1) << "Dismissing picture id: " << index->second->id(); |
| 1182 client_->DismissPictureBuffer(index->second->id()); | 1196 client_->DismissPictureBuffer(index->second->id()); |
| 1183 } | 1197 } |
| 1184 } | 1198 } |
| 1185 | 1199 |
| 1186 } // namespace content | 1200 } // namespace content |
| OLD | NEW |