Dump decoders before starting for logging purposes. Remove the software decoders from the blacklist since they are properly detected by the high profile check now.

This commit is contained in:
Cameron Gutman 2014-03-21 20:54:33 -04:00
parent 53474c7d28
commit 9857017b22

View File

@ -33,9 +33,9 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
static { static {
blacklistedDecoderPrefixes = new LinkedList<String>(); blacklistedDecoderPrefixes = new LinkedList<String>();
blacklistedDecoderPrefixes.add("omx.google");
// TI's decoder technically supports high profile but doesn't work for some reason
blacklistedDecoderPrefixes.add("omx.TI"); blacklistedDecoderPrefixes.add("omx.TI");
blacklistedDecoderPrefixes.add("AVCDecoder");
} }
static { static {
@ -61,33 +61,43 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
return false; return false;
} }
public static MediaCodecInfo findSafeDecoder() { public static void dumpDecoders() {
for (int i = 0; i < MediaCodecList.getCodecCount(); i++) { for (int i = 0; i < MediaCodecList.getCodecCount(); i++) {
MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i); MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i);
boolean badCodec = false;
// Skip encoders // Skip encoders
if (codecInfo.isEncoder()) { if (codecInfo.isEncoder()) {
continue; continue;
} }
for (String badPrefix : blacklistedDecoderPrefixes) { LimeLog.info("Decoder: "+codecInfo.getName());
String name = codecInfo.getName(); for (String type : codecInfo.getSupportedTypes()) {
if (name.length() >= badPrefix.length()) { LimeLog.info("\t"+type);
String prefix = name.substring(0, badPrefix.length()); CodecCapabilities caps = codecInfo.getCapabilitiesForType(type);
if (prefix.equalsIgnoreCase(badPrefix)) {
badCodec = true; for (CodecProfileLevel profile : caps.profileLevels) {
break; LimeLog.info("\t\t"+profile.profile+" "+profile.level);
}
} }
} }
}
}
if (badCodec) { public static MediaCodecInfo findSafeDecoder() {
LimeLog.info("Blacklisted decoder: "+codecInfo.getName()); for (int i = 0; i < MediaCodecList.getCodecCount(); i++) {
MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i);
// Skip encoders
if (codecInfo.isEncoder()) {
continue; continue;
} }
// Check for explicitly blacklisted decoders
if (isDecoderInList(blacklistedDecoderPrefixes, codecInfo.getName())) {
LimeLog.info("Skipping blacklisted decoder: "+codecInfo.getName());
continue;
}
// Find a decoder that supports H.264 high profile
for (String mime : codecInfo.getSupportedTypes()) { for (String mime : codecInfo.getSupportedTypes()) {
if (mime.equalsIgnoreCase("video/avc")) { if (mime.equalsIgnoreCase("video/avc")) {
LimeLog.info("Examining decoder capabilities of "+codecInfo.getName()); LimeLog.info("Examining decoder capabilities of "+codecInfo.getName());
@ -96,12 +106,13 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
for (CodecProfileLevel profile : caps.profileLevels) { for (CodecProfileLevel profile : caps.profileLevels) {
if (profile.profile == CodecProfileLevel.AVCProfileHigh) { if (profile.profile == CodecProfileLevel.AVCProfileHigh) {
LimeLog.info("Decoder "+codecInfo.getName()+" supports high profile"); LimeLog.info("Decoder "+codecInfo.getName()+" supports high profile");
return codecInfo; LimeLog.info("Selected decoder: "+codecInfo.getName());
return codecInfo;
}
}
} }
} }
} }
}
}
return null; return null;
} }
@ -110,6 +121,8 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
public void setup(int width, int height, int redrawRate, Object renderTarget, int drFlags) { public void setup(int width, int height, int redrawRate, Object renderTarget, int drFlags) {
this.redrawRate = redrawRate; this.redrawRate = redrawRate;
dumpDecoders();
MediaCodecInfo safeDecoder = findSafeDecoder(); MediaCodecInfo safeDecoder = findSafeDecoder();
if (safeDecoder != null) { if (safeDecoder != null) {
videoDecoder = MediaCodec.createByCodecName(safeDecoder.getName()); videoDecoder = MediaCodec.createByCodecName(safeDecoder.getName());