From faa82ca9d6fae41dad7e8c4746b624e4de624755 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 26 Jun 2014 20:03:12 -0700 Subject: [PATCH] Fixup num_ref_frames in SPS on Qualcomm devices to (hopefully) fix the crashing video bug on the Galaxy S3 after Android 4.3 --- .../limelight/binding/video/MediaCodecDecoderRenderer.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/com/limelight/binding/video/MediaCodecDecoderRenderer.java b/src/com/limelight/binding/video/MediaCodecDecoderRenderer.java index 8b7fd3ed..9e4c1770 100644 --- a/src/com/limelight/binding/video/MediaCodecDecoderRenderer.java +++ b/src/com/limelight/binding/video/MediaCodecDecoderRenderer.java @@ -44,6 +44,7 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer { spsFixupNumRefFixupDecoderPrefixes = new LinkedList(); spsFixupNumRefFixupDecoderPrefixes.add("omx.TI"); + spsFixupNumRefFixupDecoderPrefixes.add("omx.qcom"); } private static boolean isDecoderInList(List decoderList, String decoderName) { @@ -166,7 +167,7 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer { int outIndex = videoDecoder.dequeueOutputBuffer(info, 0); if (outIndex >= 0) { int lastIndex = outIndex; - + // Get the last output buffer in the queue while ((outIndex = videoDecoder.dequeueOutputBuffer(info, 0)) >= 0) { videoDecoder.releaseOutputBuffer(lastIndex, false); @@ -234,7 +235,7 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer { if (needsSpsNumRefFixup) { LimeLog.info("Fixing up num ref frames"); this.replace(header, 80, 9, new byte[] {0x40}, 3); - } + } // The SPS that comes in the current H264 bytestream doesn't set bitstream_restriction_flag // or max_dec_frame_buffering which increases decoding latency on Tegra.