| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_util.h" | 5 #include "media/base/android/media_codec_util.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "base/android/build_info.h" | 11 #include "base/android/build_info.h" |
| 12 #include "base/android/jni_android.h" | 12 #include "base/android/jni_android.h" |
| 13 #include "base/android/jni_array.h" | 13 #include "base/android/jni_array.h" |
| 14 #include "base/android/jni_string.h" | 14 #include "base/android/jni_string.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 17 #include "jni/MediaCodecUtil_jni.h" | 17 #include "jni/MediaCodecUtil_jni.h" |
| 18 #include "media/base/android/media_codec_bridge.h" |
| 18 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 19 | 20 |
| 20 using base::android::AttachCurrentThread; | 21 using base::android::AttachCurrentThread; |
| 21 using base::android::ConvertJavaStringToUTF8; | 22 using base::android::ConvertJavaStringToUTF8; |
| 22 using base::android::ConvertUTF8ToJavaString; | 23 using base::android::ConvertUTF8ToJavaString; |
| 23 using base::android::JavaIntArrayToIntVector; | 24 using base::android::JavaIntArrayToIntVector; |
| 24 using base::android::ScopedJavaLocalRef; | 25 using base::android::ScopedJavaLocalRef; |
| 25 | 26 |
| 26 namespace media { | 27 namespace media { |
| 27 | 28 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 for (int i = 0; model_prefixes[i]; ++i) { | 234 for (int i = 0; model_prefixes[i]; ++i) { |
| 234 if (base::StartsWith(model, model_prefixes[i], | 235 if (base::StartsWith(model, model_prefixes[i], |
| 235 base::CompareCase::INSENSITIVE_ASCII)) { | 236 base::CompareCase::INSENSITIVE_ASCII)) { |
| 236 return false; | 237 return false; |
| 237 } | 238 } |
| 238 } | 239 } |
| 239 | 240 |
| 240 return true; | 241 return true; |
| 241 } | 242 } |
| 242 | 243 |
| 244 // static |
| 245 bool MediaCodecUtil::CodecNeedsFlushWorkaround(MediaCodecBridge* codec) { |
| 246 int sdk_int = base::android::BuildInfo::GetInstance()->sdk_int(); |
| 247 std::string codec_name = codec->GetName(); |
| 248 return sdk_int < 18 || |
| 249 (sdk_int == 18 && ("OMX.SEC.avc.dec" == codec_name || |
| 250 "OMX.SEC.avc.dec.secure" == codec_name)) || |
| 251 (sdk_int == 19 && |
| 252 base::StartsWith(base::android::BuildInfo::GetInstance()->model(), |
| 253 "SM-G800", base::CompareCase::INSENSITIVE_ASCII) && |
| 254 ("OMX.Exynos.avc.dec" == codec_name || |
| 255 "OMX.Exynos.avc.dec.secure" == codec_name)); |
| 256 } |
| 257 |
| 243 } // namespace media | 258 } // namespace media |
| OLD | NEW |