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

Unified Diff: media/video/capture/win/video_capture_device_factory_win.cc

Issue 1149203002: Extract re-usable InitializeMediaFoundation() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix linkage of InitializeMediaFoundation() in GN builds Created 5 years, 7 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/media.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/video/capture/win/video_capture_device_factory_win.cc
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 7f0d665e4ab9e23fbc499200bd6b744b45ece1a9..8b018fb19e0e1df2d0cb7867c799bc7aaea27e6d 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;
« no previous file with comments | « media/media.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698