workaround latency while opening audio unit, that caused first pressed digit to be played with one second delay>

This commit is contained in:
Simon Morlat 2011-02-09 12:02:47 +01:00
parent b502892764
commit 3b24cd1fde
4 changed files with 31 additions and 3 deletions

View file

@ -38,8 +38,8 @@
} else {
linphone_core_send_dtmf([LinphoneManager getLc],mDigit);
}
}
-(void) touchUp:(id) sender {
linphone_core_stop_dtmf([LinphoneManager getLc]);
if (mDigit == '0') {

View file

@ -64,6 +64,7 @@
IncallViewController *myIncallViewController;
UIActionSheet *mIncomingCallActionSheet;
FirstLoginViewController* myFirstLoginViewController;
NSTimer *dtmf_warmup;
}
@property (nonatomic, retain) IBOutlet UITextField* address;

View file

@ -79,6 +79,16 @@
return self;
}
*/
- (void)dtmfWarmup{
@try {
linphone_core_play_dtmf([LinphoneManager getLc], ' ', 50);
} @catch (NSException *e) {
//nop
}
}
- (void)viewDidAppear:(BOOL)animated {
[[UIApplication sharedApplication] setIdleTimerDisabled:true];
[mute reset];
@ -88,10 +98,27 @@
[[LinphoneManager instance] setRegistrationDelegate:myFirstLoginViewController];
[self presentModalViewController:myFirstLoginViewController animated:true];
};
/*
BIG HACK !!
The audio unit takes a lot of time to start, especially on iphone 3G
To prevent a one second delay while playing the first digit, we need to activate
the linphonecore graph responsible to play the dtmfs
*/
//[self dtmfWarmup];
NSDate *soon=[NSDate dateWithTimeIntervalSince1970:(time(NULL)+1)];
dtmf_warmup = [[NSTimer alloc] initWithFireDate:soon
interval:4
target:self
selector:@selector(dtmfWarmup)
userInfo:nil
repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:dtmf_warmup
forMode:NSDefaultRunLoopMode];
}
- (void)viewDidDisappear:(BOOL)animated {
[[UIApplication sharedApplication] setIdleTimerDisabled:false];
[dtmf_warmup invalidate];
}

@ -1 +1 @@
Subproject commit f89550038a73df8d7ded83252401fea09afd65ba
Subproject commit 6cd830fda4252457082f5b5be6909b573e11fd91