]> git.proxmox.com Git - mirror_qemu.git/commit - audio/coreaudio.m
coreaudio: always stop audio playback on shut down
authorVolker Rümelin <vr_qemu@t-online.de>
Sun, 13 Dec 2020 13:05:27 +0000 (14:05 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 15 Dec 2020 08:14:17 +0000 (09:14 +0100)
commitceb1165e9d60dcf11bd9c2bb04078a96cdc3c65b
treeea7b32b31a2b514d5a43c5e0791a339c091fd9b0
parent53e78d1cfb43df733a278172dd11bc40d2fe69c8
coreaudio: always stop audio playback on shut down

Always stop audio playback and remove the playback callback when
QEMU exits.

On shut down the function coreaudio_fini_out() destroys the
coreaudio mutex but fails to stop audio playback and to remove the
audio playback callback, because function audio_is_cleaning_up()
always returns true when called from coreaudio_fini_out(). Now
there is a time window from pthread_mutex_destroy() to program
exit where Core Audio may call the audio playback callback which
tries to lock the destroyed coreaudio mutex. This leads to the
following error.

coreaudio: Could not lock voice for audioDeviceIOProc
Reason: Invalid argument

This bug was reported on the qemu-discuss mailing list.
https://lists.nongnu.org/archive/html/qemu-discuss/2020-10/msg00018.html

Tested-by: Howard Spoelstra <hsp.cat7@gmail.com>
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 20201213130528.5863-3-vr_qemu@t-online.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
audio/coreaudio.c