remove GetFlags call from main thread (can block)

fix crash with battery level changes
update exosip
This commit is contained in:
Simon Morlat 2012-09-07 16:01:04 +02:00
parent 3c3ad88b84
commit dd70124919
4 changed files with 10 additions and 33 deletions

View file

@ -503,7 +503,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
} else if (proxy){
int defaultExpire = [[LinphoneManager instance] lpConfigIntForKey:@"default_expires"];
if (defaultExpire>=0)
linphone_proxy_config_expires(proxy, defaultExpire);
linphone_proxy_config_expires(proxy, defaultExpire);
//else keep default value from linphonecore
}
@ -538,13 +538,6 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
proxyReachability = SCNetworkReachabilityCreateWithName(nil, nodeName);
//initial state is network off should be done as soon as possible
SCNetworkReachabilityFlags flags;
if (!SCNetworkReachabilityGetFlags(proxyReachability, &flags)) {
[LinphoneLogger logc:LinphoneLoggerError format:"Cannot get reachability flags: %s", SCErrorString(SCError())];
return;
}
networkReachabilityCallBack(proxyReachability, flags, ctx ? ctx->info : 0);
if (!SCNetworkReachabilitySetCallback(proxyReachability, (SCNetworkReachabilityCallBack)networkReachabilityCallBack, ctx)){
[LinphoneLogger logc:LinphoneLoggerError format:"Cannot register reachability cb: %s", SCErrorString(SCError())];
@ -712,12 +705,7 @@ static LinphoneCoreVTable linphonec_vtable = {
[mIterateTimer invalidate];
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
[audioSession setDelegate:nil];
#if 0
if (settingsStore != nil) {
[settingsStore release];
settingsStore = nil;
}
#endif
if (theLinphoneCore != nil) { //just in case application terminate before linphone core initialization
[LinphoneLogger logc:LinphoneLoggerLog format:"Destroy linphonecore"];
linphone_core_destroy(theLinphoneCore);
@ -772,8 +760,7 @@ static LinphoneCoreVTable linphonec_vtable = {
if (proxyCfg && [[NSUserDefaults standardUserDefaults] boolForKey:@"backgroundmode_preference"]) {
//For registration register
linphone_core_refresh_registers(theLinphoneCore);
[self refreshRegisters];
//wait for registration answer
int i=0;
while (!linphone_proxy_config_is_registered(proxyCfg) && i++<40 ) {
@ -833,21 +820,10 @@ static LinphoneCoreVTable linphonec_vtable = {
}
- (void)refreshRegisters{
/*first check if network is available*/
if (proxyReachability){
SCNetworkReachabilityFlags flags=0;
if (!SCNetworkReachabilityGetFlags(proxyReachability, &flags)) {
[LinphoneLogger logc:LinphoneLoggerError format:"Cannot get reachability flags, re-creating reachability context."];
[self setupNetworkReachabilityCallback];
}else{
networkReachabilityCallBack(proxyReachability, flags, 0);
if (flags==0){
/*workaround iOS bug: reachability API cease to work after some time.*/
/*when flags==0, either we have no network, or the reachability object lies. To workaround, create a new one*/
[self setupNetworkReachabilityCallback];
}
}
}else [LinphoneLogger logc:LinphoneLoggerError format:"No proxy reachability context created !"];
if (connectivity==none){
//don't trust ios when he says there is no network. Create a new reachability context, the previous one might be mis-functionning.
[self setupNetworkReachabilityCallback];
}
linphone_core_refresh_registers(theLinphoneCore);//just to make sure REGISTRATION is up to date
}

View file

@ -661,6 +661,7 @@ static PhoneMainView* phoneMainViewInstance=nil;
}
- (void)batteryLevelChanged:(NSNotification*)notif {
if (! [LinphoneManager isLcReady]) return;
LinphoneCall* call = linphone_core_get_current_call([LinphoneManager getLc]);
if (!call || !linphone_call_params_video_enabled(linphone_call_get_current_params(call)))
return;

@ -1 +1 @@
Subproject commit cabb39c79560ab11c3dc668ce9d5fee8ea19e832
Subproject commit 1195a20a0c61bb90b9b580ca6f394c742236dda8

@ -1 +1 @@
Subproject commit 88703bcc139e124598732b0babc762fddff0309c
Subproject commit f815b0d5aaec61743302a1a5c48f62abe8224948