From 8937a2cafaeee0c9346b1ad7b1142c1654985545 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Tue, 8 Aug 2017 15:51:54 +0200 Subject: [PATCH] initiate nil NSError --- Classes/LinphoneManager.m | 9 ++++++--- Classes/ProviderDelegate.m | 14 ++++++++++---- submodules/mediastreamer2 | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 25278d717..d7a381b72 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -1976,10 +1976,11 @@ static BOOL libStarted = FALSE; // init audio session (just getting the instance will init) AVAudioSession *audioSession = [AVAudioSession sharedInstance]; BOOL bAudioInputAvailable = audioSession.inputAvailable; - NSError *err; + NSError *err = nil; if (![audioSession setActive:NO error:&err] && err) { LOGE(@"audioSession setActive failed: %@", [err description]); + err = nil; } if (!bAudioInputAvailable) { UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"No microphone", nil) @@ -2601,7 +2602,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { - (void)setSpeakerEnabled:(BOOL)enable { _speakerEnabled = enable; - NSError *err; + NSError *err = nil; if (enable && [self allowSpeaker]) { [[AVAudioSession sharedInstance] overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:&err]; @@ -2615,6 +2616,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { if (err) { LOGE(@"Failed to change audio route: err %@", err.localizedDescription); + err = nil; } } @@ -2623,7 +2625,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { // The change of route will be done in setSpeakerEnabled _bluetoothEnabled = enable; if (_bluetoothEnabled) { - NSError *err; + NSError *err = nil; AVAudioSessionPortDescription *_bluetoothPort = [AudioHelper bluetoothAudioDevice]; [[AVAudioSession sharedInstance] setPreferredInput:_bluetoothPort error:&err]; // if setting bluetooth failed, it must be because the device is not available @@ -2631,6 +2633,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { if (err) { _bluetoothEnabled = FALSE; LOGE(@"Failed to enable bluetooth: err %@", err.localizedDescription); + err = nil; } else { _speakerEnabled = FALSE; return; diff --git a/Classes/ProviderDelegate.m b/Classes/ProviderDelegate.m index 56367603c..2a53eca43 100644 --- a/Classes/ProviderDelegate.m +++ b/Classes/ProviderDelegate.m @@ -50,19 +50,25 @@ } - (void)configAudioSession:(AVAudioSession *)audioSession { - NSError *err; + NSError *err = nil; [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionAllowBluetooth error:&err]; - if (err) + if (err) { LOGE(@"Unable to change audio category because : %@", err.localizedDescription); + err = nil; + } [audioSession setMode:AVAudioSessionModeVoiceChat error:&err]; - if (err) + if (err) { LOGE(@"Unable to change audio mode because : %@", err.localizedDescription); + err = nil; + } double sampleRate = 44100.0; [audioSession setPreferredSampleRate:sampleRate error:&err]; - if (err) + if (err) { LOGE(@"Unable to change preferred sample rate because : %@", err.localizedDescription); + err = nil; + } } - (void)reportIncomingCallwithUUID:(NSUUID *)uuid handle:(NSString *)handle video:(BOOL)video { diff --git a/submodules/mediastreamer2 b/submodules/mediastreamer2 index 7b52d48ca..f059576a4 160000 --- a/submodules/mediastreamer2 +++ b/submodules/mediastreamer2 @@ -1 +1 @@ -Subproject commit 7b52d48ca3d0efdf446e984c2ce2d077766f88a0 +Subproject commit f059576a44212c02d4e70bcd310b2d2507334334