From 5da2938244105bca2e37144ba1940b9af4903871 Mon Sep 17 00:00:00 2001 From: Roman Shpuntov Date: Wed, 11 Dec 2019 14:17:37 +0700 Subject: [PATCH] avfvideosrc: element requests camera permissions even with capture-screen property is true 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/applemedia/avfvideosrc.m b/sys/applemedia/avfvideosrc.m index 097bf34..147e464 100644 --- a/sys/applemedia/avfvideosrc.m +++ b/sys/applemedia/avfvideosrc.m @@ -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; -- 2.7.4