|
|
8d2563 |
From c867f21d7f49830e9243ef5bff35e45face18a49 Mon Sep 17 00:00:00 2001
|
|
|
8d2563 |
Message-ID: <c867f21d7f49830e9243ef5bff35e45face18a49.1730821961.git.crobinso@redhat.com>
|
|
|
8d2563 |
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
|
|
8d2563 |
Date: Tue, 5 Nov 2024 12:32:03 +0400
|
|
|
8d2563 |
Subject: [PATCH] hw/audio/hda: avoid unnecessary re-open stream on
|
|
|
8d2563 |
reconfiguration
|
|
|
8d2563 |
MIME-Version: 1.0
|
|
|
8d2563 |
Content-Type: text/plain; charset=UTF-8
|
|
|
8d2563 |
Content-Transfer-Encoding: 8bit
|
|
|
8d2563 |
Content-type: text/plain
|
|
|
8d2563 |
|
|
|
8d2563 |
Closing and opening a stream too quickly during reconfiguration create
|
|
|
8d2563 |
issues with Spice.
|
|
|
8d2563 |
|
|
|
8d2563 |
Note: the issue with Spice has been there before and still is. When the
|
|
|
8d2563 |
audio stream is recreated, for example when using
|
|
|
8d2563 |
`out.mixing-engine=false`.
|
|
|
8d2563 |
|
|
|
8d2563 |
Fixes: https://gitlab.com/qemu-project/qemu/-/issues/2639
|
|
|
8d2563 |
Fixes: 6d6e23361f ("hw/audio/hda: fix memory leak on audio setup")
|
|
|
8d2563 |
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
8d2563 |
Signed-off-by: Cole Robinson <crobinso@redhat.com>
|
|
|
8d2563 |
---
|
|
|
8d2563 |
hw/audio/hda-codec.c | 10 +++++++++-
|
|
|
8d2563 |
1 file changed, 9 insertions(+), 1 deletion(-)
|
|
|
8d2563 |
|
|
|
8d2563 |
diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c
|
|
|
8d2563 |
index 4373565371..b3075b5d44 100644
|
|
|
8d2563 |
--- a/hw/audio/hda-codec.c
|
|
|
8d2563 |
+++ b/hw/audio/hda-codec.c
|
|
|
8d2563 |
@@ -502,7 +502,15 @@ static void hda_audio_setup(HDAAudioStream *st)
|
|
|
8d2563 |
trace_hda_audio_format(st->node->name, st->as.nchannels,
|
|
|
8d2563 |
fmt2name[st->as.fmt], st->as.freq);
|
|
|
8d2563 |
|
|
|
8d2563 |
- hda_close_stream(st->state, st);
|
|
|
8d2563 |
+ /*
|
|
|
8d2563 |
+ * Do not hda_close_stream(st->state, st), AUD_open_() handles the logic for
|
|
|
8d2563 |
+ * fixed_settings, and same format. This helps prevent race issues in Spice
|
|
|
8d2563 |
+ * server & client code too. (see #2639)
|
|
|
8d2563 |
+ */
|
|
|
8d2563 |
+ if (use_timer) {
|
|
|
8d2563 |
+ timer_free(st->buft);
|
|
|
8d2563 |
+ st->buft = NULL;
|
|
|
8d2563 |
+ }
|
|
|
8d2563 |
if (st->output) {
|
|
|
8d2563 |
if (use_timer) {
|
|
|
8d2563 |
cb = hda_audio_output_cb;
|
|
|
8d2563 |
--
|
|
|
8d2563 |
2.46.2
|
|
|
8d2563 |
|