cvd: Pass lens_facing to v4l2_stream_proxy and support single-media fleets - #3136
Open
changyeon-jo wants to merge 2 commits into
Open
cvd: Pass lens_facing to v4l2_stream_proxy and support single-media fleets#3136changyeon-jo wants to merge 2 commits into
changyeon-jo wants to merge 2 commits into
Conversation
changyeon-jo
force-pushed
the
cvd_multi_instance_media
branch
from
September 3, 2026 21:56
d943d6e to
2e384b6
Compare
- Pass the configured lens_facing string (e.g. FRONT, BACK, EXTERNAL) from MediaConfig to the v4l2_stream_proxy process on startup, matching the behavior of emulated_camera_mplane and emulated_camera_splane. - Add FlagsParserTest.ParseMediaV4l2StreamProxy verifying that v4l2_stream_proxy configurations including lens_facing are parsed and serialized into --media flags correctly.
- Add 'instance' property to --media flags and MediaConfig, allowing media devices to target a specific instance index in multi-device fleets. - Update cf_media_configs.cpp to allow multi-instance fleets where a single instance has media configured (has_media_count <= 1), and serialize the target instance index (:instance=<i>) when launching fleets. - Update media.cpp to validate that input_path and input_fps are not empty. - Update assemble_cvd/flags.cc to assign media configs only to the targeted instance matching config.instance_index. - Add unit tests in flags_parser_test.cc verifying multi-instance single-media fleet JSON parsing (targeting instance 1 and instance 0) and rejecting multiple media instances in a fleet. Bug: b/520098369
changyeon-jo
force-pushed
the
cvd_multi_instance_media
branch
from
September 3, 2026 22:01
2e384b6 to
5262fa5
Compare
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.
Summary
This PR adds multi-instance fleet configuration support for media devices, routes media configurations to specific targeted instances, and passes
lens_facingtov4l2_stream_proxy. It is split into two commits:Commit 1 (
run_cvd: Pass lens_facing to v4l2_stream_proxy on launch):run_cvd/launch/vhost_user_media_devices.cppto passconfig.lens_facingtov4l2_stream_proxyon startup, wiring up the driver option added in vhost_user_media: Add lens facing control, worker POLLHUP handling, and shmem_unmap fix #3121.FlagsParserTest.ParseMediaV4l2StreamProxyinflags_parser_test.ccverifying that single-instancev4l2_stream_proxyconfigurations withlens_facing(e.g.BACK) are correctly parsed and serialized into--mediaflags.Commit 2 (
cvd: Support single-media fleets and route configs to targeted instances):instanceproperty to--mediaflags andMediaConfig, allowing media devices to target a specific instance index in multi-device fleets without making assumptions about device types.cf_media_configs.cppto allow multi-instance fleets where a single instance has media configured (has_media_count <= 1), and serializes the target instance index (:instance=<i>) when launching fleets (cfg.instances().size() > 1).input_pathandinput_fpsviaCF_EXPECTinhost/libs/config/media.cpp(addressing review feedback from vhost_user_media: Add lens facing control, worker POLLHUP handling, and shmem_unmap fix #3121).assemble_cvd/flags.ccto assign media configs only to the targeted instance matchingconfig.instance_index.flags_parser_test.cc:ParseMediaMultiInstanceSingleMedia: verifies multi-instance single-media fleet JSON parsing targeting instance 1.ParseMediaMultiInstanceFirstInstanceMedia: verifies multi-instance single-media fleet JSON parsing targeting instance 0.ParseMediaMultiInstanceMultipleMediaFails: verifies boundary check that multiple media instances in a fleet are rejected.Follow-up to / spun off from: #3121
Bug: b/520098369
Testing
bazel test //cuttlefish/host/commands/cvd/cli/parser:flags_parser_test(Passed, 35/35 tests across both test suites)bazel build //cuttlefish/host/commands/assemble_cvd:assemble_cvd //cuttlefish/host/commands/run_cvd:run_cvd(Passed)