Index: media/base/media_posix.cc |
diff --git a/media/base/media_posix.cc b/media/base/media_posix.cc |
index 438155a250abd0cc2154a5caa6b9fc87441e3591..fe14caf0328d2a4a6a3de4ca12874b0084ffafc0 100644 |
--- a/media/base/media_posix.cc |
+++ b/media/base/media_posix.cc |
@@ -66,11 +66,16 @@ std::string GetDSOName(tp_ffmpeg::StubModules stub_key) { |
} |
} |
+static bool g_media_library_is_initialized = false; |
awong
2011/02/25 02:41:59
If it's in an anonymous namespace, don't bother wi
|
+ |
} // namespace |
// Attempts to initialize the media library (loading DSOs, etc.). |
// Returns true if everything was successfully initialized, false otherwise. |
-bool InitializeMediaLibrary(const FilePath& module_dir) { |
+void InitializeMediaLibrary(const FilePath& module_dir) { |
+ if (g_media_library_is_initialized) |
+ return; |
+ |
// TODO(ajwong): We need error resolution. |
tp_ffmpeg::StubPathMap paths; |
for (int i = 0; i < static_cast<int>(tp_ffmpeg::kNumStubModules); ++i) { |
@@ -84,8 +89,11 @@ bool InitializeMediaLibrary(const FilePath& module_dir) { |
paths[module].push_back(path.value()); |
} |
- bool ret = tp_ffmpeg::InitializeStubs(paths); |
- return ret; |
+ g_media_library_is_initialized = tp_ffmpeg::InitializeStubs(paths); |
+} |
+ |
+bool IsMediaLibraryInitialized() { |
+ return g_media_library_is_initialized; |
} |
#if defined(OS_LINUX) |