| 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 // Blacklist some devices on Jellybean as for MediaCodec support is buggy. |
| 110 // http://crbug.com/365494. |
| 111 if (base::android::BuildInfo::GetInstance()->sdk_int() == 16) { |
| 112 std::string model(base::android::BuildInfo::GetInstance()->model()); |
| 113 return model != "GT-I9100" && model != "GT-I9300" && model != "GT-N7000"; |
| 114 } |
| 115 return true; |
| 108 } | 116 } |
| 109 | 117 |
| 110 // static | 118 // static |
| 111 bool MediaCodecBridge::SupportsSetParameters() { | 119 bool MediaCodecBridge::SupportsSetParameters() { |
| 112 // MediaCodec.setParameters() is only available starting with K. | 120 // MediaCodec.setParameters() is only available starting with K. |
| 113 return base::android::BuildInfo::GetInstance()->sdk_int() >= 19; | 121 return base::android::BuildInfo::GetInstance()->sdk_int() >= 19; |
| 114 } | 122 } |
| 115 | 123 |
| 116 // static | 124 // static |
| 117 std::vector<MediaCodecBridge::CodecsInfo> MediaCodecBridge::GetCodecsInfo() { | 125 std::vector<MediaCodecBridge::CodecsInfo> MediaCodecBridge::GetCodecsInfo() { |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 JNIEnv* env = AttachCurrentThread(); | 746 JNIEnv* env = AttachCurrentThread(); |
| 739 return Java_MediaCodecBridge_isAdaptivePlaybackSupported( | 747 return Java_MediaCodecBridge_isAdaptivePlaybackSupported( |
| 740 env, media_codec(), width, height); | 748 env, media_codec(), width, height); |
| 741 } | 749 } |
| 742 | 750 |
| 743 bool MediaCodecBridge::RegisterMediaCodecBridge(JNIEnv* env) { | 751 bool MediaCodecBridge::RegisterMediaCodecBridge(JNIEnv* env) { |
| 744 return RegisterNativesImpl(env); | 752 return RegisterNativesImpl(env); |
| 745 } | 753 } |
| 746 | 754 |
| 747 } // namespace media | 755 } // namespace media |
| OLD | NEW |