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

Unified Diff: media/base/media.cc

Issue 1141703002: Chromium changes for static linking ffmpeg (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Roll DEPS to fix cros, rebase. Created 5 years, 6 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.h ('k') | media/base/media_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/media.cc
diff --git a/media/base/media.cc b/media/base/media.cc
index 37fc02ae4575c3cb6cf51a94c0f6fdaebc23c9fe..c85d4654d3b15bd505472711131d756f9db0cf8b 100644
--- a/media/base/media.cc
+++ b/media/base/media.cc
@@ -11,70 +11,44 @@
#include "build/build_config.h"
#include "media/base/yuv_convert.h"
-namespace media {
+#if !defined(MEDIA_DISABLE_FFMPEG)
+#include "media/ffmpeg/ffmpeg_common.h"
+#endif
-namespace internal {
-// Platform specific initialization method.
-extern bool InitializeMediaLibraryInternal(const base::FilePath& module_dir);
-} // namespace internal
+namespace media {
// Media must only be initialized once, so use a LazyInstance to ensure this.
class MediaInitializer {
- public:
- bool Initialize(const base::FilePath& module_dir) {
- base::AutoLock auto_lock(lock_);
- if (!tried_initialize_) {
- tried_initialize_ = true;
- initialized_ = internal::InitializeMediaLibraryInternal(module_dir);
- }
- return initialized_;
- }
-
- bool IsInitialized() {
- base::AutoLock auto_lock(lock_);
- return initialized_;
- }
-
private:
friend struct base::DefaultLazyInstanceTraits<MediaInitializer>;
- MediaInitializer()
- : initialized_(false),
- tried_initialize_(false) {
+ MediaInitializer() {
// Perform initialization of libraries which require runtime CPU detection.
InitializeCPUSpecificYUVConversions();
+
+#if !defined(MEDIA_DISABLE_FFMPEG)
+ // Disable logging as it interferes with layout tests.
+ av_log_set_level(AV_LOG_QUIET);
+
+#if defined(ALLOCATOR_SHIM)
+ // Remove allocation limit from ffmpeg, so calls go down to shim layer.
+ av_max_alloc(0);
+#endif // defined(ALLOCATOR_SHIM)
+
+#endif // !defined(MEDIA_DISABLE_FFMPEG)
}
~MediaInitializer() {
NOTREACHED() << "MediaInitializer should be leaky!";
}
- base::Lock lock_;
- bool initialized_;
- bool tried_initialize_;
-
DISALLOW_COPY_AND_ASSIGN(MediaInitializer);
};
static base::LazyInstance<MediaInitializer>::Leaky g_media_library =
LAZY_INSTANCE_INITIALIZER;
-bool InitializeMediaLibrary(const base::FilePath& module_dir) {
- return g_media_library.Get().Initialize(module_dir);
-}
-
-void InitializeMediaLibraryForTesting() {
- base::FilePath module_dir;
- CHECK(PathService::Get(base::DIR_EXE, &module_dir));
- CHECK(g_media_library.Get().Initialize(module_dir));
-}
-
-bool IsMediaLibraryInitialized() {
- return g_media_library.Get().IsInitialized();
-}
-
-void InitializeCPUSpecificMediaFeatures() {
- // Force initialization of the media initializer, but don't call Initialize().
+void InitializeMediaLibrary() {
g_media_library.Get();
}
« no previous file with comments | « media/base/media.h ('k') | media/base/media_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698