mirror of
https://github.com/Droid-VM/crosvm.git
synced 2026-11-17 06:58:03 +00:00
Groundwork for a virtio-media capture device: the guest will want a V4L2 node, and on Android the only camera a VMM can reach is Camera2 through the NDK. This crate is that side of it -- enumerate, negotiate a format, stream buffers, and expose the controls that have V4L2 equivalents (zoom, flash/torch, autofocus mode, frame-rate range). Nothing in crosvm references it yet; the device that will is not written. Three things have to be true before a bare process gets a single frame, and none of them reports an error when it is false. There must be a binder threadpool -- the NDK's callbacks arrive over binder, and without one the capture session is created, accepted, and delivers zero frames with no error at all. The process must look like a foreground app to `cameraserver`, which resolves the client package from the REAL uid and finds none for uid 0, so `probe.rs` takes `--uid` and drops the same way the audio backend does. And the uid it drops to must hold CAMERA permission; enumeration works without it, which is what makes the failure look like a format problem rather than a permission one. `camera_probe` exists because those failure modes are invisible from the inside. It answers in one run whether the NDK loads, whether cameraserver accepts this uid, what each camera claims, whether frames arrive, in what layout, whether the pixels are real rather than a black or frozen buffer, and whether the controls take effect. Measured on sm8650: 29.45 fps NV21 at 1280x720. |
History
|
|
|---|---|---|
| .. | ||
| src | ||
| Android.bp | ||
| Cargo.toml | ||