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 <cpu-features.h> | 7 #include <cpu-features.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/logging.h" | 10 #include "base/files/file_path.h" |
11 #include "media/base/android/media_jni_registrar.h" | 11 #include "media/base/android/media_jni_registrar.h" |
12 | 12 |
13 namespace media { | 13 namespace media { |
14 namespace internal { | |
14 | 15 |
15 // Caches the result of the check for NEON support. | 16 bool InitializeMediaLibraryInternal(const base::FilePath& module_dir, |
16 static bool g_media_library_is_initialized = false; | 17 bool for_testing) { |
scherkus (not reviewing)
2013/05/03 17:44:43
this is the only place where |for_testing| is used
| |
18 if (for_testing) { | |
19 // Register JNI bindings for android. | |
20 JNIEnv* env = base::android::AttachCurrentThread(); | |
21 RegisterJni(env); | |
22 } | |
17 | 23 |
18 bool InitializeMediaLibrary(const base::FilePath& module_dir) { | |
19 // No real initialization is necessary but we do need to check if | 24 // No real initialization is necessary but we do need to check if |
20 // Neon is supported because the FFT library requires Neon. | 25 // Neon is supported because the FFT library requires Neon. |
21 g_media_library_is_initialized = (android_getCpuFeatures() & | 26 return (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; |
22 ANDROID_CPU_ARM_FEATURE_NEON) != 0; | |
23 return g_media_library_is_initialized; | |
24 } | 27 } |
25 | 28 |
26 void InitializeMediaLibraryForTesting() { | 29 } // namespace internal |
27 // Register JNI bindings for android. | |
28 JNIEnv* env = base::android::AttachCurrentThread(); | |
29 RegisterJni(env); | |
30 } | |
31 | |
32 bool IsMediaLibraryInitialized() { | |
33 return g_media_library_is_initialized; | |
34 } | |
35 | |
36 } // namespace media | 30 } // namespace media |
OLD | NEW |