WebRTC streamer and vhost-user-input backend processes communicate with a client-server protocol - #3111
Merged
Merged
Conversation
jemoreira
enabled auto-merge
August 28, 2026 02:43
Databean
reviewed
Aug 31, 2026
Databean
approved these changes
Sep 2, 2026
jemoreira
force-pushed
the
input
branch
2 times, most recently
from
September 3, 2026 00:08
b865ed7 to
6889bce
Compare
jemoreira
disabled auto-merge
September 3, 2026 00:39
jemoreira
enabled auto-merge
September 3, 2026 19:22
Databean
approved these changes
Sep 3, 2026
The webRTC streamer can connect to a unix socket for each input device to inject input events and receive status feedback, in addition to the existing approach based on receiving the connection as an inherited file descriptor. The behavior is chosen base on command line flags passed by run_cvd. Bug: b/552079861
and implement it with the existing socket pair connected to stdin. Bug: b/552079861
The vhost-user-input process accepts a UNIX socket's fd via command line flag. When given, events are not read from stdin, but instead from clients connected to that unix socket. Multiple clients can connect at the same time and the server guarantees that each group of events ending in a SYN_REPORT event is delivered to the VMM atomically. Bug: b/552079861
webrtc connects to a unix socket hosted by vhu-input instead of through a socket pair inherited from run_cvd. run_cvd unconditionally enables this behavior, assuming that webRTC and cf_vhost_user_input are already substituted everywhere run_cvd is substituted. Bug: b/552079861
The frontend disconnects when crosvm restarts. If the restart was initiated by run_cvd, the event sources (webRTC) will reconnect to the corresponding server and everything works as intended. When the restart is started in the guest, for example with `adb reboot`, no reconnection occurs and input stopped working. By keeping the same event source for all frontend connections, the existing connections with webRTC are maintained. Bug: b/554190370
github-merge-queue
Bot
removed this pull request from the merge queue due to no response for status checks
Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cf_vhost_user_inputlistens on a UNIX socket server it inherits fromrun_cvd.webRTCconnects to this server to inject input events (mouse, touch, keyboard, etc) to the device backends. This enables the input backend to receive events from sources outside the streamer process.In addition to the protocol change, the device backend ensures all groups of events sent to the guest driver end in a
SYN_REPORT. TheseSYN_REPORTevents are used to group events from multiple sources so that the driver receives a valid flow of events.The behavior is enabled by run_cvd by the flags it launches
webRTCandcf_vhost_user_inputwith. When therun_cvdbinary is not substituted, events are sent via a socket pair as before. It would be a problem ifrun_cvdwas substituted butwebRTCorcf_vhost_user_inputwas not, but this situation is extremely unlikely since the latter have been substituted for a while now.Bug: b/552079861