Add new virtio-media V4l2 stream virtual device - #2935
Open
bridadan wants to merge 4 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
bridadan
force-pushed
the
v4l2_stream
branch
3 times, most recently
from
July 31, 2026 19:48
0d284fd to
752ec67
Compare
ser-io
requested changes
Jul 31, 2026
The previous implementation of the send_events function used all but one descriptor because the iterator was advanced through the entire collection of descriptors. Then only one descriptor is released back. This limits the throughput for devices and makes them more susceptible to jitter due to system load. This implementation only advances the descriptor iterator by one, leaving the rest unused. Bug: 472497998 Assisted-by: Jetski:Gemini 3.5 Flash
bridadan
force-pushed
the
v4l2_stream
branch
2 times, most recently
from
August 3, 2026 16:53
fc32f68 to
4bdd8f5
Compare
ser-io
requested changes
Aug 3, 2026
bridadan
commented
Aug 3, 2026
added 3 commits
August 4, 2026 11:32
This adds the implementation of the v4l2_stream_proxy device, which reads from a FIFO and behaves as a virtio-media device. 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 Assisted-by: Jetski:Gemini 3.5 Flash
This adds all of the necessary flags and configuration to launch the v4l2_stream_proxy virtual device from the cvd cli. Bug: 472497998 Assisted-by: Jetski:Gemini 3.5 Flash
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 Assisted-by: Jetski:Gemini 3.5 Flash
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