[fedora-virt] Working sound in KVM with SDL display on Fedora 12 ?

Daniel P. Berrange berrange at redhat.com
Tue Nov 24 11:13:23 UTC 2009


I've been working on GTK-VNC to make it able to receive the audio stream
from the remote VNC server, and decided to compare the quality against 
the current KVM host audio support. At which point I discovered that,
AFAICT, the latter does not work in the slightest.

I know that when running KVM guests with VNC under libvirt, you will not 
get any sound because I disabled that bit of code :-) It is guests using
SDL graphics I'm interested in. eg, running a really simple guest like

  /usr/bin/qemu-kvm -m 700 -smp 1 -boot c 
      -drive file=/home/berrange/f11i686.img,if=virtio,index=0,boot=on  
      -vga cirrus -soundhw ac97  -sdl


I have tested both ac97, and es1370 sound cards. I have tested with the
default QEMU host audio backend (pulseaudio), and with also tested with
each of the following settings on the host

  <no env set>
  QEMU_AUDIO_DRV=pa
  QEMU_AUDIO_DRV=alsa
  QEMU_AUDIO_DRV=sdl
  QEMU_AUDIO_DRV=sdl SDL_AUDIODRIVER=pa
  QEMU_AUDIO_DRV=sdl SDL_AUDIODRIVER=alsa

NB, they all ultimately go to pulseaudio on the host since it has its
alsa proxy installed

All of them appear to be more or less just as bad as each other. Inside the
guest I'm running a boring old F11 i686 guest. I removed pulseaudio inside
the guest and run 'mpg321' on the native alsa drivers. If you include the
'-v' flag to mpg321, it shows its playback progress. What I'm seeing is
that for the first 10 seconds or so its timer runs at 1/2 the actual
speed, and then it speeds up exponentially taking a mere 10 seconds for the
remaining 2 minutes of the mp3. 

Does anyone successfully have KVM on Fedora 12 playing audio when using
the SDL display ?  AFAICT, audio is just totally & utterly fubar, with 
SDL and any of the host audio drivers. So if anyone has it working
reliably please tell me what, if any,  QEMU_AUDIO_DRV / SDL_AUDIODRIVER
env variables you have set, what guest OS you use, and what program you
are using for playback in the guest. Also on the host, whether you have
pulse audio (the default for F12), or are using native ALSA directly.


On the plus side, by comparison, my code for streaming audio to GTK-VNC is
managing to playback at pretty much native speed, with only a few dropouts
in buffering

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the Fedora-virt mailing list