]> git.proxmox.com Git - mirror_qemu.git/commitdiff
audio: reintroduce default audio backend for VNC
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 5 Oct 2023 16:42:54 +0000 (18:42 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Sun, 8 Oct 2023 19:08:27 +0000 (21:08 +0200)
Make VNC use the default backend again if one is defined.
The recently introduced support for disabling the VNC audio
extension is still used, in case no default backend exists.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
audio/audio.c
audio/audio.h
docs/about/removed-features.rst
ui/vnc.c

index bd4bcabccaf5a2c022ea3b1e81e1cc9c84ecf613..73b65dc3b9b84f44b1a806e8596fba976f978654 100644 (file)
@@ -1801,20 +1801,28 @@ out:
     return NULL;
 }
 
-bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp)
+AudioState *audio_get_default_audio_state(Error **errp)
 {
-    if (!card->state) {
+    if (!default_audio_state) {
+        default_audio_state = audio_init(NULL, errp);
         if (!default_audio_state) {
-            default_audio_state = audio_init(NULL, errp);
-            if (!default_audio_state) {
-                if (!QSIMPLEQ_EMPTY(&audiodevs)) {
-                    error_append_hint(errp, "Perhaps you wanted to use -audio or set audiodev=%s?\n",
-                                      QSIMPLEQ_FIRST(&audiodevs)->dev->id);
-                }
-                return false;
+            if (!QSIMPLEQ_EMPTY(&audiodevs)) {
+                error_append_hint(errp, "Perhaps you wanted to use -audio or set audiodev=%s?\n",
+                                  QSIMPLEQ_FIRST(&audiodevs)->dev->id);
             }
         }
-        card->state = default_audio_state;
+    }
+
+    return default_audio_state;
+}
+
+bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp)
+{
+    if (!card->state) {
+        card->state = audio_get_default_audio_state(errp);
+        if (!card->state) {
+            return false;
+        }
     }
 
     card->name = g_strdup (name);
index 6da5e8f6f0fbd37754ae2b38085f0fc3482fcf8d..fcc22307bee36d9c8e1c1cb9f20a7b2d5864fd1b 100644 (file)
@@ -176,6 +176,7 @@ void audio_init_audiodevs(void);
 void audio_help(void);
 
 AudioState *audio_state_by_name(const char *name, Error **errp);
+AudioState *audio_get_default_audio_state(Error **errp);
 const char *audio_get_id(QEMUSoundCard *card);
 
 #define DEFINE_AUDIO_PROPERTIES(_s, _f)         \
index ed94b4cd0c84417dde470bbe5654f686bfbe6a7f..f04036987b11e579e2a3084273ebe52885c140fc 100644 (file)
@@ -460,12 +460,6 @@ in this case.
 Note that the default audio backend must be configured on the command
 line if the ``-nodefaults`` options is used.
 
-Creating vnc without ``audiodev=`` property (removed in 8.2)
-''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-When using vnc, you should specify an ``audiodev=`` property if
-you plan to transmit audio through the VNC protocol.
-
 QEMU Machine Protocol (QMP) commands
 ------------------------------------
 
index 6056028e49f772a4cf12580ca269ab3a3ea42995..4f23a0fa79f5d7f979dad0d54b485d1d37c97692 100644 (file)
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -4185,6 +4185,8 @@ void vnc_display_open(const char *id, Error **errp)
         if (!vd->audio_state) {
             goto fail;
         }
+    } else {
+        vd->audio_state = audio_get_default_audio_state(NULL);
     }
 
     device_id = qemu_opt_get(opts, "display");