Skip to content

Commit

Permalink
Implement virtio-snd aaudio stream to support audio in android
Browse files Browse the repository at this point in the history
This change introduces feature audio_aaudio on top of the support of
virtio-snd-multiple-backend. The android_audio uses the Android
AAudio NDK library to play audio. A libaaudio_stub is provided for
building and testing on non-android environment.

Bug=b:325930215
Test=Play Youtube video on panther
Test=./tools/dev_container
Test=cargo build
Test=cargo build -F audio_aaudio,libaaudio_stub
Test=./tools/run_tests
Test=./tools/presubmit

Change-Id: I7c275433bf94d4a347720ce0ffa9127ffcb66a1e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5556704
Reviewed-by: Jiyong Park <[email protected]>
Reviewed-by: Frederick Mayle <[email protected]>
Auto-Submit: Mu-Le Lee <[email protected]>
Commit-Queue: Mu-Le Lee <[email protected]>
Reviewed-by: Chih-Yang Hsia <[email protected]>
  • Loading branch information
s094392 authored and crosvm LUCI committed May 31, 2024
1 parent 4ec0d1e commit ec39c30
Show file tree
Hide file tree
Showing 10 changed files with 502 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ codegen-units = 1
members = [
"aarch64",
"acpi_tables",
"android_audio",
"arch",
"argh_helpers",
"audio_util",
Expand Down Expand Up @@ -296,6 +297,13 @@ default-no-sandbox = []
## org.chromium.ArcQuota dbus service.
arc_quota = ["devices/arc_quota"]

## Enables use of Android AAudio virtio-snd backend.
audio_aaudio = ["devices/audio_aaudio"]

## Stub implementation of Android AAudio NDK library. This is only used for building and testing the
## Android audio on a non-Android target
libaaudio_stub = ["android_audio/libaaudio_stub"]

## Enables use of the ChromeOS audio server. ChromeOS builds will replace libcras_stub with an
## implementation that talks to the audio server. In upstream builds, using this option will panic.
audio_cras = ["devices/audio_cras"]
Expand Down Expand Up @@ -367,10 +375,12 @@ all-default = [

## All features that are compiled and tested for aarch64
all-aarch64 = [
"audio_aaudio",
"all-default",
"android_display",
"android_display_stub",
"gunyah",
"libaaudio_stub",
]

## All features that are compiled and tested for riscv64
Expand All @@ -380,9 +390,11 @@ all-riscv64 = [

## All features that are compiled and tested for x86_64
all-x86_64 = [
"audio_aaudio",
"all-default",
"android_display",
"android_display_stub",
"libaaudio_stub",
"plugin",
"scudo"
]
Expand Down Expand Up @@ -484,6 +496,7 @@ aarch64 = { path = "aarch64" }
minijail = "*" # provided by ebuild
p9 = "0.2.3"
vhost = { path = "vhost" }
android_audio = { path = "android_audio"}

[target.'cfg(windows)'.dependencies]
anti_tamper = { path = "vendor/generic/anti_tamper" }
Expand Down
17 changes: 17 additions & 0 deletions android_audio/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "android_audio"
version = "0.1.0"
authors = ["The ChromiumOS Authors"]
edition = "2021"

[features]
libaaudio_stub = []

[lib]
path = "src/lib.rs"

[dependencies]
audio_streams = { path = "../common/audio_streams"}
async-trait = "0.1.36"
base = { path = "../base" }
thiserror = "1.0.20"
Loading

0 comments on commit ec39c30

Please sign in to comment.