Add new virtio-media V4l2 stream virtual device - #2935
Open
bridadan wants to merge 2 commits into
Open
Conversation
ser-io
requested changes
Jul 30, 2026
ser-io
left a comment
Member
There was a problem hiding this comment.
Let's avoid forking emulated_camera_mplane as the first commit, it makes the second commit very hard to review. Feel free to introduce the new device in the first commit.
ser-io
requested changes
Jul 30, 2026
ser-io
requested changes
Jul 30, 2026
ser-io
requested changes
Jul 30, 2026
ser-io
requested changes
Jul 30, 2026
This adds the implementation of the v4l2_stream_proxy device, which reads from a FIFO and behaves as a virtio-media device. It also adds the necessary configuration and flags to support custom stream parameters (width, height, fps, source). worker_thread_loop in v4l2_stream_proxy uses nix::poll and nix::sys::eventfd to wait for both FIFO data and control signals (Stop/BufferQueued) without busy looping or sleeping. Bug: 472497998
Adds TestV4l2StreamProxyCompliance to e2e tests, which: 1. Creates a FIFO on the host. 2. Starts a goroutine to write dummy YUV420M frames to the FIFO. 3. Launches CVD with v4l2_stream_proxy pointing to the FIFO. 4. Finds the video node in the guest. 5. Runs v4l2-compliance on the guest. Bug: 472497998
ser-io
requested changes
Jul 31, 2026
| @@ -0,0 +1,1152 @@ | |||
| // Copyright 2026, The Android Open Source Project | |||
Member
There was a problem hiding this comment.
Similiar to f62529f. Let's have the first commit with the code of new Rust binary only.
The vhost user binaries could be attached to any crosvm VM instance, so it's ok to have the first commit only with code related to the vhost user binary.
Then, we can have the next commit integrating "cvd" with the new v4l2_stream_proxy binary.
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.
This PR introduces the
v4l2_streamdevice, avhost-user-mediabackend that enables streaming video from a host-side source (via a FIFO/named pipe) into a guest VM using thevirtio-mediaprotocol.It allows video data generated on the host (e.g., from a video file, synthetic test source, or any other producer of raw video frames) to be streamed directly into the guest VM's V4L2 framework.
The first commit copies over the
emulated_camera_mplanecrate into the newv4l2_streamcrate, and includes minimal changes to get it building and launchable. The second commit modifies the new crate with the new functionality.b/472497998