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>
This commit is contained in:
Volker Rümelin 2020-01-23 08:49:38 +01:00 committed by Gerd Hoffmann
parent a76e6b8794
commit 69ac078632
1 changed files with 2 additions and 2 deletions

View File

@ -879,9 +879,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)