[PATCH v4 3/3] coreaudio: Initialize the buffer for device change

Akihiko Odaki posted 3 patches 2 weeks, 5 days ago
There is a newer version of this series
[PATCH v4 3/3] coreaudio: Initialize the buffer for device change
Posted by Akihiko Odaki 2 weeks, 5 days ago
Reallocate buffers when the active device change as the required buffer
size may differ.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 audio/coreaudio.m | 1 +
 1 file changed, 1 insertion(+)

diff --git a/audio/coreaudio.m b/audio/coreaudio.m
index b9e1a952ed37..72a6df0f75ee 100644
--- a/audio/coreaudio.m
+++ b/audio/coreaudio.m
@@ -466,6 +466,7 @@ static OSStatus init_out_device(coreaudioVoiceOut *core)
     core->outputDeviceID = deviceID;
     core->audioDevicePropertyBufferFrameSize = audioDevicePropertyBufferFrameSize;
     core->hw.samples = core->bufferCount * core->audioDevicePropertyBufferFrameSize;
+    audio_generic_initialize_buffer_out(&core->hw);
     core->ioprocid = ioprocid;
 
     return 0;

-- 
2.47.1
Re: [PATCH v4 3/3] coreaudio: Initialize the buffer for device change
Posted by Christian Schoenebeck 1 week, 6 days ago
On Friday, January 17, 2025 7:47:02 AM CET Akihiko Odaki wrote:
> Reallocate buffers when the active device change as the required buffer
> size may differ.
> 
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>

OTOH it also re-allocates the buffer when the size did not change, but Ok.

Acked-by: Christian Schoenebeck <qemu_oss@crudebyte.com>

> ---
>  audio/coreaudio.m | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/audio/coreaudio.m b/audio/coreaudio.m
> index b9e1a952ed37..72a6df0f75ee 100644
> --- a/audio/coreaudio.m
> +++ b/audio/coreaudio.m
> @@ -466,6 +466,7 @@ static OSStatus init_out_device(coreaudioVoiceOut *core)
>      core->outputDeviceID = deviceID;
>      core->audioDevicePropertyBufferFrameSize = audioDevicePropertyBufferFrameSize;
>      core->hw.samples = core->bufferCount * core->audioDevicePropertyBufferFrameSize;
> +    audio_generic_initialize_buffer_out(&core->hw);
>      core->ioprocid = ioprocid;
>  
>      return 0;
> 
>
Re: [PATCH v4 3/3] coreaudio: Initialize the buffer for device change
Posted by Phil Dennis-Jordan 2 weeks, 5 days ago
On Fri, 17 Jan 2025 at 07:48, Akihiko Odaki <akihiko.odaki@daynix.com>
wrote:

> Reallocate buffers when the active device change as the required buffer
> size may differ.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>
Reviewed-by: Phil Dennis-Jordan <phil@philjordan.eu>

---
>  audio/coreaudio.m | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/audio/coreaudio.m b/audio/coreaudio.m
> index b9e1a952ed37..72a6df0f75ee 100644
> --- a/audio/coreaudio.m
> +++ b/audio/coreaudio.m
> @@ -466,6 +466,7 @@ static OSStatus init_out_device(coreaudioVoiceOut
> *core)
>      core->outputDeviceID = deviceID;
>      core->audioDevicePropertyBufferFrameSize =
> audioDevicePropertyBufferFrameSize;
>      core->hw.samples = core->bufferCount *
> core->audioDevicePropertyBufferFrameSize;
> +    audio_generic_initialize_buffer_out(&core->hw);
>      core->ioprocid = ioprocid;
>
>      return 0;
>
> --
> 2.47.1
>
>
>