From c82b3f9d51b9f87cc76376d6bffe7cd6f5315309 Mon Sep 17 00:00:00 2001 From: Adi Li Date: Tue, 25 Apr 2017 19:32:51 +0800 Subject: [PATCH] Fix: #107 Remove deprecation warning caused by `DispatchQueue.GlobalQueuePriority` --- framework/GPUImage.xcodeproj/project.pbxproj | 17 +++++++++------- framework/Source/Mac/Camera.swift | 4 ++-- framework/Source/Mac/MovieInput.swift | 2 +- framework/Source/SerialDispatch.swift | 21 ++++++++++---------- framework/Source/iOS/Camera.swift | 4 ++-- framework/Source/iOS/MovieInput.swift | 2 +- 6 files changed, 26 insertions(+), 24 deletions(-) diff --git a/framework/GPUImage.xcodeproj/project.pbxproj b/framework/GPUImage.xcodeproj/project.pbxproj index a18a613c..60193007 100755 --- a/framework/GPUImage.xcodeproj/project.pbxproj +++ b/framework/GPUImage.xcodeproj/project.pbxproj @@ -1290,7 +1290,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0820; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0830; ORGANIZATIONNAME = "Sunset Lake Software LLC"; TargetAttributes = { BC6E7CAA1C39A9D8006DF678 = { @@ -1306,7 +1306,6 @@ }; BC9E34F01E524A2200B8604F = { CreatedOnToolsVersion = 8.2.1; - DevelopmentTeam = 7P4K3HK5JL; ProvisioningStyle = Automatic; }; }; @@ -1758,8 +1757,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "-"; @@ -1808,8 +1809,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "-"; @@ -1876,7 +1879,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.sunsetlakesoftware.GPUImage; PRODUCT_NAME = GPUImage; SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 3.0; }; name = Release; @@ -1914,7 +1917,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; @@ -1943,7 +1946,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; @@ -1974,7 +1977,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEVELOPMENT_TEAM = 7P4K3HK5JL; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "$(SRCROOT)/GPUImage.xcodeproj/GPUImageTestSuite_Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 10.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1996,7 +1999,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEVELOPMENT_TEAM = 7P4K3HK5JL; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "$(SRCROOT)/GPUImage.xcodeproj/GPUImageTestSuite_Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 10.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; diff --git a/framework/Source/Mac/Camera.swift b/framework/Source/Mac/Camera.swift index b8f02ae6..6617adfc 100755 --- a/framework/Source/Mac/Camera.swift +++ b/framework/Source/Mac/Camera.swift @@ -35,8 +35,8 @@ public class Camera: NSObject, ImageSource, AVCaptureVideoDataOutputSampleBuffer let captureAsYUV:Bool let yuvConversionShader:ShaderProgram? let frameRenderingSemaphore = DispatchSemaphore(value:1) - let cameraProcessingQueue = DispatchQueue.global(priority:standardProcessingQueuePriority) - let audioProcessingQueue = DispatchQueue.global(priority:lowProcessingQueuePriority) + let cameraProcessingQueue = standardProcessingQueue() + let audioProcessingQueue = lowProcessingQueue() var numberOfFramesCaptured = 0 var totalFrameTimeDuringCapture:Double = 0.0 diff --git a/framework/Source/Mac/MovieInput.swift b/framework/Source/Mac/MovieInput.swift index ec6cec15..635d7165 100644 --- a/framework/Source/Mac/MovieInput.swift +++ b/framework/Source/Mac/MovieInput.swift @@ -44,7 +44,7 @@ public class MovieInput: ImageSource { public func start() { asset.loadValuesAsynchronously(forKeys: ["tracks"], completionHandler: { - DispatchQueue.global(priority:standardProcessingQueuePriority).async { + standardProcessingQueue().async { guard (self.asset.statusOfValue(forKey:"tracks", error:nil) == .loaded) else { return } guard self.assetReader.startReading() else { diff --git a/framework/Source/SerialDispatch.swift b/framework/Source/SerialDispatch.swift index bdf32f1d..84beec3d 100755 --- a/framework/Source/SerialDispatch.swift +++ b/framework/Source/SerialDispatch.swift @@ -18,22 +18,21 @@ extension SerialDispatch { #else -public let standardProcessingQueuePriority:DispatchQueue.GlobalQueuePriority = { - // DispatchQueue.QoSClass.default - if #available(iOS 10, OSX 10.10, *) { - return DispatchQueue.GlobalQueuePriority.default +public func standardProcessingQueue() -> DispatchQueue { + if #available(iOS 8.0, OSX 10.10, *) { + return DispatchQueue.global(qos: .default) } else { - return DispatchQueue.GlobalQueuePriority.default + return DispatchQueue.global(priority: .default) } -}() +} -public let lowProcessingQueuePriority:DispatchQueue.GlobalQueuePriority = { - if #available(iOS 10, OSX 10.10, *) { - return DispatchQueue.GlobalQueuePriority.low +public func lowProcessingQueue() -> DispatchQueue { + if #available(iOS 8.0, OSX 10.10, *) { + return DispatchQueue.global(qos: .utility) } else { - return DispatchQueue.GlobalQueuePriority.low + return DispatchQueue.global(priority: .low) } -}() +} func runAsynchronouslyOnMainQueue(_ mainThreadOperation:@escaping () -> ()) { if (Thread.isMainThread) { diff --git a/framework/Source/iOS/Camera.swift b/framework/Source/iOS/Camera.swift index 0c7f4950..338333d4 100755 --- a/framework/Source/iOS/Camera.swift +++ b/framework/Source/iOS/Camera.swift @@ -77,8 +77,8 @@ public class Camera: NSObject, ImageSource, AVCaptureVideoDataOutputSampleBuffer let captureAsYUV:Bool let yuvConversionShader:ShaderProgram? let frameRenderingSemaphore = DispatchSemaphore(value:1) - let cameraProcessingQueue = DispatchQueue.global(priority:DispatchQueue.GlobalQueuePriority.default) - let audioProcessingQueue = DispatchQueue.global(priority:DispatchQueue.GlobalQueuePriority.default) + let cameraProcessingQueue = DispatchQueue.global() + let audioProcessingQueue = DispatchQueue.global() let framesToIgnore = 5 var numberOfFramesCaptured = 0 diff --git a/framework/Source/iOS/MovieInput.swift b/framework/Source/iOS/MovieInput.swift index 8db20754..6af000a5 100644 --- a/framework/Source/iOS/MovieInput.swift +++ b/framework/Source/iOS/MovieInput.swift @@ -44,7 +44,7 @@ public class MovieInput: ImageSource { public func start() { asset.loadValuesAsynchronously(forKeys:["tracks"], completionHandler:{ - DispatchQueue.global(priority:DispatchQueue.GlobalQueuePriority.default).async(execute: { + DispatchQueue.global().async(execute: { guard (self.asset.statusOfValue(forKey: "tracks", error:nil) == .loaded) else { return } guard self.assetReader.startReading() else {