From e8e9616d579058e9e69ac2ff629a05ba9446be28 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Fri, 3 Oct 2014 14:25:14 +0200 Subject: [PATCH] Fix Wizard bug (ms_exit() called too many times) --- Classes/LinphoneManager.m | 55 ++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 2c8288cf5..2c466a544 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -1264,37 +1264,12 @@ static BOOL libStarted = FALSE; connectivity = none; signal(SIGPIPE, SIG_IGN); - ms_init(); // Need to initialize mediastreamer2 before loading the plugins - - libmsilbc_init(); -#if defined (HAVE_SILK) - libmssilk_init(); -#endif -#ifdef HAVE_AMR - libmsamr_init(); //load amr plugin if present from the liblinphone sdk -#endif -#ifdef HAVE_X264 - libmsx264_init(); //load x264 plugin if present from the liblinphone sdk -#endif -#ifdef HAVE_OPENH264 - libmsopenh264_init(); //load openh264 plugin if present from the liblinphone sdk -#endif - -#if HAVE_G729 - libmsbcg729_init(); // load g729 plugin -#endif - - /*to make sure we don't loose debug trace*/ - if ([self lpConfigBoolForKey:@"debugenable_preference"]) { - linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler); - ortp_set_log_level_mask(ORTP_DEBUG|ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL); - } // create linphone core [self createLinphoneCore]; linphone_core_migrate_to_multi_transport(theLinphoneCore); - //init audio session + // init audio session (just getting the instance will init) AVAudioSession *audioSession = [AVAudioSession sharedInstance]; BOOL bAudioInputAvailable= audioSession.inputAvailable; NSError* err; @@ -1330,6 +1305,32 @@ static BOOL libStarted = FALSE; connectivity=none; + ms_init(); // Need to initialize mediastreamer2 before loading the plugins + + libmsilbc_init(); +#if defined (HAVE_SILK) + libmssilk_init(); +#endif +#ifdef HAVE_AMR + libmsamr_init(); //load amr plugin if present from the liblinphone sdk +#endif +#ifdef HAVE_X264 + libmsx264_init(); //load x264 plugin if present from the liblinphone sdk +#endif +#ifdef HAVE_OPENH264 + libmsopenh264_init(); //load openh264 plugin if present from the liblinphone sdk +#endif + +#if HAVE_G729 + libmsbcg729_init(); // load g729 plugin +#endif + + /*to make sure we don't loose debug trace*/ + if ([self lpConfigBoolForKey:@"debugenable_preference"]) { + linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler); + ortp_set_log_level_mask(ORTP_DEBUG|ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL); + } + theLinphoneCore = linphone_core_new_with_config (&linphonec_vtable ,configDb @@ -1346,7 +1347,7 @@ static BOOL libStarted = FALSE; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(globalStateChangedNotificationHandler:) name:kLinphoneGlobalStateUpdate object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(configuringStateChangedNotificationHandler:) name:kLinphoneConfiguringStateUpdate object:nil]; - /*call iterate once immediately in order to initiate background connections with sip server, if any */ + /*call iterate once immediately in order to initiate background connections with sip server or remote provisioning grab, if any */ linphone_core_iterate(theLinphoneCore); // start scheduler mIterateTimer = [NSTimer scheduledTimerWithTimeInterval:0.02