diff --git a/Classes/DialerViewController.m b/Classes/DialerViewController.m index 791696d75..3820b6639 100644 --- a/Classes/DialerViewController.m +++ b/Classes/DialerViewController.m @@ -137,18 +137,20 @@ static UICompositeViewDescription *compositeDescription = nil; object:nil]; // Update on show if([LinphoneManager isLcReady]) { + LinphoneManager *mgr=[LinphoneManager instance]; LinphoneCore* lc = [LinphoneManager getLc]; LinphoneCall* call = linphone_core_get_current_call(lc); LinphoneCallState state = (call != NULL)?linphone_call_get_state(call): 0; [self callUpdate:call state:state]; if([LinphoneManager runningOnIpad]) { - if(linphone_core_video_enabled(lc) && linphone_core_video_preview_enabled(lc)) { + if(linphone_core_video_enabled(lc) && [mgr lpConfigBoolForKey:@"preview_preference"]) { linphone_core_set_native_preview_window_id(lc, (unsigned long)videoPreview); [backgroundView setHidden:FALSE]; [videoCameraSwitch setHidden:FALSE]; } else { linphone_core_set_native_preview_window_id(lc, (unsigned long)NULL); + linphone_core_enable_video_preview(lc, FALSE); [backgroundView setHidden:TRUE]; [videoCameraSwitch setHidden:TRUE]; } @@ -180,7 +182,6 @@ static UICompositeViewDescription *compositeDescription = nil; [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneCoreUpdate object:nil]; - } - (void)viewDidLoad { diff --git a/Classes/LinphoneAppDelegate.h b/Classes/LinphoneAppDelegate.h index 8b0076e3c..6ab39badf 100644 --- a/Classes/LinphoneAppDelegate.h +++ b/Classes/LinphoneAppDelegate.h @@ -32,12 +32,14 @@ UIWindow *window; BOOL started; int savedMaxCall; - } - (void)processRemoteNotification:(NSDictionary*)userInfo; @property (assign) BOOL started; +@property (nonatomic, retain) UIAlertView *waitingIndicator; +@property (nonatomic, retain) NSString *configURL; + @end diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 6226d7bff..bd7a32af8 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -36,7 +36,7 @@ @implementation LinphoneAppDelegate -@synthesize started; +@synthesize started,configURL; #pragma mark - Lifecycle Functions @@ -91,31 +91,31 @@ - (void)applicationDidBecomeActive:(UIApplication *)application { [LinphoneLogger logc:LinphoneLoggerLog format:"applicationDidBecomeActive"]; - + [self startApplication]; LinphoneManager* instance = [LinphoneManager instance]; - - [instance becomeActive]; + + [instance becomeActive]; LinphoneCore* lc = [LinphoneManager getLc]; LinphoneCall* call = linphone_core_get_current_call(lc); - - if (call){ - if (call == instance->currentCallContextBeforeGoingBackground.call) { - const LinphoneCallParams* params = linphone_call_get_current_params(call); - if (linphone_call_params_video_enabled(params)) { - linphone_call_enable_camera( - call, - instance->currentCallContextBeforeGoingBackground.cameraIsEnabled); - } - instance->currentCallContextBeforeGoingBackground.call = 0; - } else if ( linphone_call_get_state(call) == LinphoneCallIncomingReceived ) { + + if (call){ + if (call == instance->currentCallContextBeforeGoingBackground.call) { + const LinphoneCallParams* params = linphone_call_get_current_params(call); + if (linphone_call_params_video_enabled(params)) { + linphone_call_enable_camera( + call, + instance->currentCallContextBeforeGoingBackground.cameraIsEnabled); + } + instance->currentCallContextBeforeGoingBackground.call = 0; + } else if ( linphone_call_get_state(call) == LinphoneCallIncomingReceived ) { [[PhoneMainView instance ] displayIncomingCall:call]; // in this case, the ringing sound comes from the notification. // To stop it we have to do the iOS7 ring fix... [self fixRing]; } - } + } } @@ -123,20 +123,10 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeNewsstandContentAvailability]; - //work around until we can access lpconfig without linphonecore - NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys: - @"YES", @"start_at_boot_preference", - @"YES", @"backgroundmode_preference", -#ifdef DEBUG - @"YES",@"debugenable_preference", -#else - @"NO",@"debugenable_preference", -#endif - nil]; - [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults]; - BOOL background_mode = [[NSUserDefaults standardUserDefaults] boolForKey:@"backgroundmode_preference"]; - BOOL start_at_boot = [[NSUserDefaults standardUserDefaults] boolForKey:@"start_at_boot_preference"]; + LinphoneManager* instance = [LinphoneManager instance]; + BOOL background_mode = [instance lpConfigBoolForKey:@"backgroundmode_preference"]; + BOOL start_at_boot = [instance lpConfigBoolForKey:@"start_at_boot_preference"]; if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)] && [UIApplication sharedApplication].applicationState == UIApplicationStateBackground) @@ -177,19 +167,31 @@ } } - - (void)applicationWillTerminate:(UIApplication *)application { [LinphoneLogger log:LinphoneLoggerLog format:@"Application Will Terminate"]; } - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { - [self startApplication]; - if([LinphoneManager isLcReady]) { - if([[url scheme] isEqualToString:@"sip"]) { - // Go to Dialer view - DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]], DialerViewController); - if(controller != nil) { - [controller setAddress:[url absoluteString]]; + NSString *scheme = [[url scheme] lowercaseString]; + if ([scheme isEqualToString:@"linphone-config-http"] || [scheme isEqualToString:@"linphone-config-https"]) { + configURL = [[NSString alloc] initWithString:[[url absoluteString] stringByReplacingOccurrencesOfString:@"linphone-config-" withString:@""]]; + UIAlertView* confirmation = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Remote configuration",nil) + message:NSLocalizedString(@"This operation will load a remote configuration. Continue ?",nil) + delegate:self + cancelButtonTitle:NSLocalizedString(@"No",nil) + otherButtonTitles:NSLocalizedString(@"Yes",nil),nil]; + confirmation.tag = 1; + [confirmation show]; + [confirmation release]; + } else { + [self startApplication]; + if([LinphoneManager isLcReady]) { + if([[url scheme] isEqualToString:@"sip"]) { + // Go to Dialer view + DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]], DialerViewController); + if(controller != nil) { + [controller setAddress:[url absoluteString]]; + } } } } @@ -206,44 +208,62 @@ } - (void)processRemoteNotification:(NSDictionary*)userInfo{ + if ([LinphoneManager instance].pushNotificationToken==Nil){ + [LinphoneLogger log:LinphoneLoggerLog format:@"Ignoring push notification we did not subscribed."]; + return; + } + NSDictionary *aps = [userInfo objectForKey:@"aps"]; + if(aps != nil) { NSDictionary *alert = [aps objectForKey:@"alert"]; if(alert != nil) { NSString *loc_key = [alert objectForKey:@"loc-key"]; - /*if we receive a remote notification, it is because our TCP background socket was no more working. + /*if we receive a remote notification, it is probably because our TCP background socket was no more working. As a result, break it and refresh registers in order to make sure to receive incoming INVITE or MESSAGE*/ LinphoneCore *lc = [LinphoneManager getLc]; - linphone_core_set_network_reachable(lc, FALSE); - [LinphoneManager instance].connectivity=none; /*force connectivity to be discovered again*/ - if(loc_key != nil) { - if([loc_key isEqualToString:@"IM_MSG"]) { - [[PhoneMainView instance] addInhibitedEvent:kLinphoneTextReceived]; - [[PhoneMainView instance] changeCurrentView:[ChatViewController compositeViewDescription]]; - } else if([loc_key isEqualToString:@"IC_MSG"]) { - //it's a call - NSString *callid=[userInfo objectForKey:@"call-id"]; - if (callid) - [[LinphoneManager instance] enableAutoAnswerForCallId:callid]; - else - [LinphoneLogger log:LinphoneLoggerError format:@"PushNotification: does not have call-id yet, fix it !"]; + if (linphone_core_get_calls(lc)==NULL){ //if there are calls, obviously our TCP socket shall be working + linphone_core_set_network_reachable(lc, FALSE); + [LinphoneManager instance].connectivity=none; /*force connectivity to be discovered again*/ + if(loc_key != nil) { + if([loc_key isEqualToString:@"IM_MSG"]) { + [[PhoneMainView instance] addInhibitedEvent:kLinphoneTextReceived]; + [[PhoneMainView instance] changeCurrentView:[ChatViewController compositeViewDescription]]; + } else if([loc_key isEqualToString:@"IC_MSG"]) { + //it's a call + NSString *callid=[userInfo objectForKey:@"call-id"]; + if (callid) + [[LinphoneManager instance] enableAutoAnswerForCallId:callid]; + else + [LinphoneLogger log:LinphoneLoggerError format:@"PushNotification: does not have call-id yet, fix it !"]; - [self fixRing]; - } - } + [self fixRing]; + } + } + } } } } - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { [LinphoneLogger log:LinphoneLoggerLog format:@"PushNotification: Receive %@", userInfo]; + [self processRemoteNotification:userInfo]; } - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { - [[UIApplication sharedApplication] cancelLocalNotification:notification]; + + [self fixRing]; + + if([notification.userInfo objectForKey:@"callId"] != nil) { - [[LinphoneManager instance] acceptCallForCallId:[notification.userInfo objectForKey:@"callId"]]; + // some local notifications have an internal timer to relaunch themselves at specified intervals + if( [[notification.userInfo objectForKey:@"timer"] intValue] == 1 ){ + [[LinphoneManager instance] cancelLocalNotifTimerForCallId:[notification.userInfo objectForKey:@"callId"]]; + } else { + // auto answer only for non-timed local notifications + [[LinphoneManager instance] acceptCallForCallId:[notification.userInfo objectForKey:@"callId"]]; + } } else if([notification.userInfo objectForKey:@"chat"] != nil) { NSString *remoteContact = (NSString*)[notification.userInfo objectForKey:@"chat"]; // Go to ChatRoom view @@ -267,6 +287,11 @@ - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { LinphoneManager* lm = [LinphoneManager instance]; + + if (lm.pushNotificationToken==Nil){ + [LinphoneLogger log:LinphoneLoggerLog format:@"Ignoring push notification we did not subscribed."]; + return; + } // check that linphone is still running if( ![LinphoneManager isLcReady] ) @@ -281,10 +306,14 @@ lm.silentPushCompletion = completionHandler; [NSTimer scheduledTimerWithTimeInterval:15.0 target:lm selector:@selector(silentPushFailed:) userInfo:nil repeats:FALSE]; - // Force Linphone to drop the current socket, this will trigger a refresh registers - linphone_core_set_network_reachable([LinphoneManager getLc], FALSE); - lm.connectivity=none; /*force connectivity to be discovered again*/ - [lm refreshRegisters]; + LinphoneCore *lc=[LinphoneManager getLc]; + // If no call is yet received at this time, then force Linphone to drop the current socket and make new one to register, so that we get + // a better chance to receive the INVITE. + if (linphone_core_get_calls(lc)==NULL){ + linphone_core_set_network_reachable(lc, FALSE); + lm.connectivity=none; /*force connectivity to be discovered again*/ + [lm refreshRegisters]; + } } @@ -300,4 +329,95 @@ [[LinphoneManager instance] setPushNotificationToken:nil]; } +#pragma mark - Remote configuration Functions (URL Handler) + + +- (void)ConfigurationStateUpdateEvent: (NSNotification*) notif { + LinphoneConfiguringState state = [[notif.userInfo objectForKey: @"state"] intValue]; + if (state == LinphoneConfiguringSuccessful) { + [[NSNotificationCenter defaultCenter] removeObserver:self + name:kLinphoneConfiguringStateUpdate + object:nil]; + [_waitingIndicator dismissWithClickedButtonIndex:0 animated:true]; + + UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Success",nil) + message:NSLocalizedString(@"Remote configuration successfully fetched and applied.",nil) + delegate:nil + cancelButtonTitle:NSLocalizedString(@"OK",nil) + otherButtonTitles:nil]; + [error show]; + [error release]; + [[PhoneMainView instance] startUp]; + } + if (state == LinphoneConfiguringFailed) { + [[NSNotificationCenter defaultCenter] removeObserver:self + name:kLinphoneConfiguringStateUpdate + object:nil]; + [_waitingIndicator dismissWithClickedButtonIndex:0 animated:true]; + UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Failure",nil) + message:NSLocalizedString(@"Failed configuring from the specified URL." ,nil) + delegate:nil + cancelButtonTitle:NSLocalizedString(@"OK",nil) + otherButtonTitles:nil]; + [error show]; + [error release]; + + } +} + + +- (void) showWaitingIndicator { + _waitingIndicator = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Fetching remote configuration...",nil) message:@"" delegate:self cancelButtonTitle:nil otherButtonTitles:nil]; + UIActivityIndicatorView *progress= [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(125, 60, 30, 30)]; + progress.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; + if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0){ + [_waitingIndicator setValue:progress forKey:@"accessoryView"]; + [progress setColor:[UIColor blackColor]]; + } else { + [_waitingIndicator addSubview:progress]; + } + [progress startAnimating]; + [_waitingIndicator show]; + +} + + +- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex +{ + if ((alertView.tag == 1) && (buttonIndex==1)) { + [self showWaitingIndicator]; + if([LinphoneManager isLcReady]) { + [self attemptRemoteConfiguration]; + } else { + [[LinphoneManager instance] startLibLinphone]; + [self performSelector:@selector(attemptRemoteConfiguration) withObject:NULL afterDelay:5.0]; + } + } + +} + +- (void)attemptRemoteConfiguration { + + if ([LinphoneManager isLcReady]) { + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(ConfigurationStateUpdateEvent:) + name:kLinphoneConfiguringStateUpdate + object:nil]; + linphone_core_set_provisioning_uri([LinphoneManager getLc] , [configURL UTF8String]); + [[LinphoneManager instance] destroyLibLinphone]; + [[LinphoneManager instance] startLibLinphone]; + } else { + [_waitingIndicator dismissWithClickedButtonIndex:0 animated:true]; + UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Failure",nil) + message:NSLocalizedString(@"Linphone is not ready.",nil) + delegate:nil + cancelButtonTitle:NSLocalizedString(@"OK",nil) + otherButtonTitles:nil]; + [error show]; + [error release]; + + } +} + + @end diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 21ddfe1fd..2b60f1c18 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -214,15 +214,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [self setBool:lp_config_get_int(conf, "sip", "use_ipv6", 0) forKey:@"use_ipv6"]; - /*keep this one also in the standardUserDefaults so that it can be read before starting liblinphone*/ - BOOL start_at_boot = TRUE; - if ([[NSUserDefaults standardUserDefaults] objectForKey:@"start_at_boot_preference"] != Nil) - start_at_boot = [[NSUserDefaults standardUserDefaults] boolForKey:@"start_at_boot_preference"]; - [self setBool: start_at_boot forKey:@"start_at_boot_preference"]; - BOOL background_mode = TRUE; - if ([[NSUserDefaults standardUserDefaults] objectForKey:@"backgroundmode_preference"] != Nil) - background_mode =[[NSUserDefaults standardUserDefaults] boolForKey:@"backgroundmode_preference"]; - [self setBool: background_mode forKey:@"backgroundmode_preference"]; + [self setBool: lp_config_get_int(conf,LINPHONERC_APPLICATION_KEY,"start_at_boot_preference",1) forKey:@"start_at_boot_preference"]; + [self setBool: lp_config_get_int(conf,LINPHONERC_APPLICATION_KEY,"backgroundmode_preference",1) forKey:@"backgroundmode_preference"]; { @@ -232,7 +225,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [self setBool:(pol->automatically_initiate) forKey:@"start_video_preference"]; [self setBool:(pol->automatically_accept) forKey:@"accept_video_preference"]; [self setBool:linphone_core_self_view_enabled(lc) forKey:@"self_video_preference"]; - [self setBool:linphone_core_video_preview_enabled(lc) forKey:@"preview_preference"]; + BOOL previewEnabled=lp_config_get_int(conf,LINPHONERC_APPLICATION_KEY,"preview_preference",1); + [self setBool:previewEnabled forKey:@"preview_preference"]; MSVideoSize vsize = linphone_core_get_preferred_video_size(lc); int index; if ((vsize.width == MS_VIDEO_SIZE_720P_W) && (vsize.height == MS_VIDEO_SIZE_720P_H)) { @@ -560,7 +554,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); policy.automatically_initiate = [self boolForKey:@"start_video_preference"]; linphone_core_set_video_policy(lc, &policy); linphone_core_enable_self_view(lc, [self boolForKey:@"self_video_preference"]); - linphone_core_enable_video_preview(lc, [self boolForKey:@"preview_preference"]); + BOOL preview_preference=[self boolForKey:@"preview_preference"]; + lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "preview_preference", preview_preference); MSVideoSize vsize; int bw; switch ([self integerForKey:@"video_preferred_size_preference"]) { @@ -655,7 +650,6 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); } else { linphone_core_disable_logs(); } - [[NSUserDefaults standardUserDefaults] setBool:debugmode forKey:@"debugenable_preference"]; //to be used at linphone core startup BOOL animations = [self boolForKey:@"animations_preference"]; lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "animations_preference", animations); @@ -668,14 +662,6 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); NSString* sharing_server = [self stringForKey:@"sharing_server_preference"]; [[LinphoneManager instance] lpConfigSetString:sharing_server forKey:@"sharing_server_preference"]; - - - - /*keep this one also in the standardUserDefaults so that it can be read before starting liblinphone*/ - BOOL start_at_boot = [self boolForKey:@"start_at_boot_preference"]; - [[NSUserDefaults standardUserDefaults] setBool: start_at_boot forKey:@"start_at_boot_preference"]; - BOOL background_mode = [self boolForKey:@"backgroundmode_preference"]; - [[NSUserDefaults standardUserDefaults] setBool: background_mode forKey:@"backgroundmode_preference"]; //Tunnel @@ -714,9 +700,6 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [[LinphoneManager instance] setTunnelMode:mode]; } - // Force synchronize - [[NSUserDefaults standardUserDefaults] synchronize]; - [changedDict release]; changedDict = [[NSMutableDictionary alloc] init]; diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h index 7836cd03d..fb6806f23 100644 --- a/Classes/LinphoneManager.h +++ b/Classes/LinphoneManager.h @@ -90,6 +90,7 @@ struct NetworkReachabilityContext { UILocalNotification *notification; NSMutableDictionary *userInfos; bool_t videoRequested; /*set when user has requested for video*/ + NSTimer* timer; }; @end @@ -106,11 +107,10 @@ typedef struct _LinphoneManagerSounds { NSTimer* mIterateTimer; NSMutableArray* pendindCallIdFromRemoteNotif; Connectivity connectivity; - BOOL stopWaitingRegisters; UIBackgroundTaskIdentifier pausedCallBgTask; UIBackgroundTaskIdentifier incallBgTask; CTCallCenter* mCallCenter; - + NSDate *mLastKeepAliveDate; @public CallContext currentCallContextBeforeGoingBackground; } @@ -138,7 +138,8 @@ typedef struct _LinphoneManagerSounds { - (void)addPushTokenToProxyConfig: (LinphoneProxyConfig*)cfg; - (BOOL)shouldAutoAcceptCallForCallId:(NSString*) callId; - (void)acceptCallForCallId:(NSString*)callid; -- (void)waitForRegisterToArrive; +- (void)cancelLocalNotifTimerForCallId:(NSString*)callid; + + (void)kickOffNetworkConnection; - (void)setupNetworkReachabilityCallback; @@ -187,6 +188,7 @@ typedef struct _LinphoneManagerSounds { @property (readonly,copy) NSString* contactFilter; @property (copy) void (^silentPushCompletion)(UIBackgroundFetchResult); @property (readonly) BOOL wasRemoteProvisioned; +@property (readonly) LpConfig *configDb; @end diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 212609e6e..29e9fe102 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -63,27 +63,17 @@ NSString *const kLinphoneConfiguringStateUpdate = @"LinphoneConfiguringStateUpda NSString *const kLinphoneGlobalStateUpdate = @"LinphoneGlobalStateUpdate"; -extern void libmsilbc_init(); -#ifdef HAVE_AMR -extern void libmsamr_init(); -#endif +extern void libmsilbc_init(void); +extern void libmsamr_init(void); +extern void libmsx264_init(void); +extern void libmsopenh264_init(void); +extern void libmssilk_init(void); +extern void libmsbcg729_init(void); -#ifdef HAVE_X264 -extern void libmsx264_init(); -#endif -#ifdef HAVE_OPENH264 -extern void libmsopenh264_init(); -#endif #define FRONT_CAM_NAME "AV Capture: com.apple.avfoundation.avcapturedevice.built-in_video:1" /*"AV Capture: Front Camera"*/ #define BACK_CAM_NAME "AV Capture: com.apple.avfoundation.avcapturedevice.built-in_video:0" /*"AV Capture: Back Camera"*/ -#if defined (HAVE_SILK) -extern void libmssilk_init(); -#endif -#if HAVE_G729 -extern void libmsbcg729_init(); -#endif @implementation LinphoneCallAppData - (id)init { if ((self = [super init])) { @@ -118,6 +108,7 @@ extern void libmsbcg729_init(); @synthesize tunnelMode; @synthesize silentPushCompletion; @synthesize wasRemoteProvisioned; +@synthesize configDb; struct codec_name_pref_table{ const char *name; @@ -272,7 +263,19 @@ struct codec_name_pref_table codec_pref_table[]={ [self copyDefaultSettings]; pendindCallIdFromRemoteNotif = [[NSMutableArray alloc] init ]; photoLibrary = [[ALAssetsLibrary alloc] init]; - + + NSString* factoryConfig = [LinphoneManager bundleFile:[LinphoneManager runningOnIpad]?@"linphonerc-factory~ipad":@"linphonerc-factory"]; + NSString *confiFileName = [LinphoneManager documentFile:@".linphonerc"]; + configDb=lp_config_new_with_factory([confiFileName cStringUsingEncoding:[NSString defaultCStringEncoding]] , [factoryConfig cStringUsingEncoding:[NSString defaultCStringEncoding]]); + + //set default values for first boot + if (lp_config_get_string(configDb,LINPHONERC_APPLICATION_KEY,"debugenable_preference",NULL)==NULL){ +#ifdef DEBUG + [self lpConfigSetBool:TRUE forKey:@"debugenable_preference"]; +#else + [self lpConfigSetBool:FALSE forKey:@"debugenable_preference"]; +#endif + } } return self; } @@ -372,9 +375,9 @@ static void dump_section(const char* section, void* data){ } + (void)dumpLCConfig { - if(theLinphoneCore ){ - LpConfig* conf = linphone_core_get_config(theLinphoneCore); - lp_config_for_each_section(conf, dump_section, conf); + if (theLinphoneCore ){ + LpConfig *conf=[LinphoneManager instance].configDb; + lp_config_for_each_section(conf, dump_section, conf); } } @@ -440,6 +443,15 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char #pragma mark - Call State Functions +- (void)localNotifContinue:(NSTimer*) timer { + UILocalNotification* notif = [timer userInfo]; + if (notif){ + [LinphoneLogger log:LinphoneLoggerLog format:@"cancelling/presenting local notif"]; + [[UIApplication sharedApplication] cancelLocalNotification:notif]; + [[UIApplication sharedApplication] presentLocalNotificationNow:notif]; + } +} + - (void)onCall:(LinphoneCall*)call StateChanged:(LinphoneCallState)state withMessage:(const char *)message { // Handling wrapper @@ -515,18 +527,25 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char // Create a new local notification data->notification = [[UILocalNotification alloc] init]; if (data->notification) { - data->notification.repeatInterval = 0; + data->timer = [NSTimer scheduledTimerWithTimeInterval:4.0 target:self selector:@selector(localNotifContinue:) userInfo:data->notification repeats:TRUE]; + + data->notification.repeatInterval = 0; data->notification.alertBody =[NSString stringWithFormat:NSLocalizedString(@"IC_MSG",nil), address]; data->notification.alertAction = NSLocalizedString(@"Answer", nil); - data->notification.soundName = @"ring.caf"; - data->notification.userInfo = [NSDictionary dictionaryWithObject:callId forKey:@"callId"]; - + data->notification.soundName = @"shortring.caf"; + data->notification.userInfo = @{@"callId": callId, @"timer":[NSNumber numberWithInt:1] }; + data->notification.applicationIconBadgeNumber = 1; + [[UIApplication sharedApplication] presentLocalNotificationNow:data->notification]; if (!incallBgTask){ incallBgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler: ^{ [LinphoneLogger log:LinphoneLoggerWarning format:@"Call cannot ring any more, too late"]; + [[UIApplication sharedApplication] endBackgroundTask:incallBgTask]; + incallBgTask=0; }]; + + [[NSRunLoop currentRunLoop] addTimer:data->timer forMode:NSRunLoopCommonModes]; } } @@ -552,7 +571,12 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char LinphoneCallLog *log = linphone_call_get_call_log(call); // cancel local notif if needed + if( data->timer ){ + [data->timer invalidate]; + data->timer = nil; + } [[UIApplication sharedApplication] cancelLocalNotification:data->notification]; + [data->notification release]; data->notification = nil; @@ -669,8 +693,6 @@ static void linphone_iphone_configuring_status_changed(LinphoneCore *lc, Linphon - (void)onRegister:(LinphoneCore *)lc cfg:(LinphoneProxyConfig*) cfg state:(LinphoneRegistrationState) state message:(const char*) message { [LinphoneLogger logc:LinphoneLoggerLog format:"NEW REGISTRATION STATE: '%s' (message: '%s')", linphone_registration_state_to_string(state), message]; - if (state==LinphoneRegistrationOk) - [LinphoneManager instance]->stopWaitingRegisters=TRUE; // Post event NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys: @@ -835,7 +857,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach } else { LinphoneTunnel *tunnel = linphone_core_get_tunnel([LinphoneManager getLc]); Connectivity newConnectivity; - BOOL isWifiOnly = lp_config_get_int(linphone_core_get_config(theLinphoneCore), LINPHONERC_APPLICATION_KEY, "wifi_only_preference",FALSE); + BOOL isWifiOnly = lp_config_get_int(lLinphoneMgr.configDb, LINPHONERC_APPLICATION_KEY, "wifi_only_preference",FALSE); if (!ctx || ctx->testWWan) newConnectivity = flags & kSCNetworkReachabilityFlagsIsWWAN ? wwan:wifi; else @@ -861,8 +883,8 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach linphone_proxy_config_expires(proxy, 0); } linphone_core_set_network_reachable(theLinphoneCore,true); + linphone_core_iterate(theLinphoneCore); [LinphoneLogger logc:LinphoneLoggerLog format:"Network connectivity changed to type [%s]",(newConnectivity==wifi?"wifi":"wwan")]; - [lLinphoneMgr waitForRegisterToArrive]; } lLinphoneMgr.connectivity=newConnectivity; switch (lLinphoneMgr.tunnelMode) { @@ -1041,9 +1063,10 @@ static LinphoneCoreVTable linphonec_vtable = { } +static BOOL libStarted = FALSE; + - (void)startLibLinphone { - static BOOL libStarted = FALSE; if ( libStarted ) { [LinphoneLogger logc:LinphoneLoggerError format:"Liblinphone is already initialized!"]; return; @@ -1075,7 +1098,7 @@ static LinphoneCoreVTable linphonec_vtable = { #endif /*to make sure we don't loose debug trace*/ - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"debugenable_preference"]) { + 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); } @@ -1119,11 +1142,9 @@ static LinphoneCoreVTable linphonec_vtable = { connectivity=none; - NSString* factoryConfig = [LinphoneManager bundleFile:[LinphoneManager runningOnIpad]?@"linphonerc-factory~ipad":@"linphonerc-factory"]; - NSString *confiFileName = [LinphoneManager documentFile:@".linphonerc"]; - theLinphoneCore = linphone_core_new (&linphonec_vtable - , [confiFileName cStringUsingEncoding:[NSString defaultCStringEncoding]] - , [factoryConfig cStringUsingEncoding:[NSString defaultCStringEncoding]] + + theLinphoneCore = linphone_core_new_with_config (&linphonec_vtable + ,configDb ,self /* user_data */); /* set the CA file no matter what, since the remote provisioning could be hitting an HTTPS server */ @@ -1168,6 +1189,7 @@ static LinphoneCoreVTable linphonec_vtable = { proxyReachability=nil; } + libStarted = FALSE; } - (void) resetLinphoneCore { @@ -1186,6 +1208,21 @@ static int comp_call_id(const LinphoneCall* call , const char *callid) { return strcmp(linphone_call_log_get_call_id(linphone_call_get_call_log(call)), callid); } +- (void)cancelLocalNotifTimerForCallId:(NSString*)callid { + //first, make sure this callid is not already involved in a call + if ([LinphoneManager isLcReady]) { + MSList* calls = (MSList*)linphone_core_get_calls(theLinphoneCore); + MSList* call = ms_list_find_custom(calls, (MSCompareFunc)comp_call_id, [callid UTF8String]); + if (call != NULL) { + LinphoneCallAppData* data = linphone_call_get_user_pointer((LinphoneCall*)call->data); + if ( data->timer ) + [data->timer invalidate]; + data->timer = nil; + return; + } + } +} + - (void)acceptCallForCallId:(NSString*)callid { //first, make sure this callid is not already involved in a call if ([LinphoneManager isLcReady]) { @@ -1229,24 +1266,6 @@ static int comp_call_id(const LinphoneCall* call , const char *callid) { return YES; } -- (void)waitForRegisterToArrive{ - if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)] - && [UIApplication sharedApplication].applicationState == UIApplicationStateBackground) { - stopWaitingRegisters = FALSE; - [LinphoneLogger logc:LinphoneLoggerLog format:"Starting long running task for registering"]; - UIBackgroundTaskIdentifier bgid = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler: ^{ - [LinphoneManager instance]->stopWaitingRegisters=TRUE; - [LinphoneLogger logc:LinphoneLoggerLog format:"Expiration handler called"]; - }]; - for(int i=0;i<100 && (!stopWaitingRegisters);i++){ - linphone_core_iterate(theLinphoneCore); - usleep(20000); - } - [LinphoneLogger logc:LinphoneLoggerLog format:"Ending long running task for registering"]; - [[UIApplication sharedApplication] endBackgroundTask:bgid]; - } -} - static int comp_call_state_paused (const LinphoneCall* call, const void* param) { return linphone_call_get_state(call) != LinphoneCallPaused; } @@ -1285,6 +1304,10 @@ static int comp_call_state_paused (const LinphoneCall* call, const void* param) if ([[UIApplication sharedApplication] setKeepAliveTimeout:600/*(NSTimeInterval)linphone_proxy_config_get_expires(proxyCfg)*/ handler:^{ [LinphoneLogger logc:LinphoneLoggerWarning format:"keepalive handler"]; + if (mLastKeepAliveDate) + [mLastKeepAliveDate release]; + mLastKeepAliveDate=[NSDate date]; + [mLastKeepAliveDate retain]; if (theLinphoneCore == nil) { [LinphoneLogger logc:LinphoneLoggerWarning format:"It seems that Linphone BG mode was deactivated, just skipping"]; return; @@ -1315,6 +1338,12 @@ static int comp_call_state_paused (const LinphoneCall* call, const void* param) /*if at least one call exist, enter normal bg mode */ shouldEnterBgMode=TRUE; } + /*stop the video preview*/ + if (theLinphoneCore){ + linphone_core_enable_video_preview(theLinphoneCore, FALSE); + linphone_core_iterate(theLinphoneCore); + } + linphone_core_stop_dtmf_stream(theLinphoneCore); [LinphoneLogger logc:LinphoneLoggerLog format:"Entering [%s] bg mode",shouldEnterBgMode?"normal":"lite"]; @@ -1346,6 +1375,19 @@ static int comp_call_state_paused (const LinphoneCall* call, const void* param) /*IOS specific*/ linphone_core_start_dtmf_stream(theLinphoneCore); + + /*start the video preview in case we are in the main view*/ + if ([LinphoneManager runningOnIpad] && linphone_core_video_enabled(theLinphoneCore) && [self lpConfigBoolForKey:@"preview_preference"]){ + linphone_core_enable_video_preview(theLinphoneCore, TRUE); + } + /*check last keepalive handler date*/ + if (mLastKeepAliveDate!=Nil){ + NSDate *current=[NSDate date]; + if ([current timeIntervalSinceDate:mLastKeepAliveDate]>700){ + NSString *datestr=[mLastKeepAliveDate description]; + [LinphoneLogger logc:LinphoneLoggerWarning format:"keepalive handler was called for the last time at %@",datestr]; + } + } } @@ -1670,7 +1712,7 @@ static void audioRouteChangeListenerCallback ( - (void)lpConfigSetString:(NSString*)value forKey:(NSString*)key forSection:(NSString *)section { if (!key) return; - lp_config_set_string(linphone_core_get_config(theLinphoneCore), [section UTF8String], [key UTF8String], value?[value UTF8String]:NULL); + lp_config_set_string(configDb, [section UTF8String], [key UTF8String], value?[value UTF8String]:NULL); } - (NSString*)lpConfigStringForKey:(NSString*)key { @@ -1683,7 +1725,7 @@ static void audioRouteChangeListenerCallback ( - (NSString*)lpConfigStringForKey:(NSString*)key forSection:(NSString *)section { if (!key) return nil; - const char* value = lp_config_get_string(linphone_core_get_config(theLinphoneCore), [section UTF8String], [key UTF8String], NULL); + const char* value = lp_config_get_string(configDb, [section UTF8String], [key UTF8String], NULL); if (value) return [NSString stringWithUTF8String:value]; else @@ -1696,7 +1738,7 @@ static void audioRouteChangeListenerCallback ( - (void)lpConfigSetInt:(NSInteger)value forKey:(NSString*)key forSection:(NSString *)section { if (!key) return; - lp_config_set_int(linphone_core_get_config(theLinphoneCore), [section UTF8String], [key UTF8String], value ); + lp_config_set_int(configDb, [section UTF8String], [key UTF8String], value ); } - (NSInteger)lpConfigIntForKey:(NSString*)key { @@ -1705,7 +1747,7 @@ static void audioRouteChangeListenerCallback ( - (NSInteger)lpConfigIntForKey:(NSString*)key forSection:(NSString *)section { if (!key) return -1; - return lp_config_get_int(linphone_core_get_config(theLinphoneCore), [section UTF8String], [key UTF8String], -1); + return lp_config_get_int(configDb, [section UTF8String], [key UTF8String], -1); } - (void)lpConfigSetBool:(BOOL)value forKey:(NSString*)key { diff --git a/Classes/LinphoneUI/UIStateBar.m b/Classes/LinphoneUI/UIStateBar.m index 99a8835fb..787f07279 100644 --- a/Classes/LinphoneUI/UIStateBar.m +++ b/Classes/LinphoneUI/UIStateBar.m @@ -130,7 +130,7 @@ NSTimer *callSecurityTimer; } - (void) globalStateUpdate:(NSNotification*) notif { - [self registrationUpdate:notif]; + if ([LinphoneManager isLcReady]) [self registrationUpdate:notif]; } diff --git a/README b/README index d62528903..bea355f16 100644 --- a/README +++ b/README @@ -12,7 +12,7 @@ Make sure that /opt/local/bin (macport tools) arrives first in your PATH env var Once xcode and macports are installed, open a terminal and install the required build-time tools with: - $ sudo port install coreutils automake autoconf libtool intltool wget pkgconfig nasm cmake gmake yasm grep doxygen ImageMagick optipng antlr3 + $ sudo port install coreutils automake autoconf libtool intltool wget pkgconfig cmake gmake yasm nasm grep doxygen ImageMagick optipng antlr3 Install gas-preprosessor.pl version above Jully 2013 (http://github.com/yuvi/gas-preprocessor/ ) to be copied into /opt/local/bin : @@ -71,8 +71,8 @@ After the SDK is built, just open the linphone xcode project with Xcode, and pre * Note regarding third party components subject to license -The liblinphone-sdk is compiled with third parties code that are subject to patent license, specially: AMR, SILK G729 and X264 codecs. -Linphone controls the embedding of these codecs thanks to the preprocessor macros HAVE_SILK, HAVE_AMR, HAVE_G729 HAVE_X264 positioned in xcode project. +The liblinphone-sdk is compiled with third parties code that are subject to patent license, specially: AMR, SILK G729 and H264 codecs. +Linphone controls the embedding of these codecs thanks to the preprocessor macros HAVE_SILK, HAVE_AMR, HAVE_G729 HAVE_OPENH264 positioned in xcode project. Before embeding these 4 codecs in the final application, make sure to have the right to do so. LIMITATIONS, KNOWN BUGS diff --git a/Resources/linphonerc b/Resources/linphonerc index be8cf3195..eb2ae79f8 100644 --- a/Resources/linphonerc +++ b/Resources/linphonerc @@ -26,6 +26,9 @@ rotation_preference=auto animations_preference=1 edge_opt_preference=0 use_system_contacts=0 +start_at_boot_preference=1 +backgroundmode_preference=1 + [default_values] reg_expires=600 \ No newline at end of file diff --git a/Resources/linphonerc~ipad b/Resources/linphonerc~ipad index 78405f5d4..1f424bab1 100644 --- a/Resources/linphonerc~ipad +++ b/Resources/linphonerc~ipad @@ -26,6 +26,8 @@ rotation_preference=auto animations_preference=1 edge_opt_preference=0 use_system_contacts=0 +start_at_boot_preference=1 +backgroundmode_preference=1 [default_values] reg_expires=600 diff --git a/Resources/shortring.caf b/Resources/shortring.caf new file mode 100644 index 000000000..c3d9bc24a Binary files /dev/null and b/Resources/shortring.caf differ diff --git a/linphone-Info.plist b/linphone-Info.plist index b776fd5d1..8c7ffad31 100644 --- a/linphone-Info.plist +++ b/linphone-Info.plist @@ -74,6 +74,30 @@ sip + + CFBundleTypeRole + Viewer + CFBundleURLIconFile + linphone_icon_72@2x + CFBundleURLName + org.linphone.phone + CFBundleURLSchemes + + linphone-config-http + + + + CFBundleTypeRole + Viewer + CFBundleURLIconFile + linphone_icon_72@2x + CFBundleURLName + org.linphone.phone + CFBundleURLSchemes + + linphone-config-https + + CFBundleVersion 2.1.2 diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 423973583..dd4289f44 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -1346,6 +1346,8 @@ F01A77C518EBEC6200E287CA /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F0B89C2118DC89E30050B60E /* MediaPlayer.framework */; }; F01A77C618EBECCB00E287CA /* libc++.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 344ABDEF14850AE9007420B6 /* libc++.1.dylib */; settings = {ATTRIBUTES = (Weak, ); }; }; F01A77C718EBECEA00E287CA /* libstdc++.6.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 344ABDF014850AE9007420B6 /* libstdc++.6.dylib */; settings = {ATTRIBUTES = (Weak, ); }; }; + F01A77EB18ED989B00E287CA /* shortring.caf in Resources */ = {isa = PBXBuildFile; fileRef = F01A77EA18ED989B00E287CA /* shortring.caf */; }; + F01A77EC18ED989B00E287CA /* shortring.caf in Resources */ = {isa = PBXBuildFile; fileRef = F01A77EA18ED989B00E287CA /* shortring.caf */; }; F03A9B1D18C0CF7000C4D7FE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; F03A9B1E18C0CF7000C4D7FE /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; }; F03A9B1F18C0CF7000C4D7FE /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; @@ -2467,6 +2469,7 @@ D3F9A9EC15AF277D0045320F /* UACellBackgroundView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UACellBackgroundView.h; path = Utils/UACellBackgroundView/UACellBackgroundView.h; sourceTree = ""; }; D3F9A9ED15AF277D0045320F /* UACellBackgroundView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UACellBackgroundView.m; path = Utils/UACellBackgroundView/UACellBackgroundView.m; sourceTree = ""; }; F0181B6B18BF7B1200A9A357 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; }; + F01A77EA18ED989B00E287CA /* shortring.caf */ = {isa = PBXFileReference; lastKnownFileType = file; name = shortring.caf; path = Resources/shortring.caf; sourceTree = ""; }; F03A9B1C18C0CF7000C4D7FE /* linphonetester.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = linphonetester.app; sourceTree = BUILT_PRODUCTS_DIR; }; F03A9B2218C0CF7000C4D7FE /* tester-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "tester-Info.plist"; sourceTree = ""; }; F03A9B2418C0CF7000C4D7FE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; @@ -3402,6 +3405,7 @@ D3804E5E15D92A57008072A5 /* msg.caf */, D3804E5F15D92A57008072A5 /* msg.wav */, 2242E312125235120061DDCE /* ring.caf */, + F01A77EA18ED989B00E287CA /* shortring.caf */, 2237D4081084D7A9001383EE /* ring.wav */, 22F254801073D99800AC9B3F /* ringback.wav */, 70571E1913FABCB000CDD3C2 /* rootca.pem */, @@ -4831,6 +4835,7 @@ D3F83F1E158205A100336684 /* speaker_off_over.png in Resources */, D3F83F20158205A100336684 /* speaker_on_default.png in Resources */, D3F83F22158205A100336684 /* speaker_on_over.png in Resources */, + F01A77EB18ED989B00E287CA /* shortring.caf in Resources */, D3F83F24158205A100336684 /* video_off_default.png in Resources */, D3F83F26158205A100336684 /* video_off_over.png in Resources */, D3F83F28158205A100336684 /* video_on_default.png in Resources */, @@ -5376,6 +5381,7 @@ D34BD72F15C13DD40070C209 /* LinphoneApp.xib in Resources */, D34BD73015C13DD40070C209 /* AboutViewController.xib in Resources */, D34BD73115C13DD40070C209 /* PhoneMainView.xib in Resources */, + F01A77EC18ED989B00E287CA /* shortring.caf in Resources */, D34BD73215C13DD40070C209 /* SettingsViewController.xib in Resources */, D38187DE15FE348A00C3EDCA /* WizardViewController.xib in Resources */, D34BD62815C13DB60070C209 /* back_over.png in Resources */, diff --git a/submodules/belle-sip b/submodules/belle-sip index 0177ef2de..e881f0512 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit 0177ef2de50f9609d8ed0525e8878f957da6ab61 +Subproject commit e881f0512913a75d58ffe4ae6edf9139703383cc diff --git a/submodules/build/builders.d/openh264-permissive.patch b/submodules/build/builders.d/openh264-permissive.patch new file mode 100644 index 000000000..859db1ee1 --- /dev/null +++ b/submodules/build/builders.d/openh264-permissive.patch @@ -0,0 +1,53 @@ +commit 6b3de978d928b6c0baec3305c9803c21a4367d0c +Author: Simon Morlat +Date: Tue Apr 15 15:19:37 2014 +0200 + + permissive mode: allow reference frames to be used even if there were lost slices. + +diff --git a/codec/decoder/core/src/decoder_core.cpp b/codec/decoder/core/src/decoder_core.cpp +index c19f501..a14e971 100644 +--- a/codec/decoder/core/src/decoder_core.cpp ++++ b/codec/decoder/core/src/decoder_core.cpp +@@ -58,7 +58,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t + WelsLog (pCtx, WELS_LOG_WARNING, + "DecodeFrameConstruction():::iTotalNumMbRec:%d, total_num_mb_sps:%d, cur_layer_mb_width:%d, cur_layer_mb_height:%d --\n", + pCtx->iTotalNumMbRec, kiTotalNumMbInCurLayer, pCurDq->iMbWidth, pCurDq->iMbHeight); +- return -1; ++ //return -1; + } + #ifdef NO_WAITING_AU + pCtx->iTotalNumMbRec = 0; +diff --git a/codec/decoder/core/src/manage_dec_ref.cpp b/codec/decoder/core/src/manage_dec_ref.cpp +index dcf61ca..5582ec9 100644 +--- a/codec/decoder/core/src/manage_dec_ref.cpp ++++ b/codec/decoder/core/src/manage_dec_ref.cpp +@@ -165,6 +165,7 @@ int32_t WelsReorderRefList (PWelsDecoderContext pCtx) { + && (pSliceHeader->iSpsId != ppRefList[i]->iSpsId)) { //check; + WelsLog (pCtx, WELS_LOG_WARNING, "WelsReorderRefList()-1::::BASE LAYER::::iSpsId:%d, ref_sps_id:%d\n", + pSliceHeader->iSpsId, ppRefList[i]->iSpsId); ++ return ERR_NONE; + pCtx->iErrorCode = dsNoParamSets; //cross-IDR reference frame selection, SHOULD request IDR.-- + return ERR_INFO_REFERENCE_PIC_LOST; + } else { + +commit a1f3b95ad18d0788c2c803fac80e78d6365673ce +Author: Simon Morlat +Date: Tue Apr 15 17:54:58 2014 +0200 + + permissive mode (2) + +diff --git a/codec/decoder/core/src/decoder_core.cpp b/codec/decoder/core/src/decoder_core.cpp +index a14e971..e742dbf 100644 +--- a/codec/decoder/core/src/decoder_core.cpp ++++ b/codec/decoder/core/src/decoder_core.cpp +@@ -1738,8 +1738,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, int3 + if ((iLastIdD < 0) || //case 1: first layer + (iLastIdD == iCurrIdD)) { //case 2: same uiDId + InitDqLayerInfo (dq_cur, &pLayerInfo, pNalCur, pCtx->pDec); +- +- if (!dq_cur->sLayerInfo.pSps->bGapsInFrameNumValueAllowedFlag) { ++ if (0){ ++ //if (!dq_cur->sLayerInfo.pSps->bGapsInFrameNumValueAllowedFlag) { + const bool kbIdrFlag = dq_cur->sLayerInfo.sNalHeaderExt.bIdrFlag + || (dq_cur->sLayerInfo.sNalHeaderExt.sNalUnitHeader.eNalUnitType == NAL_UNIT_CODED_SLICE_IDR); + // Subclause 8.2.5.2 Decoding process for gaps in frame_num diff --git a/submodules/build/builders.d/openh264.mk b/submodules/build/builders.d/openh264.mk index 9ce4517dd..b229d2899 100644 --- a/submodules/build/builders.d/openh264.mk +++ b/submodules/build/builders.d/openh264.mk @@ -32,12 +32,19 @@ endif openh264_dir?=externals/openh264 -$(BUILDER_BUILD_DIR)/$(openh264_dir)/Makefile: +$(BUILDER_SRC_DIR)/$(openh264_dir)/openh264-permissive.patch.stamp: + cd $(BUILDER_SRC_DIR)/$(openh264_dir) \ + && patch -p1 < $(BUILDER_SRC_DIR)/build/builders.d/openh264-permissive.patch + touch $(BUILDER_SRC_DIR)/$(openh264_dir)/openh264-permissive.patch.stamp + +patch-openh264: $(BUILDER_SRC_DIR)/$(openh264_dir)/openh264-permissive.patch.stamp + +update-openh264: patch-openh264 mkdir -p $(BUILDER_BUILD_DIR)/$(openh264_dir) \ && cd $(BUILDER_BUILD_DIR)/$(openh264_dir)/ \ - && rsync -rvLpgoc --exclude ".git" $(BUILDER_SRC_DIR)/$(openh264_dir)/* . + && rsync -rvLpgoc --exclude ".git" $(BUILDER_SRC_DIR)/$(openh264_dir)/* . -build-openh264: $(BUILDER_BUILD_DIR)/$(openh264_dir)/Makefile +build-openh264: update-openh264 cd $(BUILDER_BUILD_DIR)/$(openh264_dir) \ && make libraries OS=ios ARCH=$(ARCH) PREFIX=$(prefix)\ && make install OS=ios ARCH=$(ARCH) PREFIX=$(prefix) diff --git a/submodules/linphone b/submodules/linphone index e5d8ff817..fd8136016 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit e5d8ff817a5de726d75a6a69791d6a9603fe6460 +Subproject commit fd813601605e2f4e2cbd70e2cdb96806e3e78e41