summaryrefslogtreecommitdiffstats
path: root/media/video/capture
diff options
context:
space:
mode:
authorwdzierzanowski <wdzierzanowski@opera.com>2015-05-26 14:56:38 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-26 21:58:08 +0000
commitc0ab75a86447bc23d45ff7086b2375e2cd83c205 (patch)
treeea3d7136e76591609af61be559bafd6b64e26796 /media/video/capture
parent606c77e1b6c10624bffa4f1cdef74f1e055cd93d (diff)
downloadchromium_src-c0ab75a86447bc23d45ff7086b2375e2cd83c205.zip
chromium_src-c0ab75a86447bc23d45ff7086b2375e2cd83c205.tar.gz
chromium_src-c0ab75a86447bc23d45ff7086b2375e2cd83c205.tar.bz2
Extract re-usable InitializeMediaFoundation()
Allow media::InitializeMediaFoundation() to be used by any Media Foundation client code. This benefits existing Chromium code as well as any Chromium-based browser that adds its own code calling out to Media Foundation. There are two side effects for DXVAVideoDecodeAccelerator: - MFStartup() and MFShutdown() are now called once during the lifetime of the GPU process rather than per each accelerator instance. - MFStartup() is now called with the MFSTARTUP_LITE flag, which according to MSDN doesn't initialize the sockets library. TEST=media_unittests Review URL: https://codereview.chromium.org/1149203002 Cr-Commit-Position: refs/heads/master@{#331446}
Diffstat (limited to 'media/video/capture')
-rw-r--r--media/video/capture/win/video_capture_device_factory_win.cc18
1 files changed, 2 insertions, 16 deletions
diff --git a/media/video/capture/win/video_capture_device_factory_win.cc b/media/video/capture/win/video_capture_device_factory_win.cc
index 7f0d665..8b018fb 100644
--- a/media/video/capture/win/video_capture_device_factory_win.cc
+++ b/media/video/capture/win/video_capture_device_factory_win.cc
@@ -8,7 +8,6 @@
#include <mferror.h>
#include "base/command_line.h"
-#include "base/lazy_instance.h"
#include "base/metrics/histogram.h"
#include "base/strings/string_util.h"
#include "base/strings/sys_string_conversions.h"
@@ -17,6 +16,7 @@
#include "base/win/scoped_variant.h"
#include "base/win/windows_version.h"
#include "media/base/media_switches.h"
+#include "media/base/win/mf_initializer.h"
#include "media/video/capture/win/video_capture_device_mf_win.h"
#include "media/video/capture/win/video_capture_device_win.h"
@@ -39,16 +39,6 @@ enum BlacklistedCameraNames {
BLACKLISTED_CAMERA_MAX = BLACKLISTED_CAMERA_CYBERLINK_WEBCAM_SPLITTER
};
-// Lazy Instance to initialize the MediaFoundation Library.
-class MFInitializerSingleton {
- public:
- MFInitializerSingleton() { MFStartup(MF_VERSION, MFSTARTUP_LITE); }
- ~MFInitializerSingleton() { MFShutdown(); }
-};
-
-static base::LazyInstance<MFInitializerSingleton> g_mf_initialize =
- LAZY_INSTANCE_INITIALIZER;
-
// Blacklisted devices are identified by a characteristic prefix of the name.
// This prefix is used case-insensitively. This list must be kept in sync with
// |BlacklistedCameraNames|.
@@ -60,10 +50,6 @@ static const char* const kBlacklistedCameraNames[] = {
"CyberLink Webcam Splitter",
};
-static void EnsureMediaFoundationInit() {
- g_mf_initialize.Get();
-}
-
static bool LoadMediaFoundationDlls() {
static const wchar_t* const kMfDLLs[] = {
L"%WINDIR%\\system32\\mf.dll",
@@ -83,7 +69,7 @@ static bool LoadMediaFoundationDlls() {
static bool PrepareVideoCaptureAttributesMediaFoundation(
IMFAttributes** attributes,
int count) {
- EnsureMediaFoundationInit();
+ InitializeMediaFoundation();
if (FAILED(MFCreateAttributes(attributes, count)))
return false;