Configure init and cleanup asynchronously
Accessing the settings (like --show-touches) on start should not delay screen mirroring. PR #2802 <https://github.com/Genymobile/scrcpy/pull/2802>
This commit is contained in:
parent
c29a0bf675
commit
ee93d2aac1
1 changed files with 13 additions and 1 deletions
|
@ -63,7 +63,7 @@ public final class Server {
|
||||||
final Device device = new Device(options);
|
final Device device = new Device(options);
|
||||||
List<CodecOption> codecOptions = CodecOption.parse(options.getCodecOptions());
|
List<CodecOption> codecOptions = CodecOption.parse(options.getCodecOptions());
|
||||||
|
|
||||||
initAndCleanUp(options);
|
Thread initThread = startInitThread(options);
|
||||||
|
|
||||||
boolean tunnelForward = options.isTunnelForward();
|
boolean tunnelForward = options.isTunnelForward();
|
||||||
|
|
||||||
|
@ -95,6 +95,7 @@ public final class Server {
|
||||||
// this is expected on close
|
// this is expected on close
|
||||||
Ln.d("Screen streaming stopped");
|
Ln.d("Screen streaming stopped");
|
||||||
} finally {
|
} finally {
|
||||||
|
initThread.interrupt();
|
||||||
if (controllerThread != null) {
|
if (controllerThread != null) {
|
||||||
controllerThread.interrupt();
|
controllerThread.interrupt();
|
||||||
}
|
}
|
||||||
|
@ -105,6 +106,17 @@ public final class Server {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Thread startInitThread(final Options options) {
|
||||||
|
Thread thread = new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
initAndCleanUp(options);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
thread.start();
|
||||||
|
return thread;
|
||||||
|
}
|
||||||
|
|
||||||
private static Thread startController(final Controller controller) {
|
private static Thread startController(final Controller controller) {
|
||||||
Thread thread = new Thread(new Runnable() {
|
Thread thread = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue