Skip to content

Display and control your Android device

Do not create Device instance for camera

Romain Vimont45a073a33356
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);