From b53d2c66e0549d434b187f39f3a7d71e27e64a79 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Fri, 27 Jan 2023 22:39:28 +0100 Subject: [PATCH] Remove useless setSize() method Inline its content. It makes the logic of internalStreamScreen() more readable (it reduces the number of indirections). --- .../main/java/com/genymobile/scrcpy/ScreenEncoder.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java index 5688c385..023b676f 100644 --- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java +++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java @@ -84,13 +84,16 @@ public class ScreenEncoder implements Device.RotationListener { do { ScreenInfo screenInfo = device.getScreenInfo(); Rect contentRect = screenInfo.getContentRect(); + // include the locked video orientation Rect videoRect = screenInfo.getVideoSize().toRect(); + format.setInteger(MediaFormat.KEY_WIDTH, videoRect.width()); + format.setInteger(MediaFormat.KEY_HEIGHT, videoRect.height()); + // does not include the locked video orientation Rect unlockedVideoRect = screenInfo.getUnlockedVideoSize().toRect(); int videoRotation = screenInfo.getVideoRotation(); int layerStack = device.getLayerStack(); - setSize(format, videoRect.width(), videoRect.height()); Surface surface = null; try { @@ -279,11 +282,6 @@ public class ScreenEncoder implements Device.RotationListener { return SurfaceControl.createDisplay("scrcpy", secure); } - private static void setSize(MediaFormat format, int width, int height) { - format.setInteger(MediaFormat.KEY_WIDTH, width); - format.setInteger(MediaFormat.KEY_HEIGHT, height); - } - private static void setDisplaySurface(IBinder display, Surface surface, int orientation, Rect deviceRect, Rect displayRect, int layerStack) { SurfaceControl.openTransaction(); try {