The Bridge in One Operating Model

The useful test of scrcpy is not whether its video, input, and cleanup features work in isolation. It is whether a person can look at one real session and understand which state it is in, which channel carries the current work, which latency budget matters, and which boundary may explain the next failure. This chapter connects the lifecycle, the independent media paths, and the input choices into that operating model, then uses it to expose the next architectural question: what changes when audio and recording join the bridge?

One session has several owners and transitions

Consider a person using scrcpy over USB to demonstrate an Android application from a desktop. Before a picture can appear, the host has selected and authorized one device, prepared an ADB route, pushed a matching temporary server, and waited for the application sockets to become usable. Once the video channel is active, the Android side captures and encodes display changes while the host demuxes and decodes them. When the person clicks or types, the event does not travel backward through the video stream; it enters the control path, where Android interprets it as input. When the session ends, transport closure and device-state restoration are separate parts of the ending.

That is one stateful bridge, not a pile of features. The preparation state belongs mainly to the host and ADB. The connected state begins when the matching Android server has opened the requested application endpoints and the host has received enough metadata to initialize them. Streaming belongs to the media workers. Control becomes active when the host can turn events into messages and the Android controller can act on them. Adaptation can interrupt video when display dimensions change or an encoder rejects a request. Closing stops workers and sockets; cleanup then removes the temporary server and restores settings that the session changed.

The transition triggers are as important as the names. A device authorization failure prevents the bridge from leaving preparation. A successful ADB forward does not necessarily mean the application server is listening, so the host uses a readiness signal before accepting the endpoint. A version mismatch stops the connection because the client and server share an internal protocol rather than negotiating a common subset. A display rotation or resize changes the video session and can require new dimensions and coordinate mapping. A user close or device disconnection moves the session toward shutdown, even though the path to cleanup differs in how much of the device remains reachable.

The state view prevents a common category error: assuming that a visible window proves that every part of scrcpy is healthy. A video stream can be working while the chosen input mode is rejected by an OEM permission. A control-only session can be useful without any video decoder. Audio can be unavailable while video continues. A recorder can consume encoded packets even when no playback window is shown. The session's state is therefore a combination of active components and their transitions, not one global “connected” flag.