Allow FFmpeg decoder on Waydroid

This commit is contained in:
Cameron Gutman
2022-09-17 14:51:03 -05:00
parent c72707aef9
commit c573d213f8
@@ -44,7 +44,8 @@ public class MediaCodecHelper {
private static final List<String> exynosDecoderPrefixes; private static final List<String> exynosDecoderPrefixes;
private static final List<String> amlogicDecoderPrefixes; private static final List<String> amlogicDecoderPrefixes;
public static final boolean IS_EMULATOR = Build.HARDWARE.equals("ranchu") || Build.HARDWARE.equals("cheets"); public static final boolean SHOULD_BYPASS_SOFTWARE_BLOCK =
Build.HARDWARE.equals("ranchu") || Build.HARDWARE.equals("cheets") || Build.BRAND.equals("Android-x86");
private static boolean isLowEndSnapdragon = false; private static boolean isLowEndSnapdragon = false;
private static boolean isAdreno620 = false; private static boolean isAdreno620 = false;
@@ -82,19 +83,19 @@ public class MediaCodecHelper {
static { static {
blacklistedDecoderPrefixes = new LinkedList<>(); blacklistedDecoderPrefixes = new LinkedList<>();
// Blacklist software decoders that don't support H264 high profile, // Blacklist software decoders that don't support H264 high profile except on systems
// but exclude the official AOSP and CrOS emulator from this restriction. // that are expected to only have software decoders (like emulators).
if (!IS_EMULATOR) { if (!SHOULD_BYPASS_SOFTWARE_BLOCK) {
blacklistedDecoderPrefixes.add("omx.google"); blacklistedDecoderPrefixes.add("omx.google");
blacklistedDecoderPrefixes.add("AVCDecoder"); blacklistedDecoderPrefixes.add("AVCDecoder");
}
// We want to avoid ffmpeg decoders since they're software decoders, // We want to avoid ffmpeg decoders since they're usually software decoders,
// but on Android-x86 they might be all we have (and also relatively // but we'll defer to the Android 10 isSoftwareOnly() API on newer devices
// performant on a modern x86 processor). // to determine if we should use these or not.
if (!Build.BRAND.equals("Android-x86")) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
blacklistedDecoderPrefixes.add("OMX.ffmpeg"); blacklistedDecoderPrefixes.add("OMX.ffmpeg");
} }
}
// Force these decoders disabled because: // Force these decoders disabled because:
// 1) They are software decoders, so the performance is terrible // 1) They are software decoders, so the performance is terrible
@@ -721,7 +722,7 @@ public class MediaCodecHelper {
private static boolean isCodecBlacklisted(MediaCodecInfo codecInfo) { private static boolean isCodecBlacklisted(MediaCodecInfo codecInfo) {
// Use the new isSoftwareOnly() function on Android Q // Use the new isSoftwareOnly() function on Android Q
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
if (!IS_EMULATOR && codecInfo.isSoftwareOnly()) { if (!SHOULD_BYPASS_SOFTWARE_BLOCK && codecInfo.isSoftwareOnly()) {
LimeLog.info("Skipping software-only decoder: "+codecInfo.getName()); LimeLog.info("Skipping software-only decoder: "+codecInfo.getName());
return true; return true;
} }