Set the output buffer position/limit only if it's non-null.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127196797
This commit is contained in:
andrewlewis 2016-07-12 07:19:28 -07:00 committed by Oliver Woodman
parent d4d1640808
commit acef34a6f3

View File

@ -822,8 +822,10 @@ public abstract class MediaCodecRenderer extends Renderer {
// The dequeued buffer is a media buffer. Do some initial setup. The buffer will be // The dequeued buffer is a media buffer. Do some initial setup. The buffer will be
// processed by calling processOutputBuffer (possibly multiple times) below. // processed by calling processOutputBuffer (possibly multiple times) below.
ByteBuffer outputBuffer = outputBuffers[outputIndex]; ByteBuffer outputBuffer = outputBuffers[outputIndex];
if (outputBuffer != null) {
outputBuffer.position(outputBufferInfo.offset); outputBuffer.position(outputBufferInfo.offset);
outputBuffer.limit(outputBufferInfo.offset + outputBufferInfo.size); outputBuffer.limit(outputBufferInfo.offset + outputBufferInfo.size);
}
shouldSkipOutputBuffer = shouldSkipOutputBuffer(outputBufferInfo.presentationTimeUs); shouldSkipOutputBuffer = shouldSkipOutputBuffer(outputBufferInfo.presentationTimeUs);
} }
} else if (outputIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED /* (-2) */) { } else if (outputIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED /* (-2) */) {