audio: prevent SIGSEGV in AUD_get_buffer_size_out
With audiodev parameter out.mixing-engine=off hw->mix_buf is
NULL. This leads to a segmentation fault in
AUD_get_buffer_size_out. This patch reverts a small part of
dc88e38fa7 "audio: unify input and output mixeng buffer
management".
To reproduce the problem start qemu with
-soundhw adlib -audiodev pa,id=audio0,out.mixing-engine=off
Signed-off-by: Volker RĂ¼melin <vr_qemu@t-online.de>
Message-Id: <20200123074943.6699-4-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
diff --git a/audio/audio.c b/audio/audio.c
index 9cd76a3..12ed318 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -879,9 +879,9 @@
}
}
-int AUD_get_buffer_size_out (SWVoiceOut *sw)
+int AUD_get_buffer_size_out(SWVoiceOut *sw)
{
- return sw->hw->mix_buf->size * sw->hw->info.bytes_per_frame;
+ return sw->hw->samples * sw->hw->info.bytes_per_frame;
}
void AUD_set_active_out (SWVoiceOut *sw, int on)