remove stubbed audio manager implementation until it's clear what to do

with it.

// FREEBIE
pull/1/head
Michael Kirk 8 years ago committed by Matthew Chen
parent 9e248168b9
commit c7449db289

@ -470,17 +470,12 @@ fileprivate let timeoutSeconds = 60
return
}
guard let peerConnectionClient = self.peerConnectionClient else {
handleFailedCall(error: .assertionError(description:"\(TAG) ignoring \(#function) since there is no current peerConnectionClient."))
return
}
switch call.state {
case .dialing:
call.state = .remoteRinging
case .answering:
call.state = .localRinging
self.callUIAdapter.reportIncomingCall(call, thread: thread, audioManager: peerConnectionClient)
self.callUIAdapter.reportIncomingCall(call, thread: thread)
// cancel connection timeout
self.fulfillCallConnectedPromise?()
case .remoteRinging:

@ -28,7 +28,7 @@ class NonCallKitCallUIAdaptee: CallUIAdaptee {
}
}
public func reportIncomingCall(_ call: SignalCall, callerName: String, audioManager: SignalCallAudioManager) {
public func reportIncomingCall(_ call: SignalCall, callerName: String) {
Logger.debug("\(TAG) \(#function)")
// present Call View controller

@ -15,7 +15,7 @@ let kVideoTrackType = kRTCMediaStreamTrackKindVideo
* including audio, video, and some signaling - though the bulk of the signaling is *establishing* the connection,
* meaning we can't use the connection to transmit yet.
*/
class PeerConnectionClient: NSObject, SignalCallAudioManager {
class PeerConnectionClient: NSObject {
let TAG = "[PeerConnectionClient]"
enum Identifiers: String {

@ -22,14 +22,6 @@ final class CallKitCallUIAdaptee: NSObject, CallUIAdaptee, CXProviderDelegate {
internal let notificationsAdapter: CallNotificationsAdapter
private let provider: CXProvider
// FIXME - I might be thinking about this the wrong way.
// It seems like the provider delegate wants to stop/start the audio recording
// process, but the ProviderDelegate is an app singleton
// and the audio recording process is currently controlled (I think) by
// the PeerConnectionClient instance, which is one per call (NOT a singleton).
// It seems like a mess to reconcile this difference in cardinality. But... here we are.
var audioManager: SignalCallAudioManager?
/// The app's provider configuration, representing its CallKit capabilities
static var providerConfiguration: CXProviderConfiguration {
let localizedName = NSLocalizedString("APPLICATION_NAME", comment: "Name of application")
@ -70,8 +62,7 @@ final class CallKitCallUIAdaptee: NSObject, CallUIAdaptee, CXProviderDelegate {
callManager.startCall(call)
}
// TODO CodeCleanup: remove unused audiomanager
internal func reportIncomingCall(_ call: SignalCall, callerName: String, audioManager: SignalCallAudioManager) {
internal func reportIncomingCall(_ call: SignalCall, callerName: String) {
// Construct a CXCallUpdate describing the incoming call, including the caller.
let update = CXCallUpdate()
update.remoteHandle = CXHandle(type: .phoneNumber, value: call.remotePhoneNumber)
@ -109,7 +100,10 @@ final class CallKitCallUIAdaptee: NSObject, CallUIAdaptee, CXProviderDelegate {
func providerDidReset(_ provider: CXProvider) {
Logger.debug("\(TAG) in \(#function)")
stopAudio()
// TODO
// copied from Speakerbox, but is there a corallary with peerconnection, since peer connection starts the audio
// session when adding an audiotrack
// stopAudio()
/*
End any ongoing calls if the provider resets, and remove them from the app's list of calls,
@ -132,7 +126,10 @@ final class CallKitCallUIAdaptee: NSObject, CallUIAdaptee, CXProviderDelegate {
Configure the audio session, but do not start call audio here, since it must be done once
the audio session has been activated by the system after having its priority elevated.
*/
configureAudioSession()
// TODO
// copied from Speakerbox, but is there a corallary with peerconnection, since peer connection starts the audio
// session when adding an audiotrack
//configureAudioSession()
// TODO does this work when `action.handle.value` is not in e164 format, e.g. if called via intent?
guard let call = callManager.callWithLocalId(action.callUUID) else {
@ -247,7 +244,10 @@ final class CallKitCallUIAdaptee: NSObject, CallUIAdaptee, CXProviderDelegate {
func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) {
Logger.debug("\(TAG) Received \(#function)")
startAudio()
// TODO
// copied from Speakerbox, but is there a corallary with peerconnection, since peer connection starts the audio
// session when adding an audiotrack
// startAudio()
}
func provider(_ provider: CXProvider, didDeactivate audioSession: AVAudioSession) {
@ -258,33 +258,4 @@ final class CallKitCallUIAdaptee: NSObject, CallUIAdaptee, CXProviderDelegate {
de-activated after having its priority restored to normal.
*/
}
// MARK: - Audio
func startAudio() {
guard let audioManager = self.audioManager else {
Logger.error("\(TAG) audioManager was unexpectedly nil while tryign to start audio")
return
}
audioManager.startAudio()
}
func stopAudio() {
guard let audioManager = self.audioManager else {
Logger.error("\(TAG) audioManager was unexpectedly nil while tryign to stop audio")
return
}
audioManager.stopAudio()
}
func configureAudioSession() {
guard let audioManager = self.audioManager else {
Logger.error("\(TAG) audioManager was unexpectedly nil while trying to: \(#function)")
return
}
audioManager.configureAudioSession()
}
}

@ -9,7 +9,7 @@ protocol CallUIAdaptee {
var notificationsAdapter: CallNotificationsAdapter { get }
func startOutgoingCall(_ call: SignalCall)
func reportIncomingCall(_ call: SignalCall, callerName: String, audioManager: SignalCallAudioManager)
func reportIncomingCall(_ call: SignalCall, callerName: String)
func reportMissedCall(_ call: SignalCall, callerName: String)
func answerCall(_ call: SignalCall)
func declineCall(_ call: SignalCall)
@ -55,9 +55,9 @@ class CallUIAdapter {
}
}
internal func reportIncomingCall(_ call: SignalCall, thread: TSContactThread, audioManager: SignalCallAudioManager) {
internal func reportIncomingCall(_ call: SignalCall, thread: TSContactThread) {
let callerName = self.contactsManager.displayName(forPhoneIdentifier: call.remotePhoneNumber)
adaptee.reportIncomingCall(call, callerName: callerName, audioManager: audioManager)
adaptee.reportIncomingCall(call, callerName: callerName)
}
internal func reportMissedCall(_ call: SignalCall) {
@ -87,40 +87,3 @@ class CallUIAdapter {
adaptee.showCall(call)
}
}
/**
* FIXME TODO I actually don't yet understand the role of these CallAudioManager methods as
* called in the speakerbox example. Are they redundant with what the RTC setup
* already does for us?
*
* Here's the AVSessionConfig for the ARDRTC Example app, which maybe belongs
* in the coonfigureAudio session. and maybe the adding audio tracks is sufficient for startAudio's implenetation?
*
*
187 RTCAudioSessionConfiguration *configuration =
188 [[RTCAudioSessionConfiguration alloc] init];
189 configuration.category = AVAudioSessionCategoryAmbient;
190 configuration.categoryOptions = AVAudioSessionCategoryOptionDuckOthers;
191 configuration.mode = AVAudioSessionModeDefault;
192
193 RTCAudioSession *session = [RTCAudioSession sharedInstance];
194 [session lockForConfiguration];
195 BOOL hasSucceeded = NO;
196 NSError *error = nil;
197 if (session.isActive) {
198 hasSucceeded = [session setConfiguration:configuration error:&error];
199 } else {
200 hasSucceeded = [session setConfiguration:configuration
201 active:YES
202 error:&error];
203 }
204 if (!hasSucceeded) {
205 RTCLogError(@"Error setting configuration: %@", error.localizedDescription);
206 }
207 [session unlockForConfiguration];
*/
protocol SignalCallAudioManager {
func startAudio()
func stopAudio()
func configureAudioSession()
}

Loading…
Cancel
Save