mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-01-20 06:04:26 +01:00
Use two sockets for video and control
The socket used the device-to-computer direction to stream the video and the computer-to-device direction to send control events. Some features, like copy-paste from device to computer, require to send non-video data from the device to the computer. To make them possible, use two sockets: - one for streaming the video from the device to the client; - one for control/events in both directions.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
#include "log.h"
|
||||
|
||||
bool
|
||||
controller_init(struct controller *controller, socket_t video_socket) {
|
||||
controller_init(struct controller *controller, socket_t control_socket) {
|
||||
cbuf_init(&controller->queue);
|
||||
|
||||
if (!(controller->mutex = SDL_CreateMutex())) {
|
||||
@@ -19,7 +19,7 @@ controller_init(struct controller *controller, socket_t video_socket) {
|
||||
return false;
|
||||
}
|
||||
|
||||
controller->video_socket = video_socket;
|
||||
controller->control_socket = control_socket;
|
||||
controller->stopped = false;
|
||||
|
||||
return true;
|
||||
@@ -57,7 +57,7 @@ process_event(struct controller *controller,
|
||||
if (!length) {
|
||||
return false;
|
||||
}
|
||||
int w = net_send_all(controller->video_socket, serialized_event, length);
|
||||
int w = net_send_all(controller->control_socket, serialized_event, length);
|
||||
return w == length;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user