Skip to content

Display and control your Android device

Move Workarounds call

Romain Vimontbdbf1f4eb7da
diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
index f0384e2c..c7f886b4 100644
--- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
+++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
@@ -67,17 +67,6 @@ public class ScreenEncoder implements Device.RotationListener {
}
public void streamScreen(Device device, FileDescriptor fd) throws IOException {
- Workarounds.prepareMainLooper();
- if (Build.BRAND.equalsIgnoreCase("meizu")) {
- // <https://github.com/Genymobile/scrcpy/issues/240>
- // <https://github.com/Genymobile/scrcpy/issues/2656>
- Workarounds.fillAppInfo();
- }
-
- internalStreamScreen(device, fd);
- }
-
- private void internalStreamScreen(Device device, FileDescriptor fd) throws IOException {
MediaCodec codec = createCodec(encoderName);
MediaFormat format = createFormat(bitRate, maxFps, codecOptions);
IBinder display = createDisplay();
diff --git a/server/src/main/java/com/genymobile/scrcpy/Server.java b/server/src/main/java/com/genymobile/scrcpy/Server.java
index dc14d7c9..06281223 100644
--- a/server/src/main/java/com/genymobile/scrcpy/Server.java
+++ b/server/src/main/java/com/genymobile/scrcpy/Server.java
@@ -71,6 +71,13 @@ public final class Server {
boolean control = options.getControl();
boolean sendDummyByte = options.getSendDummyByte();
+ Workarounds.prepareMainLooper();
+ if (Build.BRAND.equalsIgnoreCase("meizu")) {
+ // <https://github.com/Genymobile/scrcpy/issues/240>
+ // <https://github.com/Genymobile/scrcpy/issues/2656>
+ Workarounds.fillAppInfo();
+ }
+
try (DesktopConnection connection = DesktopConnection.open(uid, tunnelForward, control, sendDummyByte)) {
if (options.getSendDeviceMeta()) {
Size videoSize = device.getScreenInfo().getVideoSize();