qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v6 3/5] coreaudio: Commit the result of init in the end


From: BALATON Zoltan
Subject: Re: [PATCH v6 3/5] coreaudio: Commit the result of init in the end
Date: Fri, 24 Jan 2025 13:35:54 +0100 (CET)

On Fri, 24 Jan 2025, BALATON Zoltan wrote:
On Fri, 24 Jan 2025, Akihiko Odaki wrote:
init_out_device may only commit some part of the result and leave the
state inconsistent when it encounters a fatal error or the device gets
unplugged during the operation, which is expressed by
kAudioHardwareBadObjectError or kAudioHardwareBadDeviceError. Commit the
result in the end of the function so that it commits the result iff it
sees no fatal error and the device remains plugged.

With this change, handle_voice_change can rely on core->outputDeviceID
to know whether the output device is initialized after calling
init_out_device.

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

diff --git a/audio/coreaudio.m b/audio/coreaudio.m
index c3ede586bbee1711d6a798175995b8db7dc89398..aff2b37b12aca723849645297c04f30ed365b8f8 100644
--- a/audio/coreaudio.m
+++ b/audio/coreaudio.m
@@ -357,7 +357,10 @@ static OSStatus out_device_ioproc(
static OSStatus init_out_device(CoreaudioVoiceOut *core)
{
    OSStatus status;
+    AudioDeviceID device_id;
    AudioValueRange framerange;
+    UInt32 device_frame_size;
+    AudioDeviceIOProcID ioprocid;

    AudioStreamBasicDescription stream_basic_description = {
        .mBitsPerChannel = core->hw.info.bits,
@@ -370,20 +373,19 @@ static OSStatus init_out_device(CoreaudioVoiceOut *core)
        .mSampleRate = core->hw.info.freq
    };

-    status = coreaudio_get_voice_out(&core->device_id);
+    status = coreaudio_get_voice_out(&device_id);
    if (status != kAudioHardwareNoError) {
        coreaudio_playback_logerr (status,

Still spaces in function calls here and in dolog() calls below.

Already fixed in next version, sorry for the noise.

Regards,
BALATON Zoltan



reply via email to

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