Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(834)

Unified Diff: media/base/android/java/src/org/chromium/media/MediaCodecBridge.java

Issue 687683002: Modified MediaCodecBridge as per android API label 21. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698