Commit 7665571f by hoangtc Committed by Oliver Woodman

Do not copy data to output frame in libvpx unless necessary.

In out libvpx extension, currently we always call vpxGetFrame and copy the data
from the native decoder to output frame. However, if the inputBuffer has
isDecoderOnly set, we can avoid populating the output buffer, but only setting
BUFFER_FLAG_DECODE_ONLY.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170318527
parent 60de1574
...@@ -120,14 +120,16 @@ import java.nio.ByteBuffer; ...@@ -120,14 +120,16 @@ import java.nio.ByteBuffer;
} }
} }
outputBuffer.init(inputBuffer.timeUs, outputMode); if (!inputBuffer.isDecodeOnly()) {
int getFrameResult = vpxGetFrame(vpxDecContext, outputBuffer); outputBuffer.init(inputBuffer.timeUs, outputMode);
if (getFrameResult == 1) { int getFrameResult = vpxGetFrame(vpxDecContext, outputBuffer);
outputBuffer.addFlag(C.BUFFER_FLAG_DECODE_ONLY); if (getFrameResult == 1) {
} else if (getFrameResult == -1) { outputBuffer.addFlag(C.BUFFER_FLAG_DECODE_ONLY);
return new VpxDecoderException("Buffer initialization failed."); } else if (getFrameResult == -1) {
return new VpxDecoderException("Buffer initialization failed.");
}
outputBuffer.colorInfo = inputBuffer.colorInfo;
} }
outputBuffer.colorInfo = inputBuffer.colorInfo;
return null; return null;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment