mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
initiate nil NSError
This commit is contained in:
parent
b7b58352c9
commit
8937a2cafa
3 changed files with 17 additions and 8 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 7b52d48ca3d0efdf446e984c2ce2d077766f88a0
|
||||
Subproject commit f059576a44212c02d4e70bcd310b2d2507334334
|
||||
Loading…
Add table
Reference in a new issue