qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug 1908832] Re: jack audio dev produces no sound


From: Christian Schoenebeck
Subject: [Bug 1908832] Re: jack audio dev produces no sound
Date: Wed, 24 Feb 2021 13:23:01 -0000

c->opt->connect_ports is an optional user supplied configuration
argument which allows the user to specify a regular expression pattern
which is used by QEMU's JACK audio driver to automatically connect its
JACK ports to. From qapi/audio.json:

##
# @AudiodevJackPerDirectionOptions:
#
# Options of the JACK backend that are used for both playback and
# recording.
#
# @server-name: select from among several possible concurrent server instances
#               (default: environment variable $JACK_DEFAULT_SERVER if set, 
else "default")
#
# @client-name: the client name to use. The server will modify this name to
#               create a unique variant, if needed unless @exact-name is true 
(default: the
#               guest's name)
#
# @connect-ports: if set, a regular expression of JACK client port name(s) to
#                 monitor for and automatically connect to
#
# @start-server: start a jack server process if one is not already present
#                (default: false)
#
# @exact-name: use the exact name requested otherwise JACK automatically
#              generates a unique one, if needed (default: false)
#
# Since: 5.1
##
{ 'struct': 'AudiodevJackPerDirectionOptions',
  'base': 'AudiodevPerDirectionOptions',
  'data': {
    '*server-name':   'str',
    '*client-name':   'str',
    '*connect-ports': 'str',
    '*start-server':  'bool',
    '*exact-name':    'bool' } }

I agree with you that it would be more user friendly to auto connect
QEMU's output ports to system:playback_1, system:playback_2 and QEMU's
input ports to system:capture_1, system:capture_2 respectively if the
user did not specify any argument for "connect-ports".

However I think your patch is a bit too simple, i.e. it is more or less
luck that the system ports end up as the first two members in the lookup
array "ports". It is working right now, but there is no guarantee about
the order of the ports returned by jack_get_ports():

https://jackaudio.org/api/group__PortSearching.html

So I would suggest changing your patch a bit by passing a lookup pattern
like "system:playback_.*" to jack_get_ports() for QEMU output ports and
a pattern like "system:capture_.*" for QEMU input ports, if
c->opt->connect_ports is empty that is.

Would you try to send a patch like this? And if yes, would you mind
sending your patch directly to the qemu-devel mailing list? That would
allow us to merge your patch more efficiently & quickly.

https://wiki.qemu.org/Contribute/SubmitAPatch

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1908832

Title:
  jack audio dev produces no sound

Status in QEMU:
  New

Bug description:
  Hi,

  I'm testing the new jack audiodev backend in my
  laptop. The host system is gentoo, using the
  ebuild for qemu 5.1.0-r2, and I'm using jack
  use flag globally in the system so any ebuild
  that have support for jack should be build with
  it. The jack setup reportedly works as I use it
  with firefox, and mumble with no trouble. When
  I launch the following script, I see the vm
  connects to jack:

  /usr/bin/qemu-system-x86_64 -enable-kvm -M q35 -vga virtio -display gtk,gl=on 
\
          -cpu host -smp 2,cores=2,threads=1 \
          -m 4G -L /usr/share/qemu \
          -global ICH9-LPC.disable_s3=1 -global ICH9-LPC.disable_s4=1 \
          -drive 
file=/usr/share/edk2-ovmf/OVMF_CODE.fd,if=pflash,format=raw,unit=0,readonly=on \
          -drive file=debian_VARS.fd,if=pflash,format=raw,unit=1 \
          -audiodev id=jack,driver=jack -device ich9-intel-hda -device 
hda-duplex,audiodev=jack \
          -device virtio-serial-pci \
          -device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 \
          -chardev spicevmc,id=spicechannel0,name=vdagent \
          -device nec-usb-xhci,id=usb \
          -device usb-host,vendorid=0x04ca,productid=0x708e \
          -device usb-host,vendorid=0x1050,productid=0x0407 \
          -chardev spicevmc,name=usbredir,id=usbredirchardev1 \
          -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1 \
          -chardev spicevmc,name=usbredir,id=usbredirchardev2 \
          -device usb-redir,chardev=usbredirchardev2,id=usbredirdev2 \
          -chardev spicevmc,name=usbredir,id=usbredirchardev3 \
          -device usb-redir,chardev=usbredirchardev3,id=usbredirdev3 \
          -netdev user,id=user.0 -device virtio-net-pci,netdev=user.0 \
          -drive file=debian.qcow2,cache=none,aio=io_uring,if=virtio

  Output of vm initialization:

  jack: JACK output configured for 48000Hz (1024 samples)
  jack: JACK input configured for 48000Hz (1024 samples)
  gl_version 46 - core profile enabled
  GLSL feature level 430

  Though executing any application that uses sound,
  for instance, any youtube video through browser,
  I listen nothing. By executing pkill jackd, and
  launching the same script replacing the audiodev
  line for the following:

          -audiodev id=alsa,driver=alsa -device ich9-intel-hda -device
  hda-duplex,audiodev=alsa \

  The audio works, and I can listen to music, or
  any other kind of application, though I cannot
  listen anything else in the host.

  The guest is a simple debian testing(bullseye)
  system with plasma desktop, using pulseaudio,
  nothing fancy.

  Thanks!

  José

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1908832/+subscriptions



reply via email to

[Prev in Thread] Current Thread [Next in Thread]