From b61310a25749dca717b0eed90620e6853e9f09c7 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Wed, 28 Feb 2018 15:40:52 +0100 Subject: [PATCH] Initialize eof flag from BufferInfo Stop encoding if the codec signaled the end of stream. The eof flag was read, but never written. --- server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java | 1 + 1 file changed, 1 insertion(+) diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java index 6aa0c276..41989148 100644 --- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java +++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java @@ -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