@@ -1801,20 +1801,28 @@ out:
return NULL;
}
+AudioState *audio_get_default_audio_state(Error **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 set audiodev=%s?\n",
+ QSIMPLEQ_FIRST(&audiodevs)->dev->id);
+ }
+ }
+ }
+
+ return default_audio_state;
+}
+
bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp)
{
if (!card->state) {
- 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 set audiodev=%s?\n",
- QSIMPLEQ_FIRST(&audiodevs)->dev->id);
- }
- return false;
- }
+ card->state = audio_get_default_audio_state(errp);
+ if (!card->state) {
+ return false;
}
- card->state = default_audio_state;
}
card->name = g_strdup (name);
@@ -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) \
@@ -449,17 +449,11 @@ QEMU does not create default audio backends anymore if any of the
``-audiodev``, ``-audio`` or ``-nodefaults`` options are used on the
command line.
-If an audio backend is created with ``-audiodev``, each sound card
-that wants to use it should specify an ``audiodev=``
+If an audio backend is created with ``-audiodev``, each audio client
+(a sound card or VNC) that wants to use it should specify an ``audiodev=``
property. Previously, the first audiodev command line option would be
used as a fallback.
-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
------------------------------------
@@ -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");
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 | 28 ++++++++++++++++++---------- audio/audio.h | 1 + docs/about/removed-features.rst | 10 ++-------- ui/vnc.c | 2 ++ 4 files changed, 23 insertions(+), 18 deletions(-)