OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/base/media.h" | 5 #include "media/base/media.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| 11 #include "base/trace_event/trace_event.h" |
11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
12 #include "media/base/yuv_convert.h" | 13 #include "media/base/yuv_convert.h" |
13 | 14 |
14 #if !defined(MEDIA_DISABLE_FFMPEG) | 15 #if !defined(MEDIA_DISABLE_FFMPEG) |
15 #include "media/ffmpeg/ffmpeg_common.h" | 16 #include "media/ffmpeg/ffmpeg_common.h" |
16 #endif | 17 #endif |
17 | 18 |
18 namespace media { | 19 namespace media { |
19 | 20 |
20 // Media must only be initialized once, so use a LazyInstance to ensure this. | 21 // Media must only be initialized once, so use a LazyInstance to ensure this. |
21 class MediaInitializer { | 22 class MediaInitializer { |
22 private: | 23 private: |
23 friend struct base::DefaultLazyInstanceTraits<MediaInitializer>; | 24 friend struct base::DefaultLazyInstanceTraits<MediaInitializer>; |
24 | 25 |
25 MediaInitializer() { | 26 MediaInitializer() { |
| 27 TRACE_EVENT_INIT_CATEGORY("media"); |
| 28 |
26 // Perform initialization of libraries which require runtime CPU detection. | 29 // Perform initialization of libraries which require runtime CPU detection. |
27 InitializeCPUSpecificYUVConversions(); | 30 InitializeCPUSpecificYUVConversions(); |
28 | 31 |
29 #if !defined(MEDIA_DISABLE_FFMPEG) | 32 #if !defined(MEDIA_DISABLE_FFMPEG) |
30 // Initialize CPU flags outside of the sandbox as this may query /proc for | 33 // Initialize CPU flags outside of the sandbox as this may query /proc for |
31 // details on the current CPU for NEON, VFP, etc optimizations. | 34 // details on the current CPU for NEON, VFP, etc optimizations. |
32 av_get_cpu_flags(); | 35 av_get_cpu_flags(); |
33 | 36 |
34 // Disable logging as it interferes with layout tests. | 37 // Disable logging as it interferes with layout tests. |
35 av_log_set_level(AV_LOG_QUIET); | 38 av_log_set_level(AV_LOG_QUIET); |
(...skipping 14 matching lines...) Expand all Loading... |
50 }; | 53 }; |
51 | 54 |
52 static base::LazyInstance<MediaInitializer>::Leaky g_media_library = | 55 static base::LazyInstance<MediaInitializer>::Leaky g_media_library = |
53 LAZY_INSTANCE_INITIALIZER; | 56 LAZY_INSTANCE_INITIALIZER; |
54 | 57 |
55 void InitializeMediaLibrary() { | 58 void InitializeMediaLibrary() { |
56 g_media_library.Get(); | 59 g_media_library.Get(); |
57 } | 60 } |
58 | 61 |
59 } // namespace media | 62 } // namespace media |
OLD | NEW |