From 3156aad9e1a0459f90a6198f4b8aa3f14192ab7a Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Fri, 17 Jun 2022 22:39:00 -0700 Subject: [PATCH] [Audio Threads] Restrict workgroup use to macOS 12 Restrict the use of workgroup joining and workgroup intervals to macOS Monterey or newer, as it seems the way I use it, it's completely broken on macOS Big Sur, which was the original minimum target for the API. Signed-off-by: Christopher Snowhill --- Audio/Chain/Node.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Audio/Chain/Node.m b/Audio/Chain/Node.m index 1fcf259c7..9831c3eba 100644 --- a/Audio/Chain/Node.m +++ b/Audio/Chain/Node.m @@ -131,7 +131,7 @@ BOOL SetPriorityRealtimeAudio(mach_port_t mach_thread_id) { nodeChannelConfig = 0; nodeLossless = NO; - if(@available(macOS 11, *)) { + if(@available(macOS 12, *)) { // Get the mach time info. struct mach_timebase_info timeBaseInfo; mach_timebase_info(&timeBaseInfo); @@ -213,7 +213,7 @@ BOOL SetPriorityRealtimeAudio(mach_port_t mach_thread_id) { } - (BOOL)followWorkgroup { - if(@available(macOS 11, *)) { + if(@available(macOS 12, *)) { if(!wg) { if(!workgroup) { workgroup = AudioWorkIntervalCreate([[NSString stringWithFormat:@"%@ Work Interval %@", [self className], self] UTF8String], clockId, &attr); @@ -246,7 +246,7 @@ BOOL SetPriorityRealtimeAudio(mach_port_t mach_thread_id) { } - (void)leaveWorkgroup { - if(@available(macOS 11, *)) { + if(@available(macOS 12, *)) { if(wg && wgToken.sig && !isRealtimeError) { os_workgroup_leave(wg, &wgToken); bzero(&wgToken, sizeof(wgToken)); @@ -256,7 +256,7 @@ BOOL SetPriorityRealtimeAudio(mach_port_t mach_thread_id) { } - (void)startWorkslice { - if(@available(macOS 11, *)) { + if(@available(macOS 12, *)) { if(wg && !isRealtimeError && !isDeadlineError) { const uint64_t currentTime = mach_absolute_time(); const uint64_t deadline = currentTime + intervalMachLength; @@ -270,7 +270,7 @@ BOOL SetPriorityRealtimeAudio(mach_port_t mach_thread_id) { } - (void)endWorkslice { - if(@available(macOS 11, *)) { + if(@available(macOS 12, *)) { if(wg && !isRealtimeError && !isDeadlineError) { int result = os_workgroup_interval_finish(wg, nil); if(result != 0) {