Add dynamic V4L2 test pattern controls to emulated_camera_mplane#2845
Add dynamic V4L2 test pattern controls to emulated_camera_mplane#2845changyeon-jo wants to merge 7 commits into
Conversation
8515fd4 to
09bda08
Compare
5591022 to
2e26171
Compare
d6069c2 to
78b00e3
Compare
ser-io
left a comment
There was a problem hiding this comment.
Please move commit: "Implement real-time FFmpeg host video streaming for emulated_camera_mplane" into its own PR.
Also, create a brand new virtio-media device for video streaming. Don't extend emulated_camera_mplane for this.
|
Re:
I can separate FFmpeg commit from PR. Re:
May I ask why you prefer having this in separate device? IMHO, it's also "emulating" a camera data stream from a media source and therefore does not sound out of this device's scope. If you intend to make this as the one strictly generating test patterns, shouldn't we need to rename this like "test_pattern_generator_mplane" or something similar? :) |
Cuttlefish attaches virtio-media devices using vhost-user protocol, which allows the flexibility to have device emulation per host process. Having said that, the case for streaming emulated frames and using FFmpeg for host video streaming are quite different in terms of how the frames are populated which present a case for different binaries. Given we already have the vhost-user protocol in place, it's cleaner to have two different binaries with their own specific flags. The current name emulated_camera_mplane is based on existing EmulatedCamera which this device aims to replace. |
e5be4b9 to
5f9e6e7
Compare
Format pre-existing files inside `emulated_camera_mplane` to comply with the standard Rust formatting style. This eliminates formatting noise in subsequent functional commits. Bug: b/490699808 Bug: b/502639876
Declare the trait-based `FramePattern` interface inside `src/pattern/mod.rs`. This trait defines the interface for dynamically writing multi-planar YUV video frames into queued virtio-media buffers. This first commit adds the trait definitions and registers the pattern module in the build system as a standalone declaration. Bug: b/490699808 Bug: b/502639876
Implement the color-cycling `Pulse` pattern inside `src/pattern/pulse.rs`. Refactor the internal `write_pattern` helper inside `device.rs` to call the `CameraPattern::Pulse` abstraction instead of hardcoding YUV loop math. Bug: b/490699808 Bug: b/502639876
Introduce the V4L2 controls to allow runtime switching of emulated camera test patterns. Wires up: - V4L2_CID_IMAGE_PROC_CLASS - V4L2_CID_TEST_PATTERN Exposes these controls via standard query and control ioctl handlers, including querymenu and control change event subscriptions. Only Pattern 0 (Pulse) is selectable in this commit. Bug: b/490699808 Bug: b/502639876
Implement the color-bar SMPTE Bars test pattern with an animated inverse-color bouncing box overlay inside `src/pattern/smpte.rs`. Register it in the `pattern` module and expand `device.rs` V4L2 control ranges and query menus to support selecting index 1. Bug: b/490699808 Bug: b/502639876
Implement the CPU-intensive animated Julia Set fractal pattern inside `src/pattern/julia_set.rs`. Register it in the `pattern` module and expand `device.rs` V4L2 control ranges and query menus to support selecting index 2. Bug: b/490699808 Bug: b/502639876
Introduce a static startup baseline timestamp initialized on backend boot, and align all buffer presentation timestamps to be offsets from this baseline. This aligns with host-side video clock models and prevents clock drift issues inside the Android guest. Bug: b/490699808 Bug: b/502639876
5f9e6e7 to
5325a81
Compare
|
Thanks for explanation, @ser-io. Since this replaces the camera framework team's EmulateCamera, it sounds like you're aiming to emulate the Android camera device's attributes and characteristics, rather than just the data stream. Do you plan to support FULL or LEVEL_3? :) Also, will this device's characteristics be configurable similar to hardware/google/camera/devices/EmulatedCamera/hwl/configs/emu_camera_back.json? |
Implement support for dynamic video test patterns and their associated
V4L2 control handlers. Supported patterns include:
inverse-color bouncing box overlay, adapted for the 3-sink layout and
640x480 resolution.
for high-load host load scenarios.
Supports V4L2_CID_TEST_PATTERN and V4L2_CID_IMAGE_PROC_CLASS via the
VirtioMediaIoctlHandler implementation.
Bug: b/490699808