diff options
author | Fletcher Woodruff <fletcherw@chromium.org> | 2019-08-12 11:46:47 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-28 01:07:56 +0000 |
commit | 7eae7735ee3485605d2ec7ba0685588b7a38b37b (patch) | |
tree | a2055a77649a489624b7b5b4dfbf08607655b9cf /sys_util | |
parent | 020fbf04c2ac112f34b87306b5fbb75e7a02a81a (diff) | |
download | crosvm-7eae7735ee3485605d2ec7ba0685588b7a38b37b.tar crosvm-7eae7735ee3485605d2ec7ba0685588b7a38b37b.tar.gz crosvm-7eae7735ee3485605d2ec7ba0685588b7a38b37b.tar.bz2 crosvm-7eae7735ee3485605d2ec7ba0685588b7a38b37b.tar.lz crosvm-7eae7735ee3485605d2ec7ba0685588b7a38b37b.tar.xz crosvm-7eae7735ee3485605d2ec7ba0685588b7a38b37b.tar.zst crosvm-7eae7735ee3485605d2ec7ba0685588b7a38b37b.zip |
ac97: switch to ShmStreamSource
Convert playback and capture for the AC97 device to use the zero-copy ShmStreamSource instead of the old StreamSource. In the process, rework start_playback and start_capture unit tests so they rely less on sleep statements. BUG=chromium:968724 BUG=chromium:1006035 TEST="sox -n -r 48000 -b 16 output.raw synth 5 sine 330 && aplay -f dat output.raw" within a VM, check that sine wave is played accurately. Change-Id: Ie9cddbc5285a9505872c9951a8a1da01de70eb88 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1749950 Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Fletcher Woodruff <fletcherw@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Diffstat (limited to 'sys_util')
-rw-r--r-- | sys_util/src/guest_memory.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sys_util/src/guest_memory.rs b/sys_util/src/guest_memory.rs index 6399f8c..2390b92 100644 --- a/sys_util/src/guest_memory.rs +++ b/sys_util/src/guest_memory.rs @@ -4,6 +4,7 @@ //! Track memory regions that are mapped to the guest VM. +use std::convert::AsRef; use std::convert::TryFrom; use std::fmt::{self, Display}; use std::os::unix::io::{AsRawFd, RawFd}; @@ -107,6 +108,12 @@ impl AsRawFd for GuestMemory { } } +impl AsRef<SharedMemory> for GuestMemory { + fn as_ref(&self) -> &SharedMemory { + &self.memfd + } +} + impl GuestMemory { /// Creates backing memfd for GuestMemory regions fn create_memfd(ranges: &[(GuestAddress, u64)]) -> Result<SharedMemory> { |