Avoid OMX.qti.audio.decoder.flac

Unfortunately devices such as the MI 8 do not provide an alternative
working decoder. Some Vivo devices do provide one though.

PiperOrigin-RevId: 288911897
This commit is contained in:
olly 2020-01-09 17:28:05 +00:00 committed by Oliver Woodman
parent 4e767faa1c
commit 91d9405416

View File

@ -566,7 +566,9 @@ public final class MediaCodecUtil {
}
return 0;
});
} else if (Util.SDK_INT < 21 && decoderInfos.size() > 1) {
}
if (Util.SDK_INT < 21 && decoderInfos.size() > 1) {
String firstCodecName = decoderInfos.get(0).name;
if ("OMX.SEC.mp3.dec".equals(firstCodecName)
|| "OMX.SEC.MP3.Decoder".equals(firstCodecName)
@ -578,6 +580,15 @@ public final class MediaCodecUtil {
sortByScore(decoderInfos, decoderInfo -> decoderInfo.name.startsWith("OMX.google") ? 1 : 0);
}
}
if (Util.SDK_INT < 30 && decoderInfos.size() > 1) {
String firstCodecName = decoderInfos.get(0).name;
// Prefer anything other than OMX.qti.audio.decoder.flac on older devices. See [Internal
// ref: b/147278539] and [Internal ref: b/147354613].
if ("OMX.qti.audio.decoder.flac".equals(firstCodecName)) {
decoderInfos.add(decoderInfos.remove(0));
}
}
}
/**