[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 <kode54@gmail.com>
swiftingly
Christopher Snowhill 2022-06-17 22:39:00 -07:00
parent 88b7cd6352
commit 3156aad9e1
1 changed files with 5 additions and 5 deletions

View File

@ -131,7 +131,7 @@ BOOL SetPriorityRealtimeAudio(mach_port_t mach_thread_id) {
nodeChannelConfig = 0; nodeChannelConfig = 0;
nodeLossless = NO; nodeLossless = NO;
if(@available(macOS 11, *)) { if(@available(macOS 12, *)) {
// Get the mach time info. // Get the mach time info.
struct mach_timebase_info timeBaseInfo; struct mach_timebase_info timeBaseInfo;
mach_timebase_info(&timeBaseInfo); mach_timebase_info(&timeBaseInfo);
@ -213,7 +213,7 @@ BOOL SetPriorityRealtimeAudio(mach_port_t mach_thread_id) {
} }
- (BOOL)followWorkgroup { - (BOOL)followWorkgroup {
if(@available(macOS 11, *)) { if(@available(macOS 12, *)) {
if(!wg) { if(!wg) {
if(!workgroup) { if(!workgroup) {
workgroup = AudioWorkIntervalCreate([[NSString stringWithFormat:@"%@ Work Interval %@", [self className], self] UTF8String], clockId, &attr); 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 { - (void)leaveWorkgroup {
if(@available(macOS 11, *)) { if(@available(macOS 12, *)) {
if(wg && wgToken.sig && !isRealtimeError) { if(wg && wgToken.sig && !isRealtimeError) {
os_workgroup_leave(wg, &wgToken); os_workgroup_leave(wg, &wgToken);
bzero(&wgToken, sizeof(wgToken)); bzero(&wgToken, sizeof(wgToken));
@ -256,7 +256,7 @@ BOOL SetPriorityRealtimeAudio(mach_port_t mach_thread_id) {
} }
- (void)startWorkslice { - (void)startWorkslice {
if(@available(macOS 11, *)) { if(@available(macOS 12, *)) {
if(wg && !isRealtimeError && !isDeadlineError) { if(wg && !isRealtimeError && !isDeadlineError) {
const uint64_t currentTime = mach_absolute_time(); const uint64_t currentTime = mach_absolute_time();
const uint64_t deadline = currentTime + intervalMachLength; const uint64_t deadline = currentTime + intervalMachLength;
@ -270,7 +270,7 @@ BOOL SetPriorityRealtimeAudio(mach_port_t mach_thread_id) {
} }
- (void)endWorkslice { - (void)endWorkslice {
if(@available(macOS 11, *)) { if(@available(macOS 12, *)) {
if(wg && !isRealtimeError && !isDeadlineError) { if(wg && !isRealtimeError && !isDeadlineError) {
int result = os_workgroup_interval_finish(wg, nil); int result = os_workgroup_interval_finish(wg, nil);
if(result != 0) { if(result != 0) {