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