From 3aac74e9e945c7fc71c5e54b3c53afe666707af7 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Thu, 2 Feb 2023 19:16:23 +0100 Subject: [PATCH] Move variable assignment Computing eof flag is not necessary if rotation changed. --- server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java index 07ea2d80..95f89ed5 100644 --- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java +++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java @@ -169,12 +169,13 @@ public class ScreenEncoder implements Device.RotationListener { while (!consumeRotationChange() && !eof) { int outputBufferId = codec.dequeueOutputBuffer(bufferInfo, -1); - eof = (bufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0; try { if (consumeRotationChange()) { // must restart encoding with new size break; } + + eof = (bufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0; if (outputBufferId >= 0) { ByteBuffer codecBuffer = codec.getOutputBuffer(outputBufferId);