Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/android/media_codec_bridge.h" | 5 #include "media/base/android/media_codec_bridge.h" |
| 6 | 6 |
| 7 #include <jni.h> | 7 #include <jni.h> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/android/build_info.h" | 10 #include "base/android/build_info.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 static ScopedJavaLocalRef<jintArray> | 97 static ScopedJavaLocalRef<jintArray> |
| 98 ToJavaIntArray(JNIEnv* env, scoped_ptr<jint[]> native_array, int size) { | 98 ToJavaIntArray(JNIEnv* env, scoped_ptr<jint[]> native_array, int size) { |
| 99 ScopedJavaLocalRef<jintArray> j_array(env, env->NewIntArray(size)); | 99 ScopedJavaLocalRef<jintArray> j_array(env, env->NewIntArray(size)); |
| 100 env->SetIntArrayRegion(j_array.obj(), 0, size, native_array.get()); | 100 env->SetIntArrayRegion(j_array.obj(), 0, size, native_array.get()); |
| 101 return j_array; | 101 return j_array; |
| 102 } | 102 } |
| 103 | 103 |
| 104 // static | 104 // static |
| 105 bool MediaCodecBridge::IsAvailable() { | 105 bool MediaCodecBridge::IsAvailable() { |
| 106 // MediaCodec is only available on JB and greater. | 106 // MediaCodec is only available on JB and greater. |
| 107 return base::android::BuildInfo::GetInstance()->sdk_int() >= 16; | 107 if (base::android::BuildInfo::GetInstance()->sdk_int() < 16) |
| 108 return false; | |
| 109 if (base::android::BuildInfo::GetInstance()->sdk_int() == 16) { | |
| 110 std::string model(base::android::BuildInfo::GetInstance()->model()); | |
| 111 return model.compare("GT-I9100") && model.compare("GT-I9300") && | |
| 112 model.compare("GT-N7000"); | |
| 113 } | |
|
xhwang
2014/09/24 22:23:16
Provide comments and link to bugs why we are doing
qinmin
2014/09/24 22:49:35
Done.
| |
| 114 return true; | |
| 108 } | 115 } |
| 109 | 116 |
| 110 // static | 117 // static |
| 111 bool MediaCodecBridge::SupportsSetParameters() { | 118 bool MediaCodecBridge::SupportsSetParameters() { |
| 112 // MediaCodec.setParameters() is only available starting with K. | 119 // MediaCodec.setParameters() is only available starting with K. |
| 113 return base::android::BuildInfo::GetInstance()->sdk_int() >= 19; | 120 return base::android::BuildInfo::GetInstance()->sdk_int() >= 19; |
| 114 } | 121 } |
| 115 | 122 |
| 116 // static | 123 // static |
| 117 std::vector<MediaCodecBridge::CodecsInfo> MediaCodecBridge::GetCodecsInfo() { | 124 std::vector<MediaCodecBridge::CodecsInfo> MediaCodecBridge::GetCodecsInfo() { |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 738 JNIEnv* env = AttachCurrentThread(); | 745 JNIEnv* env = AttachCurrentThread(); |
| 739 return Java_MediaCodecBridge_isAdaptivePlaybackSupported( | 746 return Java_MediaCodecBridge_isAdaptivePlaybackSupported( |
| 740 env, media_codec(), width, height); | 747 env, media_codec(), width, height); |
| 741 } | 748 } |
| 742 | 749 |
| 743 bool MediaCodecBridge::RegisterMediaCodecBridge(JNIEnv* env) { | 750 bool MediaCodecBridge::RegisterMediaCodecBridge(JNIEnv* env) { |
| 744 return RegisterNativesImpl(env); | 751 return RegisterNativesImpl(env); |
| 745 } | 752 } |
| 746 | 753 |
| 747 } // namespace media | 754 } // namespace media |
| OLD | NEW |