| Index: media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
|
| diff --git a/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java b/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
|
| index 399f355f8735a097267929ea42eb81ddb41ffda6..1f8443d10f4323eb70febffe380c6040cb58d4c2 100644
|
| --- a/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
|
| +++ b/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
|
| @@ -239,18 +239,35 @@ class MediaCodecBridge {
|
| */
|
| @CalledByNative
|
| private static int[] getEncoderColorFormatsForMime(String mime) {
|
| - int count = MediaCodecList.getCodecCount();
|
| - for (int i = 0; i < count; ++i) {
|
| - MediaCodecInfo info = MediaCodecList.getCodecInfoAt(i);
|
| - if (!info.isEncoder())
|
| + MediaCodecInfo[] codecs = null;
|
| + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
| + MediaCodecList mediaCodecList = new MediaCodecList(MediaCodecList.ALL_CODECS);
|
| + codecs = mediaCodecList.getCodecInfos();
|
| + } else {
|
| + int count = MediaCodecList.getCodecCount();
|
| + if (count <= 0) {
|
| + return null;
|
| + }
|
| + codecs = new MediaCodecInfo[count];
|
| + for (int i = 0; i < count; ++i) {
|
| + MediaCodecInfo info = MediaCodecList.getCodecInfoAt(i);
|
| + codecs[i] = info;
|
| + }
|
| + }
|
| +
|
| + for (int i = 0; i < codecs.length; i++) {
|
| + if (!codecs[i].isEncoder()) {
|
| continue;
|
| + }
|
|
|
| - String[] supportedTypes = info.getSupportedTypes();
|
| + String[] supportedTypes = codecs[i].getSupportedTypes();
|
| for (int j = 0; j < supportedTypes.length; ++j) {
|
| - if (!supportedTypes[j].equalsIgnoreCase(mime))
|
| + if (!supportedTypes[j].equalsIgnoreCase(mime)) {
|
| continue;
|
| + }
|
|
|
| - MediaCodecInfo.CodecCapabilities capabilities = info.getCapabilitiesForType(mime);
|
| + MediaCodecInfo.CodecCapabilities capabilities =
|
| + codecs[i].getCapabilitiesForType(mime);
|
| return capabilities.colorFormats;
|
| }
|
| }
|
|
|