audio_streams, snd: Add stream start and stop Add start() and stop() lifecycle methods to AsyncCaptureBufferStream and CaptureBufferReader traits, and invoke them in the virtio-snd PCM capture worker loop upon WorkerStatus transitions. Currently, AsyncCaptureBufferStream only exposes next_capture_buffer(), with no explicit mechanism to start or stop the underlying audio stream upon guest PCM state changes (such as VIRTIO_SND_R_PCM_START and VIRTIO_SND_R_PCM_STOP). This change: 1. Adds start() and stop() methods with default Ok(()) implementations to AsyncCaptureBufferStream in audio_streams, including blanket implementations for &mut S. start() and stop() are synchronous and must return promptly; they must not wait for external events such as a permission prompt. 2. Extends CaptureBufferReader in device_virtio_snd with start() and stop(), forwarding calls in UnixBufferReader and WinBufferReader. 3. Adds CaptureStreamState and update_capture_stream_state() to pcm_worker_loop, invoking buffer_reader.start() and buffer_reader.stop() on WorkerStatus transitions without holding status_mutex across an await. 4. Implements start() and stop() on android_audio's AudioStream, invoking AAudioStream_requestStart() and AAudioStream_requestStop(). 5. Adds AAudioStream_requestStop() to AAudio FFI and libaaudio_stub. 6. Gates android_audio with cfg(any(target_os = "android", feature = "libaaudio_stub")) to preserve cross-platform builds. BUG=b:553670496 TEST=tools/dev_container cargo test -p device_virtio_snd TEST=tools/dev_container cargo test -p android_audio --features libaaudio_stub TEST=tools/dev_container ./tools/presubmit all Change-Id: I3976f3c8a92a71c3b112da5dc914d933aa3c54ad Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/8400152 Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org> Reviewed-by: Mu-Le Lee <mulelee@google.com> Reviewed-by: Norman Bintang <normanbt@chromium.org> Commit-Queue: Cassie Wang <cassiewang@google.com>
The ChromeOS Virtual Machine Monitor
crosvm is a secure, lightweight, and performant Virtual Machine Monitor (VMM) written in Rust. Originally developed for ChromeOS to run Linux (Crostini) and Android guests (ARCVM). It is now used across multiple products and platforms such as TerminalApp on Android, Cuttlefish and Windows.
crosvm focuses on security through strong isolation and a modern, memory-safe implementation. It leverages hardware-assisted virtualization to provide a robust execution environment for untrusted code.
io_uring, vhost, and an internal async runtime (cros_async).crosvm implements a wide range of paravirtualized devices via the virtio standard:
virtio-net with optional vhost and slirp backends.virtio-block supporting raw, qcow2, zstd, and Android sparse formats.virtio-gpu with 2D and 3D acceleration (via virglrenderer, gfxstream, or vulkano).virtio-snd with backends for CRAS (ChromeOS), AAudio (Android), and more.virtio-fs and virtio-9p.crosvm is designed with a “process-per-device” model:
forked into its own process.The recommended way to build and develop crosvm is using the provided development container.
Use the dev container to build a release version of crosvm:
./tools/dev_container ./tools/build_release
Follow this example usage to run a simple Linux guest.
#crosvm channel on Matrix.crosvm is an open-source project licensed under the BSD-3-Clause License.