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: Akihiko Odaki
Subject: Re: [PATCH v5 3/4] audio: Add functions to initialize buffers
Date: Fri, 24 Jan 2025 13:58:59 +0900
User-agent: Mozilla Thunderbird

On 2025/01/23 17:43, Philippe Mathieu-Daudé wrote:
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.

g_realloc() will copy the content, which is not necessary here.


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





reply via email to

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