mirror of
https://github.com/androidx/media.git
synced 2025-05-07 23:50:44 +08:00
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
This commit is contained in:
parent
60de157410
commit
7665571ff9
@ -120,14 +120,16 @@ import java.nio.ByteBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
outputBuffer.init(inputBuffer.timeUs, outputMode);
|
||||
int getFrameResult = vpxGetFrame(vpxDecContext, outputBuffer);
|
||||
if (getFrameResult == 1) {
|
||||
outputBuffer.addFlag(C.BUFFER_FLAG_DECODE_ONLY);
|
||||
} else if (getFrameResult == -1) {
|
||||
return new VpxDecoderException("Buffer initialization failed.");
|
||||
if (!inputBuffer.isDecodeOnly()) {
|
||||
outputBuffer.init(inputBuffer.timeUs, outputMode);
|
||||
int getFrameResult = vpxGetFrame(vpxDecContext, outputBuffer);
|
||||
if (getFrameResult == 1) {
|
||||
outputBuffer.addFlag(C.BUFFER_FLAG_DECODE_ONLY);
|
||||
} else if (getFrameResult == -1) {
|
||||
return new VpxDecoderException("Buffer initialization failed.");
|
||||
}
|
||||
outputBuffer.colorInfo = inputBuffer.colorInfo;
|
||||
}
|
||||
outputBuffer.colorInfo = inputBuffer.colorInfo;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user