Reuse callback buffers

This commit is contained in:
Cameron Gutman 2017-05-18 13:37:02 -07:00
parent 3558655b72
commit 55f2e89bbe
2 changed files with 5 additions and 5 deletions

View File

@ -469,7 +469,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
@SuppressWarnings("deprecation")
@Override
public int submitDecodeUnit(byte[] frameData) {
public int submitDecodeUnit(byte[] frameData, int frameLength) {
totalFrames++;
long timestampUs = System.nanoTime() / 1000;
@ -594,7 +594,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
// The H264Utils.writeSPS function safely handles
// Annex B NALUs (including NALUs with escape sequences)
ByteBuffer escapedNalu = H264Utils.writeSPS(sps, frameData.length);
ByteBuffer escapedNalu = H264Utils.writeSPS(sps, frameLength);
buf.put(escapedNalu);
if (queueInputBuffer(inputBufferIndex,
@ -634,10 +634,10 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
}
// Copy data from our buffer list into the input buffer
buf.put(frameData);
buf.put(frameData, 0, frameLength);
if (!queueInputBuffer(inputBufferIndex,
0, frameData.length,
0, frameLength,
timestampUs, codecFlags)) {
return MoonBridge.DR_NEED_IDR;
}

@ -1 +1 @@
Subproject commit ea7e5975c30d35ea8b6d79f8fb1235b6d9467cc3
Subproject commit 525a8ac322129ee54d674da5d0a3518f6f56ef64