Chromium Code Reviews| Index: media/base/media.cc |
| diff --git a/media/base/media.cc b/media/base/media.cc |
| index 37fc02ae4575c3cb6cf51a94c0f6fdaebc23c9fe..6ad3c87aafb7de09e9bd3d613b41b92bc61c05d1 100644 |
| --- a/media/base/media.cc |
| +++ b/media/base/media.cc |
| @@ -15,32 +15,28 @@ namespace media { |
| namespace internal { |
| // Platform specific initialization method. |
| -extern bool InitializeMediaLibraryInternal(const base::FilePath& module_dir); |
| +extern void InitializeMediaLibraryInternal(); |
|
M-A Ruel
2015/05/15 23:51:29
The function is not external. Also per coding styl
DaleCurtis
2015/05/15 23:57:45
Yeah this isn't really necessary anymore since we
chcunningham
2015/05/16 04:36:25
Done. I used the existing define MEDIA_DISABLE_FFM
DaleCurtis
2015/05/18 23:33:14
Doesn't seem deleted yet?
chcunningham
2015/05/21 22:10:27
Woops, fixed.
|
| } // namespace internal |
| // Media must only be initialized once, so use a LazyInstance to ensure this. |
| class MediaInitializer { |
| public: |
| - bool Initialize(const base::FilePath& module_dir) { |
| + void Initialize() { |
| base::AutoLock auto_lock(lock_); |
| - if (!tried_initialize_) { |
| - tried_initialize_ = true; |
| - initialized_ = internal::InitializeMediaLibraryInternal(module_dir); |
| + if (!initialized_) { |
| + internal::InitializeMediaLibraryInternal(); |
| + initialized_ = true; |
| } |
| - return initialized_; |
| } |
| bool IsInitialized() { |
| base::AutoLock auto_lock(lock_); |
| return initialized_; |
| } |
| - |
| private: |
| friend struct base::DefaultLazyInstanceTraits<MediaInitializer>; |
| - MediaInitializer() |
| - : initialized_(false), |
| - tried_initialize_(false) { |
| + MediaInitializer() : initialized_(false) { |
| // Perform initialization of libraries which require runtime CPU detection. |
| InitializeCPUSpecificYUVConversions(); |
| } |
| @@ -51,7 +47,6 @@ class MediaInitializer { |
| base::Lock lock_; |
| bool initialized_; |
| - bool tried_initialize_; |
| DISALLOW_COPY_AND_ASSIGN(MediaInitializer); |
| }; |
| @@ -59,17 +54,27 @@ class MediaInitializer { |
| static base::LazyInstance<MediaInitializer>::Leaky g_media_library = |
| LAZY_INSTANCE_INITIALIZER; |
| +void InitializeMediaLibrary() { |
| + g_media_library.Get().Initialize(); |
| +} |
| + |
| bool InitializeMediaLibrary(const base::FilePath& module_dir) { |
| - return g_media_library.Get().Initialize(module_dir); |
| + // TODO(chcunningham): Remove this method in favor of the zero-argument |
| + // version. Because ffmpeg is now statically linked, path is no longer needed |
| + // and return will always be true. |
| + InitializeMediaLibrary(); |
| + return true; |
| } |
| void InitializeMediaLibraryForTesting() { |
| - base::FilePath module_dir; |
| - CHECK(PathService::Get(base::DIR_EXE, &module_dir)); |
| - CHECK(g_media_library.Get().Initialize(module_dir)); |
| + // TODO(chcunningham): Delete this method. Testing path is now the same as |
| + // production path. |
| + InitializeMediaLibrary(); |
| } |
| bool IsMediaLibraryInitialized() { |
| + // TODO(chcunningham): Delete this method. Users should just call Initialize |
| + // blindly and let it bail if its already been done. |
| return g_media_library.Get().IsInitialized(); |
| } |