| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| 11 #include "media/base/media_switches.h" | 11 #include "media/base/media_switches.h" |
| 12 #include "media/base/yuv_convert.h" | |
| 13 | 12 |
| 14 #if defined(OS_ANDROID) | 13 #if defined(OS_ANDROID) |
| 15 #include "base/android/build_info.h" | 14 #include "base/android/build_info.h" |
| 16 #include "media/base/android/media_codec_util.h" | 15 #include "media/base/android/media_codec_util.h" |
| 17 #endif | 16 #endif |
| 18 | 17 |
| 19 #if !defined(MEDIA_DISABLE_FFMPEG) | 18 #if !defined(MEDIA_DISABLE_FFMPEG) |
| 20 #include "media/ffmpeg/ffmpeg_common.h" | 19 #include "media/ffmpeg/ffmpeg_common.h" |
| 21 #endif | 20 #endif |
| 22 | 21 |
| 23 namespace media { | 22 namespace media { |
| 24 | 23 |
| 25 // Media must only be initialized once; use a thread-safe static to do this. | 24 // Media must only be initialized once; use a thread-safe static to do this. |
| 26 class MediaInitializer { | 25 class MediaInitializer { |
| 27 public: | 26 public: |
| 28 MediaInitializer() { | 27 MediaInitializer() { |
| 29 TRACE_EVENT_WARMUP_CATEGORY("audio"); | 28 TRACE_EVENT_WARMUP_CATEGORY("audio"); |
| 30 TRACE_EVENT_WARMUP_CATEGORY("media"); | 29 TRACE_EVENT_WARMUP_CATEGORY("media"); |
| 31 | 30 |
| 32 // Perform initialization of libraries which require runtime CPU detection. | |
| 33 InitializeCPUSpecificYUVConversions(); | |
| 34 | |
| 35 #if !defined(MEDIA_DISABLE_FFMPEG) | 31 #if !defined(MEDIA_DISABLE_FFMPEG) |
| 36 // Initialize CPU flags outside of the sandbox as this may query /proc for | 32 // Initialize CPU flags outside of the sandbox as this may query /proc for |
| 37 // details on the current CPU for NEON, VFP, etc optimizations. | 33 // details on the current CPU for NEON, VFP, etc optimizations. |
| 38 av_get_cpu_flags(); | 34 av_get_cpu_flags(); |
| 39 | 35 |
| 40 // Disable logging as it interferes with layout tests. | 36 // Disable logging as it interferes with layout tests. |
| 41 av_log_set_level(AV_LOG_QUIET); | 37 av_log_set_level(AV_LOG_QUIET); |
| 42 | 38 |
| 43 #if defined(ALLOCATOR_SHIM) | 39 #if defined(ALLOCATOR_SHIM) |
| 44 // Remove allocation limit from ffmpeg, so calls go down to shim layer. | 40 // Remove allocation limit from ffmpeg, so calls go down to shim layer. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 bool HasPlatformDecoderSupport() { | 81 bool HasPlatformDecoderSupport() { |
| 86 return GetMediaInstance()->has_platform_decoder_support(); | 82 return GetMediaInstance()->has_platform_decoder_support(); |
| 87 } | 83 } |
| 88 | 84 |
| 89 bool PlatformHasOpusSupport() { | 85 bool PlatformHasOpusSupport() { |
| 90 return base::android::BuildInfo::GetInstance()->sdk_int() >= 21; | 86 return base::android::BuildInfo::GetInstance()->sdk_int() >= 21; |
| 91 } | 87 } |
| 92 #endif // defined(OS_ANDROID) | 88 #endif // defined(OS_ANDROID) |
| 93 | 89 |
| 94 } // namespace media | 90 } // namespace media |
| OLD | NEW |