 Chromium Code Reviews
 Chromium Code Reviews Issue 1141703002:
  Chromium changes for static linking ffmpeg  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1141703002:
  Chromium changes for static linking ffmpeg  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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(); | 
| } // 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) { | 
| 
DaleCurtis
2015/05/15 00:23:06
Delete?
 
chcunningham
2015/05/16 04:36:25
This is still called by a number of people outside
 | 
| - 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(); | 
| } |