Experimentations for extracting the core from the main thread
This commit is contained in:
@@ -23,7 +23,7 @@ class CallKitProviderDelegate : NSObject
|
||||
init(context: CallKitExampleContext)
|
||||
{
|
||||
tutorialContext = context
|
||||
let providerConfiguration = CXProviderConfiguration(localizedName: Bundle.main.infoDictionary!["CFBundleName"] as! String)
|
||||
let providerConfiguration = CXProviderConfiguration()
|
||||
providerConfiguration.supportsVideo = true
|
||||
providerConfiguration.supportedHandleTypes = [.generic]
|
||||
|
||||
@@ -38,6 +38,7 @@ class CallKitProviderDelegate : NSObject
|
||||
|
||||
func incomingCall()
|
||||
{
|
||||
NSLog("Callkit incomingCall -- Is main thread ? \(Thread.isMainThread ? "yes" : "no") ")
|
||||
incomingCallUUID = UUID()
|
||||
let update = CXCallUpdate()
|
||||
update.remoteHandle = CXHandle(type:.generic, value: tutorialContext.incomingCallName)
|
||||
@@ -47,6 +48,7 @@ class CallKitProviderDelegate : NSObject
|
||||
|
||||
func stopCall()
|
||||
{
|
||||
NSLog("Callkit stopCall -- Is main thread ? \(Thread.isMainThread ? "yes" : "no") ")
|
||||
let endCallAction = CXEndCallAction(call: incomingCallUUID)
|
||||
let transaction = CXTransaction(action: endCallAction)
|
||||
|
||||
@@ -61,6 +63,7 @@ class CallKitProviderDelegate : NSObject
|
||||
extension CallKitProviderDelegate: CXProviderDelegate {
|
||||
|
||||
func provider(_ provider: CXProvider, perform action: CXEndCallAction) {
|
||||
NSLog("Callkit CXEndCallAction -- Is main thread ? \(Thread.isMainThread ? "yes" : "no") ")
|
||||
do {
|
||||
if (tutorialContext.mCall?.state != .End && tutorialContext.mCall?.state != .Released) {
|
||||
try tutorialContext.mCall?.terminate()
|
||||
@@ -73,6 +76,7 @@ extension CallKitProviderDelegate: CXProviderDelegate {
|
||||
}
|
||||
|
||||
func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {
|
||||
NSLog("Callkit CXAnswerCallAction -- Is main thread ? \(Thread.isMainThread ? "yes" : "no") ")
|
||||
do {
|
||||
// The audio stream is going to start shortly: the AVAudioSession must be configured now.
|
||||
// It is worth to note that an application does not have permission to configure the
|
||||
@@ -102,13 +106,18 @@ extension CallKitProviderDelegate: CXProviderDelegate {
|
||||
func providerDidReset(_ provider: CXProvider) {}
|
||||
|
||||
func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) {
|
||||
NSLog("Callkit didActivateaudiosession -- Is main thread ? \(Thread.isMainThread ? "yes" : "no") ")
|
||||
// The linphone Core must be notified that CallKit has activated the AVAudioSession
|
||||
// in order to start streaming audio.
|
||||
tutorialContext.mCore.activateAudioSession(actived: true)
|
||||
tutorialContext.postOnCoreQueue {
|
||||
self.tutorialContext.mCore.activateAudioSession(actived: true)
|
||||
}
|
||||
}
|
||||
|
||||
func provider(_ provider: CXProvider, didDeactivate audioSession: AVAudioSession) {
|
||||
// The linphone Core must be notified that CallKit has deactivated the AVAudioSession.
|
||||
tutorialContext.mCore.activateAudioSession(actived: false)
|
||||
tutorialContext.postOnCoreQueue {
|
||||
self.tutorialContext.mCore.activateAudioSession(actived: false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user