crosvm/common/audio_streams
Chih-Yang Hsia 34b48775ab audio_streams: Fix incorrect write impl in AudioBuffer
If frame_size is not "power of 2" (e.g. 12 bytes in 6channel/S16_LE),
current write implementation will trigger io::copy error since
- io::copy will split reader into multiple buffers with len() = "power of 2"
  if writer.capacity() >= DEFAULT_BUF_SIZE (which is 8192) and
- trigger early return since current write don't support incomplete frames
  writing.

Changes:
- Remove redundant write impl
- Fix write implementation in AudioBuffer
- Add io_copy_audio_buffer unit test

BUG=b:199001477
BUG=b:201382814
TEST=`cargo test`
TEST=`cargo clippy --all-targets --all-features -- -D warnings`
TEST=`aplay -Dhw:0,0 -f dat /dev/zeros -c 6` with virtio-snd

Change-Id: Ia6b587ab20f474d8c620b69940ca0cc7095da6db
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3331976
Reviewed-by: Woody Chow <woodychow@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chih-Yang Hsia <paulhsia@chromium.org>
2021-12-13 05:04:55 +00:00
..
src audio_streams: Fix incorrect write impl in AudioBuffer 2021-12-13 05:04:55 +00:00
Cargo.toml audio_streams: Introduce SharedMemory trait for base::SharedMemory 2021-11-18 08:45:14 +00:00
README.md

Audio Server and Stream interfaces

The audio_streams crate provides a basic interface for playing audio. This will be used to enable playback to various audio subsystems such as Alsa and cras. To start, an empty playback example NoopStreamSource is provided.