avfvideosrc: element requests camera permissions even with capture-screen property...
authorRoman Shpuntov <roman.shpuntov@gmail.com>
Wed, 11 Dec 2019 07:17:37 +0000 (14:17 +0700)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 11 Dec 2019 17:31:03 +0000 (17:31 +0000)
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1137

macOS has different dialogs for camera capture and screen capture.
No need to request screen capture permissions, the system detect
screen capture automatically and create request dialog.

sys/applemedia/avfvideosrc.m

index 097bf34..147e464 100644 (file)
@@ -430,6 +430,9 @@ static AVCaptureVideoOrientation GstAVFVideoSourceOrientation2AVCaptureVideoOrie
   // Since Mojave, permissions are now supposed to be explicitly granted 
   // before performing anything on a device
   if (@available(macOS 10.14, *)) {
+    if (captureScreen)
+      goto checked;
+
     // Check if permission has already been granted (or denied)
     AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
     switch (authStatus) {
@@ -466,6 +469,7 @@ static AVCaptureVideoOrientation GstAVFVideoSourceOrientation2AVCaptureVideoOrie
     }
   }
 
+checked:
   dispatch_sync (mainQueue, ^{
     BOOL ret;