public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 2/2] vnc: connect to audio device if there is one
Date: Fri,  4 Apr 2025 11:43:03 +0200	[thread overview]
Message-ID: <20250404094303.1408396-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20250404094303.1408396-1-d.csapak@proxmox.com>

this is in preparation of noVNC audio support. For that to work we have
to connect vnc to the audiodev, else qemu does not know which device
to encode audio from. Since we only can have one audio device, simply
use that if it exists.

This works simultaneously for SPICE and VNC. Live migration is not
impacted, since it's only a logical change and not a hardware change.
(Tested live-migration multiple times in both directions, worked without
any issues).

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 PVE/QemuServer.pm           | 4 +++-
 test/cfg2cmd/audio.conf.cmd | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 96786a96..dfdbee99 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3706,7 +3706,9 @@ sub config_to_command {
 	push @$cmd, '-display', 'egl-headless,gl=core' if $vga->{type} eq 'virtio-gl'; # VIRGL
 
 	my $socket = PVE::QemuServer::Helpers::vnc_socket($vmid);
-	push @$cmd,  '-vnc', "unix:$socket,password=on";
+	my $audioconf = conf_has_audio($conf);
+	my $audiodev = defined($audioconf) ? ",audiodev=$audioconf->{backend_id}" : "";
+	push @$cmd,  '-vnc', "unix:$socket,password=on$audiodev";
     } else {
 	push @$cmd, '-vga', 'none' if $vga->{type} eq 'none';
 	push @$cmd, '-nographic';
diff --git a/test/cfg2cmd/audio.conf.cmd b/test/cfg2cmd/audio.conf.cmd
index add6f55d..7014bf51 100644
--- a/test/cfg2cmd/audio.conf.cmd
+++ b/test/cfg2cmd/audio.conf.cmd
@@ -12,7 +12,7 @@
   -smp '3,sockets=1,cores=3,maxcpus=3' \
   -nodefaults \
   -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \
-  -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \
+  -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on,audiodev=none-backend0' \
   -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \
   -m 768 \
   -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


      reply	other threads:[~2025-04-04  9:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-04  9:43 [pve-devel] [PATCH qemu-server 1/2] tests: cfg2cmd: add test for audio device Dominik Csapak
2025-04-04  9:43 ` Dominik Csapak [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250404094303.1408396-2-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal