ipad: start background preview in a separate thread

This commit is contained in:
Pierre-Eric Pelloux-Prayer 2012-04-18 10:09:17 +02:00
parent a37197a32a
commit 966c3ad85e

View file

@ -72,12 +72,6 @@
- (void)viewDidLoad
{
[super viewDidLoad];
bool enableVideo = [[NSUserDefaults standardUserDefaults] boolForKey:@"enable_video_preference"];
if (enableVideo) {
[self initVideoPreview ];
}
}
-(void) switchCameraPressed {
@ -111,13 +105,19 @@
[session startRunning];
}
-(void) startPreview:(id) a {
[window addSubview:self.view];
[window sendSubviewToBack:self.view];
[session startRunning];
}
-(void) showPreview:(BOOL) show {
bool enableVideo = [[NSUserDefaults standardUserDefaults] boolForKey:@"enable_video_preference"];
if (enableVideo) {
LinphoneCall* call = linphone_core_get_current_call([LinphoneManager getLc]);
if (show && call && linphone_call_params_video_enabled(linphone_call_get_current_params(call))) {
v if (show && call && linphone_call_params_video_enabled(linphone_call_get_current_params(call))) {
return;
}
@ -126,9 +126,7 @@
}
if (show && !session.running) {
[window addSubview:self.view];
[window sendSubviewToBack:self.view];
[session startRunning];
[self performSelectorInBackground:@selector(startPreview:) withObject:nil];
} else if (!show && session.running) {
[self.view removeFromSuperview];
[session stopRunning];