linux: Add cras-capture option for cras-audio device
The flag can enable capturing audio from CRAS server to the cras-audio
device.
We'll re-enable capture function on Crostini after finishing capture
permission works.
BUG=chromium:932268
TEST=Boot vm with crosvm --cras-audio --cras-capture to check recording
functionality.
Cq-Depend: chromium:1628633
Change-Id: I7502cbd668cbc722224164d9f69e50a16b0ab86b
Reviewed-on: https://chromium-review.googlesource.com/1628687
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
diff --git a/src/main.rs b/src/main.rs
index 092664a..4c53760 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -103,6 +103,7 @@
gpu: bool,
software_tpm: bool,
cras_audio: bool,
+ cras_capture: bool,
null_audio: bool,
serial_parameters: BTreeMap<u8, SerialParameters>,
syslog_tag: Option<String>,
@@ -144,6 +145,7 @@
sandbox: !cfg!(feature = "default-no-sandbox"),
seccomp_policy_dir: PathBuf::from(SECCOMP_POLICY_DIR),
cras_audio: false,
+ cras_capture: false,
null_audio: false,
serial_parameters: BTreeMap::new(),
syslog_tag: None,
@@ -368,6 +370,9 @@
"cras-audio" => {
cfg.cras_audio = true;
}
+ "cras-capture" => {
+ cfg.cras_capture = true;
+ }
"null-audio" => {
cfg.null_audio = true;
}
@@ -792,6 +797,7 @@
Argument::value("netmask", "NETMASK", "Netmask for VM subnet."),
Argument::value("mac", "MAC", "MAC address for VM."),
Argument::flag("cras-audio", "Add an audio device to the VM that plays samples through CRAS server"),
+ Argument::flag("cras-capture", "Enable capturing audio from CRAS server to the cras-audio device"),
Argument::flag("null-audio", "Add an audio device to the VM that plays samples to /dev/null"),
Argument::value("serial",
"type=TYPE,[path=PATH,num=NUM,console]",