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 package org.chromium.media; | 5 package org.chromium.media; |
6 | 6 |
7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
8 import android.media.MediaCodec; | 8 import android.media.MediaCodec; |
9 import android.media.MediaCodecInfo; | 9 import android.media.MediaCodecInfo; |
10 import android.media.MediaCodecList; | 10 import android.media.MediaCodecList; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 * Some devices cannot decode certain codecs, while other codecs work fine. | 232 * Some devices cannot decode certain codecs, while other codecs work fine. |
233 * @param mime MIME type as passed to mediaCodec.createDecoderByType(mime). | 233 * @param mime MIME type as passed to mediaCodec.createDecoderByType(mime). |
234 * @return true if this codec is supported for decoder on this device. | 234 * @return true if this codec is supported for decoder on this device. |
235 */ | 235 */ |
236 @CalledByNative | 236 @CalledByNative |
237 static boolean isDecoderSupportedForDevice(String mime) { | 237 static boolean isDecoderSupportedForDevice(String mime) { |
238 // ************************************************************* | 238 // ************************************************************* |
239 // *** DO NOT ADD ANY NEW CODECS WITHOUT UPDATING MIME_UTIL. *** | 239 // *** DO NOT ADD ANY NEW CODECS WITHOUT UPDATING MIME_UTIL. *** |
240 // ************************************************************* | 240 // ************************************************************* |
241 if (mime.equals("video/x-vnd.on2.vp8")) { | 241 if (mime.equals("video/x-vnd.on2.vp8")) { |
| 242 // Only support VP8 on Android versions where we don't have to synch
ronously |
| 243 // tear down the MediaCodec on surface destruction because VP8 requi
res us to |
| 244 // completely drain the decoder before releasing it, which is diffic
ult and |
| 245 // time consuming to do while the surface is being destroyed. |
| 246 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) retu
rn false; |
| 247 |
242 if (Build.MANUFACTURER.toLowerCase(Locale.getDefault()).equals("sams
ung")) { | 248 if (Build.MANUFACTURER.toLowerCase(Locale.getDefault()).equals("sams
ung")) { |
243 // Some Samsung devices cannot render VP8 video directly to the
surface. | 249 // Some Samsung devices cannot render VP8 video directly to the
surface. |
244 | 250 |
245 // Samsung Galaxy S4. | 251 // Samsung Galaxy S4. |
246 // Only GT-I9505G with Android 4.3 and SPH-L720 (Sprint) with An
droid 5.0.1 | 252 // Only GT-I9505G with Android 4.3 and SPH-L720 (Sprint) with An
droid 5.0.1 |
247 // were tested. Only the first device has the problem. | 253 // were tested. Only the first device has the problem. |
248 // We blacklist popular Samsung Galaxy S4 models before Android
L. | 254 // We blacklist popular Samsung Galaxy S4 models before Android
L. |
249 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP | 255 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP |
250 && (Build.MODEL.startsWith("GT-I9505") | 256 && (Build.MODEL.startsWith("GT-I9505") |
251 || Build.MODEL.startsWith("GT-I9500"))) { | 257 || Build.MODEL.startsWith("GT-I9500"))) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 MediaCodecInfo.CodecCapabilities capabilities = info.getCapabilities
ForType(mime); | 350 MediaCodecInfo.CodecCapabilities capabilities = info.getCapabilities
ForType(mime); |
345 return (capabilities != null) | 351 return (capabilities != null) |
346 && capabilities.isFeatureSupported( | 352 && capabilities.isFeatureSupported( |
347 MediaCodecInfo.CodecCapabilities.FEATURE_Adaptive
Playback); | 353 MediaCodecInfo.CodecCapabilities.FEATURE_Adaptive
Playback); |
348 } catch (IllegalArgumentException e) { | 354 } catch (IllegalArgumentException e) { |
349 Log.e(TAG, "Cannot retrieve codec information", e); | 355 Log.e(TAG, "Cannot retrieve codec information", e); |
350 } | 356 } |
351 return false; | 357 return false; |
352 } | 358 } |
353 } | 359 } |
OLD | NEW |