qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 3/4] audio: Add functions to initialize buffers


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v5 3/4] audio: Add functions to initialize buffers
Date: Thu, 23 Jan 2025 09:43:06 +0100
User-agent: Mozilla Thunderbird

Hi Akihiko,

On 23/1/25 08:18, Akihiko Odaki wrote:
These functions can be used to re-initialize buffers when hardware
parameters change due to device hotplug, for example.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Phil Dennis-Jordan <phil@philjordan.eu>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
---
  audio/audio_int.h |  2 ++
  audio/audio.c     | 24 ++++++++++++++++++------
  2 files changed, 20 insertions(+), 6 deletions(-)


index 
87b4e9b6f2f356b6e5e972eabc100cf270fcbc29..17c6bbd0ae9e6ff810c0989dbfa1710ef674ff0a
 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1407,12 +1407,18 @@ void audio_run(AudioState *s, const char *msg)
  #endif
  }
+void audio_generic_initialize_buffer_in(HWVoiceIn *hw)
+{
+    g_free(hw->buf_emul);
+    hw->size_emul = hw->samples * hw->info.bytes_per_frame;
+    hw->buf_emul = g_malloc(hw->size_emul);

What about using g_realloc()? Otherwise LGTM.

+    hw->pos_emul = hw->pending_emul = 0;
+}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]