From 966c3ad85ee4ffc2c53ce37131cca31d951b6d21 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Wed, 18 Apr 2012 10:09:17 +0200 Subject: [PATCH] ipad: start background preview in a separate thread --- Classes/MainScreenWithVideoPreview.m | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Classes/MainScreenWithVideoPreview.m b/Classes/MainScreenWithVideoPreview.m index 4252d06bb..a820849f5 100644 --- a/Classes/MainScreenWithVideoPreview.m +++ b/Classes/MainScreenWithVideoPreview.m @@ -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];