Initialize eof flag from BufferInfo

Stop encoding if the codec signaled the end of stream.

The eof flag was read, but never written.
This commit is contained in:
Romain Vimont 2018-02-28 15:40:52 +01:00
parent 221a7d0826
commit b61310a257
1 changed files with 1 additions and 0 deletions

View File

@ -89,6 +89,7 @@ public class ScreenEncoder implements Device.RotationListener {
MediaCodec.BufferInfo bufferInfo = new MediaCodec.BufferInfo();
while (!checkRotationChanged() && !eof) {
int outputBufferId = codec.dequeueOutputBuffer(bufferInfo, -1);
eof = (bufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0;
try {
if (checkRotationChanged()) {
// must restart encoding with new size