Added API check to allow compilation/run with mac os < 10.14
authorArmin Novak <armin.novak@thincast.com>
Tue, 2 Mar 2021 08:11:28 +0000 (09:11 +0100)
committerakallabeth <akallabeth@users.noreply.github.com>
Fri, 5 Mar 2021 09:06:54 +0000 (10:06 +0100)
(cherry picked from commit 1cd97c327048ce87bb4e6da307f9ff959497cd3e)

channels/audin/client/mac/audin_mac.m

index a9742b3..ecf3c8c 100644 (file)
@@ -420,33 +420,38 @@ UINT freerdp_audin_client_subsystem_entry(PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEn
                goto error_out;
        }
 
-       AVAuthorizationStatus status =
-           [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio];
-       switch (status)
+#if defined(MAC_OS_X_VERSION_10_14)
+       if (@available(macOS 10.14, *))
        {
-               case AVAuthorizationStatusAuthorized:
-                       mac->isAuthorized = TRUE;
-                       break;
-               case AVAuthorizationStatusNotDetermined:
-                       [AVCaptureDevice requestAccessForMediaType:AVMediaTypeAudio
-                                                completionHandler:^(BOOL granted) {
-                                                        if (granted == YES)
-                                                        {
-                                                                mac->isAuthorized = TRUE;
-                                                        }
-                                                        else
-                                                                WLog_WARN(TAG, "Microphone access denied by user");
-                                                }];
-                       break;
-               case AVAuthorizationStatusRestricted:
-                       WLog_WARN(TAG, "Microphone access restricted by policy");
-                       break;
-               case AVAuthorizationStatusDenied:
-                       WLog_WARN(TAG, "Microphone access denied by policy");
-                       break;
-               default:
-                       break;
+               AVAuthorizationStatus status =
+                   [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio];
+               switch (status)
+               {
+                       case AVAuthorizationStatusAuthorized:
+                               mac->isAuthorized = TRUE;
+                               break;
+                       case AVAuthorizationStatusNotDetermined:
+                               [AVCaptureDevice requestAccessForMediaType:AVMediaTypeAudio
+                                                        completionHandler:^(BOOL granted) {
+                                                                if (granted == YES)
+                                                                {
+                                                                        mac->isAuthorized = TRUE;
+                                                                }
+                                                                else
+                                                                        WLog_WARN(TAG, "Microphone access denied by user");
+                                                        }];
+                               break;
+                       case AVAuthorizationStatusRestricted:
+                               WLog_WARN(TAG, "Microphone access restricted by policy");
+                               break;
+                       case AVAuthorizationStatusDenied:
+                               WLog_WARN(TAG, "Microphone access denied by policy");
+                               break;
+                       default:
+                               break;
+               }
        }
+#endif
 
        return CHANNEL_RC_OK;
 error_out: