From cc2b27d43ff68ad1c85a6ea882b2f24589a81458 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Wed, 26 Jan 2022 23:40:18 -0800 Subject: [PATCH] Core Audio output: Potential shutdown fix The thread wait on shutdown had the potential to lock up waiting for the thread to shut down. Now it should at least spam the semaphores, so that the thread should progress to shutdown a lot quicker. Signed-off-by: Christopher Snowhill --- Audio/Output/OutputCoreAudio.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Audio/Output/OutputCoreAudio.m b/Audio/Output/OutputCoreAudio.m index 065e65c0d..af251097e 100644 --- a/Audio/Output/OutputCoreAudio.m +++ b/Audio/Output/OutputCoreAudio.m @@ -733,8 +733,11 @@ default_device_changed(AudioObjectID inObjectID, UInt32 inNumberAddresses, const - (void)stop { if (stopNext && started && !paused) { - while (![[outputController buffer] isEmpty]) + while (![[outputController buffer] isEmpty]) { + [writeSemaphore signal]; + [readSemaphore signal]; usleep(500); + } } if (stopNext) { stopNext = NO;