Add a workaround for the Nexus 9 dropping frames with the new renderer

This commit is contained in:
Cameron Gutman
2015-03-16 21:26:02 -04:00
parent 42c65f4f16
commit 7ce29e3a09
2 changed files with 34 additions and 5 deletions
@@ -26,7 +26,16 @@ public class MediaCodecHelper {
private static final List<String> spsFixupBitstreamFixupDecoderPrefixes;
private static final List<String> whitelistedAdaptiveResolutionPrefixes;
private static final List<String> baselineProfileHackPrefixes;
private static final List<String> fastOutputPollPrefixes;
private static final int FAST_OUTPUT_POLL_US = 3; // 3 us
private static final int NORMAL_OUTPUT_POLL_US = 50000; // 50 ms
static {
fastOutputPollPrefixes = new LinkedList<String>();
fastOutputPollPrefixes.add("omx.nvidia");
}
static {
preferredDecoders = new LinkedList<String>();
}
@@ -97,6 +106,20 @@ public class MediaCodecHelper {
return false;
}
public static int getOptimalOutputBufferDequeueTimeout(String decoderName, MediaCodecInfo decoderInfo) {
// This concept of "fast output polling" is a workaround for certain devices that are powerful enough
// that the governor overzealously reduces the clockspeed of the CPU enough that it causes frames to be
// lost. This (at least) affects the Denver Tegra K1 running Android 5.0. To simplify things, I've simply
// set all Tegra devices to use fast polling.
if (isDecoderInList(fastOutputPollPrefixes, decoderName)) {
LimeLog.info("Decoder "+decoderName+" requires fast output polling");
return FAST_OUTPUT_POLL_US;
}
else {
return NORMAL_OUTPUT_POLL_US;
}
}
public static boolean decoderNeedsSpsBitstreamRestrictions(String decoderName, MediaCodecInfo decoderInfo) {
return isDecoderInList(spsFixupBitstreamFixupDecoderPrefixes, decoderName);