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

Unified Diff: media/base/media_win.cc

Issue 6537022: Move media library path resolution into Chrome path provider. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Get rid of spurious changes in previous patch-set. Created 9 years, 9 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/base/media_posix.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/media_win.cc
diff --git a/media/base/media_win.cc b/media/base/media_win.cc
index 82f85966e4259c259eea584dc2f74b102619fac9..ce47ba9254c4a96522746778e7fd008f639efc21 100644
--- a/media/base/media_win.cc
+++ b/media/base/media_win.cc
@@ -44,9 +44,14 @@ static FilePath::CharType* GetDLLName(FFmpegDLLKeys dll_key) {
}
}
+static bool g_media_library_is_initialized = false;
+
// Attempts to initialize the media library (loading DLLs, DSOs, etc.).
// Returns true if everything was successfully initialized, false otherwise.
bool InitializeMediaLibrary(const FilePath& base_path) {
+ if (g_media_library_is_initialized)
+ return true;
+
FFmpegDLLKeys path_keys[] = {
media::FILE_LIBAVCODEC,
media::FILE_LIBAVFORMAT,
@@ -78,15 +83,21 @@ bool InitializeMediaLibrary(const FilePath& base_path) {
// Check that we loaded all libraries successfully. We only need to check the
// last array element because the loop above will break without initializing
// it on any prior error.
- if (libs[arraysize(libs)-1])
- return true;
+ g_media_library_is_initialized = (libs[arraysize(libs)-1] != NULL);
- // Free any loaded libraries if we weren't successful.
- for (size_t i = 0; i < arraysize(libs) && libs[i] != NULL; ++i) {
- FreeLibrary(libs[i]);
- libs[i] = NULL; // Just to be safe.
+ if (!g_media_library_is_initialized) {
+ // Free any loaded libraries if we weren't successful.
+ for (size_t i = 0; i < arraysize(libs) && libs[i] != NULL; ++i) {
+ FreeLibrary(libs[i]);
+ libs[i] = NULL; // Just to be safe.
+ }
}
- return false;
+
+ return g_media_library_is_initialized;
+}
+
+bool IsMediaLibraryInitialized() {
+ return g_media_library_is_initialized;
}
bool InitializeOpenMaxLibrary(const FilePath& module_dir) {
« no previous file with comments | « media/base/media_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698