If we have no audio state configured, then we don't want to
advertize the VNC_ENCODING_AUDIO feature. If a client attempts
to use it despite being disabled, we should also reject it.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
docs/about/deprecated.rst | 6 ------
docs/about/removed-features.rst | 6 ++++++
ui/vnc.c | 10 +++++++++-
3 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index f8b4e19a4c..09269f55e6 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -37,12 +37,6 @@ Creating sound card devices without ``audiodev=`` property (since 4.2)
When not using the deprecated legacy audio config, each sound card
should specify an ``audiodev=`` property.
-Supporting audio transfer over vnc without ``audiodev=`` property (since 4.2)
-'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-When using vnc, you should specify an ``audiodev=`` property if you
-intend to allow clients to request audio transfer through the VNC protocol.
-
Short-form boolean options (since 6.0)
''''''''''''''''''''''''''''''''''''''
diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst
index c918cabd1a..8a8e0faff0 100644
--- a/docs/about/removed-features.rst
+++ b/docs/about/removed-features.rst
@@ -422,6 +422,12 @@ the value is hexadecimal. That is, '0x20M' should be written
either as
``tty`` and ``parport`` used to be aliases for ``serial`` and ``parallel``
respectively. The actual backend names should be used instead.
+Supporting audio transfer over vnc without ``audiodev=`` property (removed in 8.0)
+''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+When using vnc, you should specify an ``audiodev=`` property if you
+intend to allow clients to request audio transfer through the VNC protocol.
+
QEMU Machine Protocol (QMP) commands
------------------------------------
diff --git a/ui/vnc.c b/ui/vnc.c
index d9eacad759..6b3cbf365e 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2199,7 +2199,9 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t
n_encodings)
send_ext_key_event_ack(vs);
break;
case VNC_ENCODING_AUDIO:
- send_ext_audio_ack(vs);
+ if (vs->vd->audio_state != NULL) {
+ send_ext_audio_ack(vs);
+ }
break;
case VNC_ENCODING_WMVi:
vs->features |= VNC_FEATURE_WMVI_MASK;
@@ -2506,6 +2508,12 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t
len)
read_u32(data, 4), read_u32(data, 8));
break;
case VNC_MSG_CLIENT_QEMU_AUDIO:
+ if (vs->vd->audio_state == NULL) {
+ error_report("vnc: QEMU audio client message while disabled");
+ vnc_client_error(vs);
+ break;
+ }
+
if (len == 2)
return 4;
--
2.38.1