Fixup num_ref_frames in SPS on Qualcomm devices to (hopefully) fix the crashing video bug on the Galaxy S3 after Android 4.3

This commit is contained in:
Cameron Gutman 2014-06-26 20:03:12 -07:00
parent 0d35ea5207
commit faa82ca9d6

View File

@ -44,6 +44,7 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
spsFixupNumRefFixupDecoderPrefixes = new LinkedList<String>();
spsFixupNumRefFixupDecoderPrefixes.add("omx.TI");
spsFixupNumRefFixupDecoderPrefixes.add("omx.qcom");
}
private static boolean isDecoderInList(List<String> 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.