control: false
Before 1.22, scrcpy protocol always has two sockets: one for video, one for control message.
In 1.22, when control
is false
, the control socket will no longer be created.
It's a breaking change we must support if we want to use control: false
Potential changes:
send_frame_meta: false
Not sending frame metadata is actually the default behavior in ancient versions. The video socket only contains raw H.264 streams.
In a later version the server will send pts
and packet size preceding each packet, and this option was added to maintain backward compatibility.
pts
is useful for recording, to avoid incorrect frame time due to encoding and transmitting delay variation. But mirroring always renders the latest frame on arrival, so pts
is not required.
However, the video socket is not always one H.264 stream. When device screen rotates, video size will change, and a new H.264 stream with new size replaces the old one.
Checking pts == 0
can detect such stream restarts, parse video encoding/size, and re-initialize decoder. In theory, I can also parse the whole stream to find restarts, but that will be super complicate (I need to implement all H.264 protocol) and inefficient (parse whole stream twice). So send_frame_meta: false
can't be supported before finding an alternate method for detecting stream restarts.
Potential changes:
None
send_device_meta: false
The video socket begins with 64 bytes of device name, 4 bytes of video width and 4 bytes of video height. It's independent with send_frame_meta
option.
My implementation doesn't need this, so it's possible to remove them.
Potential changes:
send_dummy_byte: false
In forward connection mode (scrcpy client connects to scrcpy server, when tunnel_forward: true
), server will sends a 0
to video socket to signal ready.
send_dummy_byte: false
disables this behavior.
Because tunnel_forward: true
is only required when a Android 8 or earlier device is connected via ADB over WiFi, and this only removes one byte, I don't think it's meaningful to support this option by add more logic here.
Potential changes:
None