diff mbox series

[4/9] audio: prevent SIGSEGV in AUD_get_buffer_size_out

Message ID 20200123074943.6699-4-vr_qemu@t-online.de
State New
Headers show
Series more audio fixes and improvements | expand

Commit Message

Volker RĂ¼melin Jan. 23, 2020, 7:49 a.m. UTC
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>
---
 audio/audio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/audio/audio.c b/audio/audio.c
index bf0f01e17f..922e95011c 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -878,9 +878,9 @@  size_t AUD_read(SWVoiceIn *sw, void *buf, size_t size)
     }
 }
 
-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)