summary refs log tree commit diff stats
path: root/audio
diff options
context:
space:
mode:
authorVolker RĂ¼melin <vr_qemu@t-online.de>2021-01-10 11:02:26 +0100
committerGerd Hoffmann <kraxel@redhat.com>2021-01-15 11:25:22 +0100
commit1d8549ad5e0fa1ac0d989884882061b83da46d27 (patch)
tree5c67d0796cdebc8f293ea8e122b3893f8f0f3ce4 /audio
parentc2031dea894ed189e947a31dde15ffc4755030f9 (diff)
downloadfocaccia-qemu-1d8549ad5e0fa1ac0d989884882061b83da46d27.tar.gz
focaccia-qemu-1d8549ad5e0fa1ac0d989884882061b83da46d27.zip
audio: break generic buffer dependency on mixing-engine
Break the unnecessary dependency of the generic buffer management
code on mixing-engine. This is required for the next patch.

Signed-off-by: Volker RĂ¼melin <vr_qemu@t-online.de>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-10-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'audio')
-rw-r--r--audio/audio.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/audio/audio.c b/audio/audio.c
index 480b3cce1f..22d769db0c 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1388,9 +1388,8 @@ void audio_run(AudioState *s, const char *msg)
 void audio_generic_run_buffer_in(HWVoiceIn *hw)
 {
     if (unlikely(!hw->buf_emul)) {
-        size_t calc_size = hw->conv_buf->size * hw->info.bytes_per_frame;
-        hw->buf_emul = g_malloc(calc_size);
-        hw->size_emul = calc_size;
+        hw->size_emul = hw->samples * hw->info.bytes_per_frame;
+        hw->buf_emul = g_malloc(hw->size_emul);
         hw->pos_emul = hw->pending_emul = 0;
     }
 
@@ -1452,10 +1451,8 @@ void audio_generic_run_buffer_out(HWVoiceOut *hw)
 void *audio_generic_get_buffer_out(HWVoiceOut *hw, size_t *size)
 {
     if (unlikely(!hw->buf_emul)) {
-        size_t calc_size = hw->mix_buf->size * hw->info.bytes_per_frame;
-
-        hw->buf_emul = g_malloc(calc_size);
-        hw->size_emul = calc_size;
+        hw->size_emul = hw->samples * hw->info.bytes_per_frame;
+        hw->buf_emul = g_malloc(hw->size_emul);
         hw->pos_emul = hw->pending_emul = 0;
     }