From 792fd0e07bcef94e9ea93a7555d3d77e1151679c Mon Sep 17 00:00:00 2001 From: Ricky Chow Date: Wed, 29 Jan 2020 16:02:39 +1100 Subject: [PATCH 1/3] Added layerstack option --- app/src/cli.c | 23 +++++++++++++++++++ app/src/scrcpy.c | 1 + app/src/scrcpy.h | 2 ++ app/src/server.c | 4 ++++ app/src/server.h | 1 + .../java/com/genymobile/scrcpy/Options.java | 9 ++++++++ .../com/genymobile/scrcpy/ScreenEncoder.java | 8 +++---- .../java/com/genymobile/scrcpy/Server.java | 9 +++++--- 8 files changed, 50 insertions(+), 7 deletions(-) diff --git a/app/src/cli.c b/app/src/cli.c index d9e1013a0a..02bc831be4 100644 --- a/app/src/cli.c +++ b/app/src/cli.c @@ -41,6 +41,10 @@ scrcpy_print_usage(const char *arg0) { " -h, --help\n" " Print this help.\n" "\n" + " --layer-stack value\n" + " Specifies the Android layer stack to mirror\n" + " Default is 0\n" + "\n" " --max-fps value\n" " Limit the frame rate of screen capture (only supported on\n" " devices with Android >= 10).\n" @@ -259,6 +263,18 @@ parse_max_fps(const char *s, uint16_t *max_fps) { return true; } +static bool +parse_layer_stack(const char *s, uint16_t *layer_stack) { + long value; + bool ok = parse_integer_arg(s, &value, false, 0, 1000, "layer stack"); + if (!ok) { + return false; + } + + *layer_stack = (uint16_t) value; + return true; +} + static bool parse_window_position(const char *s, int16_t *position) { long value; @@ -340,6 +356,7 @@ guess_record_format(const char *filename) { #define OPT_WINDOW_HEIGHT 1010 #define OPT_WINDOW_BORDERLESS 1011 #define OPT_MAX_FPS 1012 +#define OPT_LAYER_STACK 1013 bool scrcpy_parse_args(struct scrcpy_cli_args *args, int argc, char *argv[]) { @@ -350,6 +367,7 @@ scrcpy_parse_args(struct scrcpy_cli_args *args, int argc, char *argv[]) { {"fullscreen", no_argument, NULL, 'f'}, {"help", no_argument, NULL, 'h'}, {"max-fps", required_argument, NULL, OPT_MAX_FPS}, + {"layer-stack", required_argument, NULL, OPT_LAYER_STACK}, {"max-size", required_argument, NULL, 'm'}, {"no-control", no_argument, NULL, 'n'}, {"no-display", no_argument, NULL, 'N'}, @@ -412,6 +430,11 @@ scrcpy_parse_args(struct scrcpy_cli_args *args, int argc, char *argv[]) { return false; } break; + case OPT_LAYER_STACK: + if (!parse_layer_stack(optarg, &opts->layer_stack)) { + return false; + } + break; case 'm': if (!parse_max_size(optarg, &opts->max_size)) { return false; diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c index 17be1ed415..707de0ef87 100644 --- a/app/src/scrcpy.c +++ b/app/src/scrcpy.c @@ -285,6 +285,7 @@ scrcpy(const struct scrcpy_options *options) { .bit_rate = options->bit_rate, .max_fps = options->max_fps, .control = options->control, + .layer_stack = options->layer_stack, }; if (!server_start(&server, options->serial, ¶ms)) { return false; diff --git a/app/src/scrcpy.h b/app/src/scrcpy.h index 75de8717f3..0710fb0b0d 100644 --- a/app/src/scrcpy.h +++ b/app/src/scrcpy.h @@ -32,6 +32,7 @@ struct scrcpy_options { bool render_expired_frames; bool prefer_text; bool window_borderless; + uint16_t layer_stack; }; #define SCRCPY_OPTIONS_DEFAULT { \ @@ -58,6 +59,7 @@ struct scrcpy_options { .render_expired_frames = false, \ .prefer_text = false, \ .window_borderless = false, \ + .layer_stack = 0, \ } bool diff --git a/app/src/server.c b/app/src/server.c index ff167aebcc..00a9d7de2c 100644 --- a/app/src/server.c +++ b/app/src/server.c @@ -124,9 +124,12 @@ execute_server(struct server *server, const struct server_params *params) { char max_size_string[6]; char bit_rate_string[11]; char max_fps_string[6]; + char layer_stack_string[6]; + sprintf(max_size_string, "%"PRIu16, params->max_size); sprintf(bit_rate_string, "%"PRIu32, params->bit_rate); sprintf(max_fps_string, "%"PRIu16, params->max_fps); + sprintf(layer_stack_string, "%"PRIu16, params->layer_stack); const char *const cmd[] = { "shell", "CLASSPATH=" DEVICE_SERVER_PATH, @@ -146,6 +149,7 @@ execute_server(struct server *server, const struct server_params *params) { params->crop ? params->crop : "-", "true", // always send frame meta (packet boundaries + timestamp) params->control ? "true" : "false", + layer_stack_string }; #ifdef SERVER_DEBUGGER LOGI("Server debugger waiting for a client on device port " diff --git a/app/src/server.h b/app/src/server.h index 0cb1ab3a6d..1e467d0f50 100644 --- a/app/src/server.h +++ b/app/src/server.h @@ -37,6 +37,7 @@ struct server_params { uint32_t bit_rate; uint16_t max_fps; bool control; + uint16_t layer_stack; }; // init default values diff --git a/server/src/main/java/com/genymobile/scrcpy/Options.java b/server/src/main/java/com/genymobile/scrcpy/Options.java index 5b993f3085..e7a2ee0f7d 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Options.java +++ b/server/src/main/java/com/genymobile/scrcpy/Options.java @@ -10,6 +10,7 @@ public class Options { private Rect crop; private boolean sendFrameMeta; // send PTS so that the client may record properly private boolean control; + private int layerStack; public int getMaxSize() { return maxSize; @@ -66,4 +67,12 @@ public boolean getControl() { public void setControl(boolean control) { this.control = control; } + + public int getLayerStack() { + return layerStack; + } + + public void setLayerStack(int layerStack) { + this.layerStack = layerStack; + } } diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java index c9a37f847b..8565cc4b12 100644 --- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java +++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java @@ -51,7 +51,7 @@ public boolean consumeRotationChange() { return rotationChanged.getAndSet(false); } - public void streamScreen(Device device, FileDescriptor fd) throws IOException { + public void streamScreen(Device device, FileDescriptor fd, int layerStack) throws IOException { Workarounds.prepareMainLooper(); Workarounds.fillAppInfo(); @@ -67,7 +67,7 @@ public void streamScreen(Device device, FileDescriptor fd) throws IOException { setSize(format, videoRect.width(), videoRect.height()); configure(codec, format); Surface surface = codec.createInputSurface(); - setDisplaySurface(display, surface, contentRect, videoRect); + setDisplaySurface(display, surface, contentRect, videoRect, layerStack); codec.start(); try { alive = encode(codec, fd); @@ -172,12 +172,12 @@ private static void setSize(MediaFormat format, int width, int height) { format.setInteger(MediaFormat.KEY_HEIGHT, height); } - private static void setDisplaySurface(IBinder display, Surface surface, Rect deviceRect, Rect displayRect) { + private static void setDisplaySurface(IBinder display, Surface surface, Rect deviceRect, Rect displayRect, int layerStack) { SurfaceControl.openTransaction(); try { SurfaceControl.setDisplaySurface(display, surface); SurfaceControl.setDisplayProjection(display, 0, deviceRect, displayRect); - SurfaceControl.setDisplayLayerStack(display, 0); + SurfaceControl.setDisplayLayerStack(display, layerStack); } finally { SurfaceControl.closeTransaction(); } diff --git a/server/src/main/java/com/genymobile/scrcpy/Server.java b/server/src/main/java/com/genymobile/scrcpy/Server.java index 56b738fbc7..ea291de923 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Server.java +++ b/server/src/main/java/com/genymobile/scrcpy/Server.java @@ -31,7 +31,7 @@ private static void scrcpy(Options options) throws IOException { try { // synchronous - screenEncoder.streamScreen(device, connection.getVideoFd()); + screenEncoder.streamScreen(device, connection.getVideoFd(), options.getLayerStack()); } catch (IOException e) { // this is expected on close Ln.d("Screen streaming stopped"); @@ -79,8 +79,8 @@ private static Options createOptions(String... args) { "The server version (" + clientVersion + ") does not match the client " + "(" + BuildConfig.VERSION_NAME + ")"); } - if (args.length != 8) { - throw new IllegalArgumentException("Expecting 8 parameters"); + if (args.length != 9) { + throw new IllegalArgumentException("Expecting 9 parameters"); } Options options = new Options(); @@ -107,6 +107,9 @@ private static Options createOptions(String... args) { boolean control = Boolean.parseBoolean(args[7]); options.setControl(control); + int layerStack = Integer.parseInt(args[8]); + options.setLayerStack(layerStack); + return options; } From 4afca06635fa03f7b50f7325cc2bccddb3e1aa7d Mon Sep 17 00:00:00 2001 From: Caleb Brown Date: Thu, 19 Mar 2020 12:38:05 +1100 Subject: [PATCH 2/3] Replace layout stack option with better device id option. This allows the correct geometry to be grabbed and the layout stack to be derived from the display info itself. --- app/src/cli.c | 18 +++++++++--------- app/src/scrcpy.c | 2 +- app/src/scrcpy.h | 4 ++-- app/src/server.c | 6 +++--- app/src/server.h | 2 +- .../java/com/genymobile/scrcpy/Device.java | 8 ++++---- .../com/genymobile/scrcpy/DisplayInfo.java | 14 +++++++++++++- .../java/com/genymobile/scrcpy/Options.java | 10 +++++----- .../com/genymobile/scrcpy/ScreenEncoder.java | 3 ++- .../java/com/genymobile/scrcpy/ScreenInfo.java | 10 ++++++++-- .../java/com/genymobile/scrcpy/Server.java | 6 +++--- .../scrcpy/wrappers/DisplayManager.java | 9 +++++++-- 12 files changed, 58 insertions(+), 34 deletions(-) diff --git a/app/src/cli.c b/app/src/cli.c index 02bc831be4..6875c24bc7 100644 --- a/app/src/cli.c +++ b/app/src/cli.c @@ -41,8 +41,8 @@ scrcpy_print_usage(const char *arg0) { " -h, --help\n" " Print this help.\n" "\n" - " --layer-stack value\n" - " Specifies the Android layer stack to mirror\n" + " --display-id value\n" + " Specifies the Android display to mirror\n" " Default is 0\n" "\n" " --max-fps value\n" @@ -264,14 +264,14 @@ parse_max_fps(const char *s, uint16_t *max_fps) { } static bool -parse_layer_stack(const char *s, uint16_t *layer_stack) { +parse_display_id(const char *s, uint16_t *display_id) { long value; - bool ok = parse_integer_arg(s, &value, false, 0, 1000, "layer stack"); + bool ok = parse_integer_arg(s, &value, false, 0, 1000, "display id"); if (!ok) { return false; } - *layer_stack = (uint16_t) value; + *display_id = (uint16_t) value; return true; } @@ -356,7 +356,7 @@ guess_record_format(const char *filename) { #define OPT_WINDOW_HEIGHT 1010 #define OPT_WINDOW_BORDERLESS 1011 #define OPT_MAX_FPS 1012 -#define OPT_LAYER_STACK 1013 +#define OPT_DISPLAY_ID 1013 bool scrcpy_parse_args(struct scrcpy_cli_args *args, int argc, char *argv[]) { @@ -367,7 +367,7 @@ scrcpy_parse_args(struct scrcpy_cli_args *args, int argc, char *argv[]) { {"fullscreen", no_argument, NULL, 'f'}, {"help", no_argument, NULL, 'h'}, {"max-fps", required_argument, NULL, OPT_MAX_FPS}, - {"layer-stack", required_argument, NULL, OPT_LAYER_STACK}, + {"display-id", required_argument, NULL, OPT_DISPLAY_ID}, {"max-size", required_argument, NULL, 'm'}, {"no-control", no_argument, NULL, 'n'}, {"no-display", no_argument, NULL, 'N'}, @@ -430,8 +430,8 @@ scrcpy_parse_args(struct scrcpy_cli_args *args, int argc, char *argv[]) { return false; } break; - case OPT_LAYER_STACK: - if (!parse_layer_stack(optarg, &opts->layer_stack)) { + case OPT_DISPLAY_ID: + if (!parse_display_id(optarg, &opts->display_id)) { return false; } break; diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c index 707de0ef87..41a253f163 100644 --- a/app/src/scrcpy.c +++ b/app/src/scrcpy.c @@ -285,7 +285,7 @@ scrcpy(const struct scrcpy_options *options) { .bit_rate = options->bit_rate, .max_fps = options->max_fps, .control = options->control, - .layer_stack = options->layer_stack, + .display_id = options->display_id, }; if (!server_start(&server, options->serial, ¶ms)) { return false; diff --git a/app/src/scrcpy.h b/app/src/scrcpy.h index 0710fb0b0d..28a3e76ac3 100644 --- a/app/src/scrcpy.h +++ b/app/src/scrcpy.h @@ -32,7 +32,7 @@ struct scrcpy_options { bool render_expired_frames; bool prefer_text; bool window_borderless; - uint16_t layer_stack; + uint16_t display_id; }; #define SCRCPY_OPTIONS_DEFAULT { \ @@ -59,7 +59,7 @@ struct scrcpy_options { .render_expired_frames = false, \ .prefer_text = false, \ .window_borderless = false, \ - .layer_stack = 0, \ + .display_id = 0, \ } bool diff --git a/app/src/server.c b/app/src/server.c index 00a9d7de2c..0280075acf 100644 --- a/app/src/server.c +++ b/app/src/server.c @@ -124,12 +124,12 @@ execute_server(struct server *server, const struct server_params *params) { char max_size_string[6]; char bit_rate_string[11]; char max_fps_string[6]; - char layer_stack_string[6]; + char display_id_string[6]; sprintf(max_size_string, "%"PRIu16, params->max_size); sprintf(bit_rate_string, "%"PRIu32, params->bit_rate); sprintf(max_fps_string, "%"PRIu16, params->max_fps); - sprintf(layer_stack_string, "%"PRIu16, params->layer_stack); + sprintf(display_id_string, "%"PRIu16, params->display_id); const char *const cmd[] = { "shell", "CLASSPATH=" DEVICE_SERVER_PATH, @@ -149,7 +149,7 @@ execute_server(struct server *server, const struct server_params *params) { params->crop ? params->crop : "-", "true", // always send frame meta (packet boundaries + timestamp) params->control ? "true" : "false", - layer_stack_string + display_id_string }; #ifdef SERVER_DEBUGGER LOGI("Server debugger waiting for a client on device port " diff --git a/app/src/server.h b/app/src/server.h index 1e467d0f50..68a8f3ea10 100644 --- a/app/src/server.h +++ b/app/src/server.h @@ -37,7 +37,7 @@ struct server_params { uint32_t bit_rate; uint16_t max_fps; bool control; - uint16_t layer_stack; + uint16_t display_id; }; // init default values diff --git a/server/src/main/java/com/genymobile/scrcpy/Device.java b/server/src/main/java/com/genymobile/scrcpy/Device.java index 9448098a5b..043cb41b1e 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Device.java +++ b/server/src/main/java/com/genymobile/scrcpy/Device.java @@ -26,7 +26,7 @@ public interface RotationListener { private RotationListener rotationListener; public Device(Options options) { - screenInfo = computeScreenInfo(options.getCrop(), options.getMaxSize()); + screenInfo = computeScreenInfo(options.getDisplayId(), options.getCrop(), options.getMaxSize()); registerRotationWatcher(new IRotationWatcher.Stub() { @Override public void onRotationChanged(int rotation) throws RemoteException { @@ -46,8 +46,8 @@ public synchronized ScreenInfo getScreenInfo() { return screenInfo; } - private ScreenInfo computeScreenInfo(Rect crop, int maxSize) { - DisplayInfo displayInfo = serviceManager.getDisplayManager().getDisplayInfo(); + private ScreenInfo computeScreenInfo(int displayId, Rect crop, int maxSize) { + DisplayInfo displayInfo = serviceManager.getDisplayManager().getDisplayInfo(displayId); boolean rotated = (displayInfo.getRotation() & 1) != 0; Size deviceSize = displayInfo.getSize(); Rect contentRect = new Rect(0, 0, deviceSize.getWidth(), deviceSize.getHeight()); @@ -64,7 +64,7 @@ private ScreenInfo computeScreenInfo(Rect crop, int maxSize) { } Size videoSize = computeVideoSize(contentRect.width(), contentRect.height(), maxSize); - return new ScreenInfo(contentRect, videoSize, rotated); + return new ScreenInfo(contentRect, videoSize, rotated, displayInfo.getLayerStack()); } private static String formatCrop(Rect rect) { diff --git a/server/src/main/java/com/genymobile/scrcpy/DisplayInfo.java b/server/src/main/java/com/genymobile/scrcpy/DisplayInfo.java index 639869b514..36651f145e 100644 --- a/server/src/main/java/com/genymobile/scrcpy/DisplayInfo.java +++ b/server/src/main/java/com/genymobile/scrcpy/DisplayInfo.java @@ -1,12 +1,20 @@ package com.genymobile.scrcpy; public final class DisplayInfo { + private final int displayId; private final Size size; private final int rotation; + private final int layerStack; - public DisplayInfo(Size size, int rotation) { + public DisplayInfo(int displayId, Size size, int rotation, int layerStack) { + this.displayId = displayId; this.size = size; this.rotation = rotation; + this.layerStack = layerStack; + } + + public int getDisplayId() { + return displayId; } public Size getSize() { @@ -16,5 +24,9 @@ public Size getSize() { public int getRotation() { return rotation; } + + public int getLayerStack() { + return layerStack; + } } diff --git a/server/src/main/java/com/genymobile/scrcpy/Options.java b/server/src/main/java/com/genymobile/scrcpy/Options.java index e7a2ee0f7d..34ef052f14 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Options.java +++ b/server/src/main/java/com/genymobile/scrcpy/Options.java @@ -10,7 +10,7 @@ public class Options { private Rect crop; private boolean sendFrameMeta; // send PTS so that the client may record properly private boolean control; - private int layerStack; + private int displayId; public int getMaxSize() { return maxSize; @@ -68,11 +68,11 @@ public void setControl(boolean control) { this.control = control; } - public int getLayerStack() { - return layerStack; + public int getDisplayId() { + return displayId; } - public void setLayerStack(int layerStack) { - this.layerStack = layerStack; + public void setDisplayId(int displayId) { + this.displayId = displayId; } } diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java index 8565cc4b12..c6285b111b 100644 --- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java +++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java @@ -51,7 +51,7 @@ public boolean consumeRotationChange() { return rotationChanged.getAndSet(false); } - public void streamScreen(Device device, FileDescriptor fd, int layerStack) throws IOException { + public void streamScreen(Device device, FileDescriptor fd) throws IOException { Workarounds.prepareMainLooper(); Workarounds.fillAppInfo(); @@ -64,6 +64,7 @@ public void streamScreen(Device device, FileDescriptor fd, int layerStack) throw IBinder display = createDisplay(); Rect contentRect = device.getScreenInfo().getContentRect(); Rect videoRect = device.getScreenInfo().getVideoSize().toRect(); + int layerStack = device.getScreenInfo().getLayerStack(); setSize(format, videoRect.width(), videoRect.height()); configure(codec, format); Surface surface = codec.createInputSurface(); diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenInfo.java b/server/src/main/java/com/genymobile/scrcpy/ScreenInfo.java index f2fce1d66b..65d0752037 100644 --- a/server/src/main/java/com/genymobile/scrcpy/ScreenInfo.java +++ b/server/src/main/java/com/genymobile/scrcpy/ScreenInfo.java @@ -6,11 +6,13 @@ public final class ScreenInfo { private final Rect contentRect; // device size, possibly cropped private final Size videoSize; private final boolean rotated; + private final int layerStack; - public ScreenInfo(Rect contentRect, Size videoSize, boolean rotated) { + public ScreenInfo(Rect contentRect, Size videoSize, boolean rotated, int layerStack) { this.contentRect = contentRect; this.videoSize = videoSize; this.rotated = rotated; + this.layerStack = layerStack; } public Rect getContentRect() { @@ -21,11 +23,15 @@ public Size getVideoSize() { return videoSize; } + public int getLayerStack() { + return layerStack; + } + public ScreenInfo withRotation(int rotation) { boolean newRotated = (rotation & 1) != 0; if (rotated == newRotated) { return this; } - return new ScreenInfo(Device.flipRect(contentRect), videoSize.rotate(), newRotated); + return new ScreenInfo(Device.flipRect(contentRect), videoSize.rotate(), newRotated, layerStack); } } diff --git a/server/src/main/java/com/genymobile/scrcpy/Server.java b/server/src/main/java/com/genymobile/scrcpy/Server.java index ea291de923..0869059269 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Server.java +++ b/server/src/main/java/com/genymobile/scrcpy/Server.java @@ -31,7 +31,7 @@ private static void scrcpy(Options options) throws IOException { try { // synchronous - screenEncoder.streamScreen(device, connection.getVideoFd(), options.getLayerStack()); + screenEncoder.streamScreen(device, connection.getVideoFd()); } catch (IOException e) { // this is expected on close Ln.d("Screen streaming stopped"); @@ -107,8 +107,8 @@ private static Options createOptions(String... args) { boolean control = Boolean.parseBoolean(args[7]); options.setControl(control); - int layerStack = Integer.parseInt(args[8]); - options.setLayerStack(layerStack); + int displayId = Integer.parseInt(args[8]); + options.setDisplayId(displayId); return options; } diff --git a/server/src/main/java/com/genymobile/scrcpy/wrappers/DisplayManager.java b/server/src/main/java/com/genymobile/scrcpy/wrappers/DisplayManager.java index 568afacd6f..afd2447210 100644 --- a/server/src/main/java/com/genymobile/scrcpy/wrappers/DisplayManager.java +++ b/server/src/main/java/com/genymobile/scrcpy/wrappers/DisplayManager.java @@ -13,14 +13,19 @@ public DisplayManager(IInterface manager) { } public DisplayInfo getDisplayInfo() { + return getDisplayInfo(0); + } + + public DisplayInfo getDisplayInfo(int displayId) { try { - Object displayInfo = manager.getClass().getMethod("getDisplayInfo", int.class).invoke(manager, 0); + Object displayInfo = manager.getClass().getMethod("getDisplayInfo", int.class).invoke(manager, displayId); Class cls = displayInfo.getClass(); // width and height already take the rotation into account int width = cls.getDeclaredField("logicalWidth").getInt(displayInfo); int height = cls.getDeclaredField("logicalHeight").getInt(displayInfo); int rotation = cls.getDeclaredField("rotation").getInt(displayInfo); - return new DisplayInfo(new Size(width, height), rotation); + int layerStack = cls.getDeclaredField("layerStack").getInt(displayInfo); + return new DisplayInfo(displayId, new Size(width, height), rotation, layerStack); } catch (Exception e) { throw new AssertionError(e); } From 56d6eeac4a0631d985249a7c763792f2a18ad999 Mon Sep 17 00:00:00 2001 From: Caleb Brown Date: Thu, 19 Mar 2020 12:45:06 +1100 Subject: [PATCH 3/3] Fix some broken whitespace --- server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java | 2 +- server/src/main/java/com/genymobile/scrcpy/ScreenInfo.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java index c6285b111b..9416417ff0 100644 --- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java +++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java @@ -64,7 +64,7 @@ public void streamScreen(Device device, FileDescriptor fd) throws IOException { IBinder display = createDisplay(); Rect contentRect = device.getScreenInfo().getContentRect(); Rect videoRect = device.getScreenInfo().getVideoSize().toRect(); - int layerStack = device.getScreenInfo().getLayerStack(); + int layerStack = device.getScreenInfo().getLayerStack(); setSize(format, videoRect.width(), videoRect.height()); configure(codec, format); Surface surface = codec.createInputSurface(); diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenInfo.java b/server/src/main/java/com/genymobile/scrcpy/ScreenInfo.java index 65d0752037..84f75ef5a3 100644 --- a/server/src/main/java/com/genymobile/scrcpy/ScreenInfo.java +++ b/server/src/main/java/com/genymobile/scrcpy/ScreenInfo.java @@ -12,7 +12,7 @@ public ScreenInfo(Rect contentRect, Size videoSize, boolean rotated, int layerSt this.contentRect = contentRect; this.videoSize = videoSize; this.rotated = rotated; - this.layerStack = layerStack; + this.layerStack = layerStack; } public Rect getContentRect() {