Display and control your Android device
Update DEVELOP after recent refactorings
Romain Vimont0125af1e46ae
diff --git a/DEVELOP.md b/DEVELOP.mdindex 38c9c63e..ba9e130b 100644--- a/DEVELOP.md+++ b/DEVELOP.md@@ -76,6 +76,9 @@ The server uses 2 threads:- the **main** thread, encoding and streaming the video to the client;- the **controller** thread, listening for _control events_ (typically,keyboard and mouse events) from the client.+ - the **receiver** thread (managed by the controller), sending _device events_+ to the clients (currently, it is only used to send the device clipboard+ content).Since the video encoding is typically hardware, there would be no benefit inencoding and streaming in two different threads.@@ -114,12 +117,12 @@ https://github.com/Genymobile/scrcpy/blob/v1.8/server/src/main/java/com/genymobi### Input events injection_Control events_ are received from the client by the [`EventController`] (run in-a separate thread). There are 5 types of input events:+a separate thread). There are several types of input events:- keycode (cf [`KeyEvent`]),- text (special characters may not be handled by keycodes directly),- mouse motion/click,- mouse scroll,- - custom command (e.g. to switch the screen on).+ - other commands (e.g. to switch the screen on or to copy the clipboard).All of them may need to inject input events to the system. To do so, they usethe _hidden_ method [`InputManager.injectInputEvent`] (exposed by our@@ -146,8 +149,8 @@ The video stream is decoded by [libav] (FFmpeg).### InitializationOn startup, in addition to _libav_ and _SDL_ initialization, the client must-push and start the server on the device, and open a socket so that they may-communicate.+push and start the server on the device, and open two sockets (one for the video+stream, one for control) so that they may communicate.Note that the client-server roles are expressed at the application level:@@ -180,12 +183,14 @@ the connection from the server (see commit [90a46b4]).### Threading-The client uses 3 threads:+The client uses 4 threads:- the **main** thread, executing the SDL event loop,- the **stream** thread, receiving the video and used for decoding andrecording,- the **controller** thread, sending _control events_ to the server.+ - the **receiver** thread (managed by the controller), receiving _device+ events_ from the client.In addition, another thread can be started if necessary to handle APKinstallation or file push requests (via drag&drop on the main window).@@ -235,9 +240,8 @@ in a separate thread, to avoid I/O on the main thread.On SDL event, received on the main thread, the [input manager][inputmanager]creates appropriate [_control events_][controlevent]. It is responsible toconvert SDL events to Android events (using [convert]). It pushes the _control-events_ to a blocking queue hold by the controller. On its own thread, the-controller takes events from the queue, that it serializes and sends to the-client.+events_ to a queue hold by the controller. On its own thread, the controller+takes events from the queue, that it serializes and sends to the client.[controller]: https://github.com/Genymobile/scrcpy/blob/v1.8/app/src/controller.h[controlevent]: https://github.com/Genymobile/scrcpy/blob/v1.8/app/src/control_event.h