-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement VirtIO sound device playback #53
base: master
Are you sure you want to change the base?
Conversation
4a8a6fc
to
0902227
Compare
This comment was marked as outdated.
This comment was marked as outdated.
0902227
to
ebba2c7
Compare
2b1009d
to
be7ad90
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run clang-format
before submitting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consult https://github.com/cntools/cnfa/blob/master/.github/workflows/build-cnfa.yml and mention the build dependency in top-level README.md
.
a67216b
to
1fc471c
Compare
862cb51
to
da29ce5
Compare
712d08a
to
5bbfde2
Compare
c6fb743
to
62a58cf
Compare
Hi @jserv , The virtio-snd plays the sound with repeating artifact (taking "front center" as example, it sounds like "front front center"). Kindly leave some thoughts for some references or some folks of dealing with repeating artifact if I had a chance, and it will be a great thanks for your help! If you would like to get the file, I will convert the file into base64 encoded text in order to upload to here. |
561d9d5
to
c3a13e4
Compare
Simply share the prebuilt Linux kernel image file, rootfs, and test files via Google Drive, Dropbox, or similar services as they are intended to be temporary. |
c3a13e4
to
e4b1e34
Compare
Hi @jserv , This Dropbox share link contains the files that reviewers will need: https://www.dropbox.com/scl/fo/vv3luiccfco5tjwt8tqxm/AANAyYgL9qvVPhuT4dtkkIA?rlkey=dv84qtw9y4e0ea8go03q5qwf8&st=73j9agts&dl=0 The usage of files are described as follows:
|
Tested on macOS + Apple M1:
Then, it got stuck without progress. |
e4b1e34
to
e900054
Compare
Thanks for helping the tests on macOS. I guess it is some kind of locking issue. For comparison on Linux + X86 it runs like this:
|
Consider the change below to suppress compilation warnings raised by CNFA: --- a/Makefile
+++ b/Makefile
@@ -85,6 +85,7 @@ CNFA_LIB := cnfa/CNFA_sf.h
$(CNFA_LIB): cnfa/Makefile cnfa/os_generic
$(MAKE) -C $(dir $<) CNFA_sf.h
main.o: $(CNFA_LIB)
+virtio-snd.o: CFLAGS += -Wno-unused-parameter
endif
# .DEFAULT_GOAL should be set to all since the very first target is not all |
Hi @jserv ,
After checking the CNFA part, the coreaudio just like the PulseAudio/PipeWire part: no need to use a dedicated thread for pushing PCM frames. I would like to ask which one you prefer for resolving this issue:
|
8d1a115
to
244b758
Compare
244b758
to
1391e28
Compare
The limitations are listed as follows: 1. The emulator will hang if PulseAudio is enabled on host. The reason is that the host OS cannot close CNFA driver because CNFA driver reference count is not zero (PulseAudio holds one reference count). What's worse, CNFA cannot initialize if PulseAudio is disabled, As it needs a dedicated threading model (CNFA uses different threading models between pure ALSA and PulseAudio environment), we suggest users need mitigations (for instance, restart the emulator after playing sound) or just wait for the future release. 2. The playback may play with repeating artifact (for example, A "front center" ALSA example sound will sound like "front front center"). The root cause is the Linux Kernel and it hasn't got fixed even in mainline version. See https://lore.kernel.org/all/[email protected]/T/ for more information.
1391e28
to
726c2a7
Compare
Implement VirtIO sound device supporting these operations (the item with checked box checked means it is implemented right now):
VIRTIO_SND_R_JACK_INFO
VIRTIO_SND_R_PCM_INFO
VIRTIO_SND_R_CHMAP_INFO
VIRTIO_SND_R_PCM_SET_PARAMS
VIRTIO_SND_R_PCM_PREPARE
VIRTIO_SND_R_PCM_RELEASE
VIRTIO_SND_R_PCM_START
VIRTIO_SND_R_PCM_STOP
Limitations
The emulator will hang if PulseAudio is enabled on host.
It causes to CNFA and CNFA cannot initialize if PulseAudio
is disabled, What's worse, it needs re-working as CNFA uses
different threading models between pure ALSA and PulseAudio environment.
Therefore, users need mitigations (i.e., restart the emulator after
playing sound) or just wait for the future release.
The playback may plays with repeating artifact (for example,
A "front center" ALSA example sound will sound like "front front
center"). The root cause is the Linux Kernel and it hasn't got
fixed even in mainline version.
Test Cases
boot up test
test procedures
make check
to runsemu
.dmesg
).expected results
check driver configuration
test procedures
aplay -l
in emulator.expected results
play sound
test procedures
speaker-test
in emulator.expected results
speaker-test
is executing.play sequence sound
test procedures
aplay /usr/share/sounds/alsa/Front_Center.wav
in emulator.expected results