Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / media / base / media.cc
blobc3e1378ce8c00fa740658eaa14560cc6c84f2415
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "media/base/media.h"
7 #include "base/files/file_path.h"
8 #include "base/lazy_instance.h"
9 #include "base/path_service.h"
10 #include "base/synchronization/lock.h"
11 #include "base/trace_event/trace_event.h"
12 #include "build/build_config.h"
13 #include "media/base/yuv_convert.h"
15 #if !defined(MEDIA_DISABLE_FFMPEG)
16 #include "media/ffmpeg/ffmpeg_common.h"
17 #endif
19 namespace media {
21 // Media must only be initialized once, so use a LazyInstance to ensure this.
22 class MediaInitializer {
23 private:
24 friend struct base::DefaultLazyInstanceTraits<MediaInitializer>;
26 MediaInitializer() {
27 TRACE_EVENT_WARMUP_CATEGORY("audio");
28 TRACE_EVENT_WARMUP_CATEGORY("media");
30 // Perform initialization of libraries which require runtime CPU detection.
31 InitializeCPUSpecificYUVConversions();
33 #if !defined(MEDIA_DISABLE_FFMPEG)
34 // Initialize CPU flags outside of the sandbox as this may query /proc for
35 // details on the current CPU for NEON, VFP, etc optimizations.
36 av_get_cpu_flags();
38 // Disable logging as it interferes with layout tests.
39 av_log_set_level(AV_LOG_QUIET);
41 #if defined(ALLOCATOR_SHIM)
42 // Remove allocation limit from ffmpeg, so calls go down to shim layer.
43 av_max_alloc(0);
44 #endif // defined(ALLOCATOR_SHIM)
46 #endif // !defined(MEDIA_DISABLE_FFMPEG)
49 ~MediaInitializer() {
50 NOTREACHED() << "MediaInitializer should be leaky!";
53 DISALLOW_COPY_AND_ASSIGN(MediaInitializer);
56 static base::LazyInstance<MediaInitializer>::Leaky g_media_library =
57 LAZY_INSTANCE_INITIALIZER;
59 void InitializeMediaLibrary() {
60 g_media_library.Get();
63 } // namespace media