Chromium Code Reviews| Index: media/base/android/media_codec_util.cc |
| diff --git a/media/base/android/media_codec_util.cc b/media/base/android/media_codec_util.cc |
| index 82efcc6341be70dcb4a355d0f9e0ddc8c2055de5..82f8b1da61e65889743583c934fe41e575ef3be6 100644 |
| --- a/media/base/android/media_codec_util.cc |
| +++ b/media/base/android/media_codec_util.cc |
| @@ -15,6 +15,7 @@ |
| #include "base/logging.h" |
| #include "base/strings/string_util.h" |
| #include "jni/MediaCodecUtil_jni.h" |
| +#include "media/base/android/media_codec_bridge.h" |
| #include "url/gurl.h" |
| using base::android::AttachCurrentThread; |
| @@ -65,16 +66,6 @@ static bool IsSupportedAndroidMimeType(const std::string& mime_type) { |
| supported.end(); |
| } |
| -static std::string GetDefaultCodecName(const std::string& mime_type, |
| - MediaCodecDirection direction) { |
| - DCHECK(MediaCodecUtil::IsMediaCodecAvailable()); |
| - JNIEnv* env = AttachCurrentThread(); |
| - ScopedJavaLocalRef<jstring> j_mime = ConvertUTF8ToJavaString(env, mime_type); |
| - ScopedJavaLocalRef<jstring> j_codec_name = |
| - Java_MediaCodecUtil_getDefaultCodecName(env, j_mime.obj(), direction); |
| - return ConvertJavaStringToUTF8(env, j_codec_name.obj()); |
| -} |
| - |
| static bool IsDecoderSupportedByDevice(const std::string& android_mime_type) { |
| DCHECK(MediaCodecUtil::IsMediaCodecAvailable()); |
| DCHECK(IsSupportedAndroidMimeType(android_mime_type)); |
| @@ -99,6 +90,17 @@ bool MediaCodecUtil::IsMediaCodecAvailable() { |
| } |
| // static |
| +std::string MediaCodecUtil::GetDefaultCodecName(const std::string& mime_type, |
|
DaleCurtis
2016/04/23 19:06:21
Is this even necessary if our blacklist really onl
|
| + MediaCodecDirection direction) { |
| + DCHECK(MediaCodecUtil::IsMediaCodecAvailable()); |
| + JNIEnv* env = AttachCurrentThread(); |
| + ScopedJavaLocalRef<jstring> j_mime = ConvertUTF8ToJavaString(env, mime_type); |
| + ScopedJavaLocalRef<jstring> j_codec_name = |
| + Java_MediaCodecUtil_getDefaultCodecName(env, j_mime.obj(), direction); |
| + return ConvertJavaStringToUTF8(env, j_codec_name.obj()); |
| +} |
| + |
| +// static |
| bool MediaCodecUtil::SupportsSetParameters() { |
| // MediaCodec.setParameters() is only available starting with K. |
| return base::android::BuildInfo::GetInstance()->sdk_int() >= 19; |
| @@ -229,4 +231,18 @@ bool MediaCodecUtil::IsSurfaceViewOutputSupported() { |
| "GT-I9300", base::CompareCase::INSENSITIVE_ASCII); |
| } |
| +// static |
| +bool MediaCodecUtil::CodecNeedsFlushWorkaround(MediaCodecBridge* codec) { |
| + int sdk_int = base::android::BuildInfo::GetInstance()->sdk_int(); |
| + std::string codec_name = codec->GetName(); |
| + return sdk_int < 18 || |
| + (sdk_int == 18 && ("OMX.SEC.avc.dec" == codec_name || |
| + "OMX.SEC.avc.dec.secure" == codec_name)) || |
| + (sdk_int == 19 && |
| + base::StartsWith(base::android::BuildInfo::GetInstance()->model(), |
| + "SM-G800", base::CompareCase::INSENSITIVE_ASCII) && |
|
qinmin
2016/04/25 22:44:58
This feels strange, so the same decoder works on o
watk
2016/04/25 22:53:53
Yeah, perhaps it happens on other devices too, but
qinmin
2016/04/25 23:07:39
Yes, we should blacklist for all other devices.
|
| + ("OMX.Exynos.avc.dec" == codec_name || |
| + "OMX.Exynos.avc.dec.secure" == codec_name)); |
| +} |
| + |
| } // namespace media |