| 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 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 break; | 196 break; |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 } | 199 } |
| 200 DVLOG(1) << __PRETTY_FUNCTION__ << "Default codec for " << mime_type << " : " | 200 DVLOG(1) << __PRETTY_FUNCTION__ << "Default codec for " << mime_type << " : " |
| 201 << codec_name; | 201 << codec_name; |
| 202 // It would be nice if MediaCodecInfo externalized some notion of | 202 // It would be nice if MediaCodecInfo externalized some notion of |
| 203 // HW-acceleration but it doesn't. Android Media guidance is that the | 203 // HW-acceleration but it doesn't. Android Media guidance is that the |
| 204 // "OMX.google" prefix is always used for SW decoders, so that's what we | 204 // "OMX.google" prefix is always used for SW decoders, so that's what we |
| 205 // use. "OMX.SEC.*" codec is Samsung software implementation - report it | 205 // use. "OMX.SEC.*" codec is Samsung software implementation - report it |
| 206 // as unaccelerated as well. Also temporary blacklist Exynos and MediaTek | 206 // as unaccelerated as well. MediaTek hardware vp8 is known slower than |
| 207 // devices while HW decoder video freezes and distortions are | 207 // the software implementation. http://crbug.com/446974. |
| 208 // investigated - http://crbug.com/446974. | |
| 209 if (codec_name.length() > 0) { | 208 if (codec_name.length() > 0) { |
| 210 return (base::StartsWith(codec_name, "OMX.google.", | 209 return base::StartsWith(codec_name, "OMX.google.", |
| 211 base::CompareCase::SENSITIVE) || | 210 base::CompareCase::SENSITIVE) || |
| 212 base::StartsWith(codec_name, "OMX.SEC.", | 211 base::StartsWith(codec_name, "OMX.SEC.", |
| 213 base::CompareCase::SENSITIVE) || | 212 base::CompareCase::SENSITIVE) || |
| 214 base::StartsWith(codec_name, "OMX.MTK.", | 213 (base::StartsWith(codec_name, "OMX.MTK.", |
| 215 base::CompareCase::SENSITIVE) || | 214 base::CompareCase::SENSITIVE) && |
| 216 base::StartsWith(codec_name, "OMX.Exynos.", | 215 mime_type == "video/x-vnd.on2.vp8"); |
| 217 base::CompareCase::SENSITIVE)); | |
| 218 } | 216 } |
| 219 return true; | 217 return true; |
| 220 } | 218 } |
| 221 | 219 |
| 222 // static | 220 // static |
| 223 bool MediaCodecUtil::IsHLSPath(const GURL& url) { | 221 bool MediaCodecUtil::IsHLSPath(const GURL& url) { |
| 224 if (!url.SchemeIsHTTPOrHTTPS() && !url.SchemeIsFile()) | 222 if (!url.SchemeIsHTTPOrHTTPS() && !url.SchemeIsFile()) |
| 225 return false; | 223 return false; |
| 226 | 224 |
| 227 std::string path = url.path(); | 225 std::string path = url.path(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 248 // static | 246 // static |
| 249 bool MediaCodecUtil::IsVp8DecoderAvailable() { | 247 bool MediaCodecUtil::IsVp8DecoderAvailable() { |
| 250 if (!IsMediaCodecAvailable()) | 248 if (!IsMediaCodecAvailable()) |
| 251 return false; | 249 return false; |
| 252 | 250 |
| 253 JNIEnv* env = AttachCurrentThread(); | 251 JNIEnv* env = AttachCurrentThread(); |
| 254 ScopedJavaLocalRef<jstring> j_mime = ConvertUTF8ToJavaString(env, "vp8"); | 252 ScopedJavaLocalRef<jstring> j_mime = ConvertUTF8ToJavaString(env, "vp8"); |
| 255 return Java_MediaCodecUtil_isDecoderSupportedForDevice(env, j_mime.obj()); | 253 return Java_MediaCodecUtil_isDecoderSupportedForDevice(env, j_mime.obj()); |
| 256 } | 254 } |
| 257 | 255 |
| 256 // static |
| 257 bool MediaCodecUtil::IsVp8EncoderAvailable() { |
| 258 // Currently the vp8 encoder and decoder blacklists cover the same devices, |
| 259 // but we have a second method for clarity in future issues. |
| 260 return IsVp8DecoderAvailable(); |
| 261 } |
| 262 |
| 258 } // namespace media | 263 } // namespace media |
| OLD | NEW |