]> xenbits.xensource.com Git - libvirt.git/commitdiff
Allow control over QEMU audio backend
authorDaniel P. Berrange <berrange@redhat.com>
Mon, 14 Sep 2009 10:23:20 +0000 (11:23 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 29 Sep 2009 14:53:10 +0000 (15:53 +0100)
When using VNC for graphics + keyboard + mouse, we shouldn't
then use the host OS for audio. Audio should go back over
VNC.

When using SDL for graphics, we should use the host OS for
audio since that's where the display is. We need to allow
certain QEMU env variables to be passed through to guest
too to allow choice of QEMU audio backend.

* qemud/libvirtd.sysconf: Mention QEMU/SDL audio env vars
* src/qemu_conf.c: Passthrough QEMU/SDL audio env for SDL display,
  disable host audio for VNC display

daemon/libvirtd.sysconf
src/qemu/qemu_conf.c

index fe4596a0c40b39c7751ad6d052508f6583ee1eb6..28080a0e37245a78315135a902206ab0b4d67a69 100644 (file)
@@ -7,3 +7,11 @@
 
 # Override Kerberos service keytab for SASL/GSSAPI
 #KRB5_KTNAME=/etc/libvirt/krb5.tab
+
+# Override the QEMU/SDL default audio driver probing when
+# starting virtual machines using SDL graphics
+#
+# NB these have no effect for VMs using VNC
+#QEMU_AUDIO_DRV=sdl
+#
+#SDL_AUDIODRIVER=pulse
index 1d986372603eba38eb86f418977ad39ef7ceb45d..2db38dff22c8cad9a46f6085bd1d9ec9d63a4f38 100644 (file)
@@ -2118,6 +2118,13 @@ int qemudBuildCommandLine(virConnectPtr conn,
             ADD_ARG_LIT("-k");
             ADD_ARG_LIT(def->graphics[0]->data.vnc.keymap);
         }
+
+        /* QEMU implements a VNC extension for providing audio, so we
+         * set the audio backend to none, to prevent it opening the
+         * host OS audio devices since that causes security issues
+         * and is non-sensical when using VNC.
+         */
+        ADD_ENV_LIT("QEMU_AUDIO_DRV=none");
     } else if ((def->ngraphics == 1) &&
                def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
         char *xauth = NULL;
@@ -2140,6 +2147,13 @@ int qemudBuildCommandLine(virConnectPtr conn,
             ADD_ENV(display);
         if (def->graphics[0]->data.sdl.fullscreen)
             ADD_ARG_LIT("-full-screen");
+
+        /* If using SDL for video, then we should just let it
+         * use QEMU's host audio drivers, possibly SDL too
+         * User can set these two before starting libvirtd
+         */
+        ADD_ENV_COPY("QEMU_AUDIO_DRV");
+        ADD_ENV_COPY("SDL_AUDIODRIVER");
     }
 
     if (def->nvideos) {