From 4c8d433b6c549c8f302516f90cd473b5e893e6d1 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 3 Dec 2018 18:15:51 -0800 Subject: [PATCH] Always use the new L+ releaseOutputBuffer() to gain drop support on L --- .../binding/video/MediaCodecDecoderRenderer.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/limelight/binding/video/MediaCodecDecoderRenderer.java b/app/src/main/java/com/limelight/binding/video/MediaCodecDecoderRenderer.java index 0f945ba7..7cc40a83 100644 --- a/app/src/main/java/com/limelight/binding/video/MediaCodecDecoderRenderer.java +++ b/app/src/main/java/com/limelight/binding/video/MediaCodecDecoderRenderer.java @@ -405,10 +405,17 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer { } // Render the last buffer - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !legacyFrameDropRendering) { - // Use a PTS that will cause this frame to never be dropped if frame dropping - // is disabled - videoDecoder.releaseOutputBuffer(lastIndex, 0); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + if (legacyFrameDropRendering) { + // Use a PTS that will cause this frame to be dropped if another comes in within + // the same V-sync period + videoDecoder.releaseOutputBuffer(lastIndex, System.nanoTime()); + } + else { + // Use a PTS that will cause this frame to never be dropped if frame dropping + // is disabled + videoDecoder.releaseOutputBuffer(lastIndex, 0); + } } else { videoDecoder.releaseOutputBuffer(lastIndex, true);