From a7979e4e74a7fdc1bb63b07bc0ecbcb262a0df4a Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Thu, 1 Mar 2018 17:14:54 +0100 Subject: [PATCH] Rename rotation detection method name The old name checkRotationChanged() did not suggest that the flag was reset. --- .../src/main/java/com/genymobile/scrcpy/ScreenEncoder.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java index 41989148..47992f55 100644 --- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java +++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java @@ -49,7 +49,7 @@ public class ScreenEncoder implements Device.RotationListener { rotationChanged.set(true); } - public boolean checkRotationChanged() { + public boolean consumeRotationChange() { return rotationChanged.getAndSet(false); } @@ -87,11 +87,11 @@ public class ScreenEncoder implements Device.RotationListener { byte[] buf = new byte[bitRate / 8]; // may contain up to 1 second of video boolean eof = false; MediaCodec.BufferInfo bufferInfo = new MediaCodec.BufferInfo(); - while (!checkRotationChanged() && !eof) { + while (!consumeRotationChange() && !eof) { int outputBufferId = codec.dequeueOutputBuffer(bufferInfo, -1); eof = (bufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0; try { - if (checkRotationChanged()) { + if (consumeRotationChange()) { // must restart encoding with new size break; }