From 018d0ab679a3b1e184bb83579fa5b0ef18e3a7f8 Mon Sep 17 00:00:00 2001 From: Roberto Viola Date: Wed, 30 Oct 2024 10:21:56 +0100 Subject: [PATCH] Update ScreenEncoder.java --- .../java/org/cagnulein/android_remote/ScreenEncoder.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/src/main/java/org/cagnulein/android_remote/ScreenEncoder.java b/server/src/main/java/org/cagnulein/android_remote/ScreenEncoder.java index 2731161..5e322ae 100644 --- a/server/src/main/java/org/cagnulein/android_remote/ScreenEncoder.java +++ b/server/src/main/java/org/cagnulein/android_remote/ScreenEncoder.java @@ -75,12 +75,18 @@ private static void setSize(MediaFormat format, int width, int height) { } private static void setDisplaySurface(IBinder display, Surface surface, Rect deviceRect, Rect displayRect) { + Ln.d("setDisplaySurface 1"); SurfaceControl.openTransaction(); try { + Ln.d("setDisplaySurface 2"); SurfaceControl.setDisplaySurface(display, surface); + Ln.d("setDisplaySurface 3"); SurfaceControl.setDisplayProjection(display, 0, deviceRect, displayRect); + Ln.d("setDisplaySurface 4"); SurfaceControl.setDisplayLayerStack(display, 0); + Ln.d("setDisplaySurface 5"); } finally { + Ln.d("setDisplaySurface 6"); SurfaceControl.closeTransaction(); } } @@ -134,7 +140,9 @@ public void streamScreen(Device device, OutputStream outputStream) throws IOExce try { boolean secure = Build.VERSION.SDK_INT < Build.VERSION_CODES.R || (Build.VERSION.SDK_INT == Build.VERSION_CODES.R && !"S".equals( Build.VERSION.CODENAME)); + Ln.d("Creating display..."); display = createDisplay("scrcpy", secure); + Ln.d("Display created " + display.toString()); setDisplaySurface(display, surface, deviceRect, videoRect); Ln.d("Display: using SurfaceControl API"); } catch (Exception surfaceControlException) {