From 45a073a333564a3c596cfe4067de51bb339e8e2b Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Thu, 16 Nov 2023 09:02:52 +0100 Subject: [PATCH] Do not create Device instance for camera The device instance manages the display and the injection of input events. It is not necessary for camera capture. --- server/src/main/java/com/genymobile/scrcpy/Server.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/Server.java b/server/src/main/java/com/genymobile/scrcpy/Server.java index a1c6090b..61d3497b 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Server.java +++ b/server/src/main/java/com/genymobile/scrcpy/Server.java @@ -92,8 +92,6 @@ public final class Server { throw new ConfigurationException("Camera mirroring is not supported"); } - final Device device = new Device(options); - Thread initThread = startInitThread(options); int scid = options.getScid(); @@ -102,7 +100,9 @@ public final class Server { boolean video = options.getVideo(); boolean audio = options.getAudio(); boolean sendDummyByte = options.getSendDummyByte(); - boolean camera = options.getVideoSource() == VideoSource.CAMERA; + boolean camera = video && options.getVideoSource() == VideoSource.CAMERA; + + final Device device = camera ? null : new Device(options); Workarounds.apply(audio, camera);