diff --git a/server/src/main/java/com/genymobile/scrcpy/Options.java b/server/src/main/java/com/genymobile/scrcpy/Options.java index 236a93d7..9210b318 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Options.java +++ b/server/src/main/java/com/genymobile/scrcpy/Options.java @@ -23,6 +23,7 @@ public class Options { private boolean downsizeOnError = true; // Options not used by the scrcpy client, but useful to use scrcpy-server directly + private boolean sendDeviceMeta = true; // send device name and size private boolean sendFrameMeta = true; // send PTS so that the client may record properly public Ln.Level getLogLevel() { @@ -153,6 +154,14 @@ public class Options { this.downsizeOnError = downsizeOnError; } + public boolean getSendDeviceMeta() { + return sendDeviceMeta; + } + + public void setSendDeviceMeta(boolean sendDeviceMeta) { + this.sendDeviceMeta = sendDeviceMeta; + } + public boolean getSendFrameMeta() { return sendFrameMeta; } diff --git a/server/src/main/java/com/genymobile/scrcpy/Server.java b/server/src/main/java/com/genymobile/scrcpy/Server.java index e690a45b..20fd1c1b 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Server.java +++ b/server/src/main/java/com/genymobile/scrcpy/Server.java @@ -68,8 +68,10 @@ public final class Server { boolean control = options.getControl(); try (DesktopConnection connection = DesktopConnection.open(tunnelForward, control)) { - Size videoSize = device.getScreenInfo().getVideoSize(); - connection.sendDeviceMeta(Device.getDeviceName(), videoSize.getWidth(), videoSize.getHeight()); + if (options.getSendDeviceMeta()) { + Size videoSize = device.getScreenInfo().getVideoSize(); + connection.sendDeviceMeta(Device.getDeviceName(), videoSize.getWidth(), videoSize.getHeight()); + } ScreenEncoder screenEncoder = new ScreenEncoder(options.getSendFrameMeta(), options.getBitRate(), options.getMaxFps(), codecOptions, options.getEncoderName(), options.getDownsizeOnError()); @@ -238,6 +240,10 @@ public final class Server { boolean downsizeOnError = Boolean.parseBoolean(value); options.setDownsizeOnError(downsizeOnError); break; + case "send_device_meta": + boolean sendDeviceMeta = Boolean.parseBoolean(value); + options.setSendDeviceMeta(sendDeviceMeta); + break; case "send_frame_meta": boolean sendFrameMeta = Boolean.parseBoolean(value); options.setSendFrameMeta(sendFrameMeta);