Skip to content

WebRTC streamer and vhost-user-input backend processes communicate with a client-server protocol - #3111

Open
jemoreira wants to merge 6 commits into
google:mainfrom
jemoreira:input
Open

WebRTC streamer and vhost-user-input backend processes communicate with a client-server protocol#3111
jemoreira wants to merge 6 commits into
google:mainfrom
jemoreira:input

Conversation

@jemoreira

Copy link
Copy Markdown
Member

cf_vhost_user_input listens on a UNIX socket server it inherits from run_cvd. webRTC connects 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. These SYN_REPORT events 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 webRTC and cf_vhost_user_input with. When the run_cvd binary is not substituted, events are sent via a socket pair as before. It would be a problem if run_cvd was substituted but webRTC or cf_vhost_user_input was not, but this situation is extremely unlikely since the latter have been substituted for a while now.

Bug: b/552079861

@jemoreira
jemoreira requested a review from Databean August 28, 2026 02:38
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant