Merge remote-tracking branch 'public/master' into buschjaeger

This commit is contained in:
Pierre-Eric Pelloux-Prayer 2012-04-26 15:33:10 +02:00
commit 80503eb9dd
4 changed files with 51 additions and 34 deletions

View file

@ -713,7 +713,9 @@ static void hideSpinner(LinphoneCall* call, void* user_data) {
videoWaitingForFirstImage.hidden = NO;
[videoWaitingForFirstImage startAnimating];
linphone_call_set_next_video_frame_decoded_callback(call, hideSpinner, self);
if (call->videostream) {
linphone_call_set_next_video_frame_decoded_callback(call, hideSpinner, self);
}
return;
if (mIncallViewIsReady) {
@ -1003,10 +1005,10 @@ static void hideSpinner(LinphoneCall* call, void* user_data) {
cell.accessoryType = UITableViewCellAccessoryNone;
} else {
LinphoneCall* call = [IncallViewController retrieveCallAtIndex:indexPath.row inConference:NO];
if (call == nil)
return cell; // return dummy cell
LinphoneMediaEncryption enc = linphone_call_params_get_media_encryption(linphone_call_get_current_params(call));
if (call == nil)
return nil;
if (cell.accessoryView == nil) {
if (cell.accessoryView == nil) {
UIView *containerView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 28, 28)] autorelease];
cell.accessoryView = containerView;
}

View file

@ -72,7 +72,6 @@
- (void)viewDidLoad
{
[super viewDidLoad];
[phoneMainView.switchCamera addTarget:self action:@selector(switchCameraPressed) forControlEvents:UIControlEventTouchUpInside];
}
-(void) switchCameraPressed {
@ -80,36 +79,51 @@
}
-(void) useCameraAtIndex:(NSInteger)camIndex startSession:(BOOL)start {
[session stopRunning];
@synchronized (self) {
[session stopRunning];
if (input != nil)
[session removeInput:input];
if (input != nil)
[session removeInput:input];
NSError* error;
NSError* error;
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc]init];
NSArray* array = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
if ( [array count] == 0) {
ms_warning("No camera available (running on simulator ?");
return;
}
currentCamera = camIndex % [array count];
AVCaptureDevice* device = (AVCaptureDevice*) [array objectAtIndex:currentCamera];
input = [[AVCaptureDeviceInput deviceInputWithDevice:device
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc]init];
NSArray* array = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
if ( [array count] == 0) {
ms_warning("No camera available (running on simulator ?");
return;
}
currentCamera = camIndex % [array count];
AVCaptureDevice* device = (AVCaptureDevice*) [array objectAtIndex:currentCamera];
input = [[AVCaptureDeviceInput deviceInputWithDevice:device
error:&error] retain];
[session addInput:input];
[session addInput:input];
[pool drain];
[pool drain];
if (start)
[session startRunning];
if (start)
[session startRunning];
}
}
-(void) stopPreview:(id) a {
@synchronized (self) {
if (!session.running)
return;
[self.view removeFromSuperview];
[session stopRunning];
}
}
-(void) startPreview:(id) a {
[window addSubview:self.view];
[window sendSubviewToBack:self.view];
[session startRunning];
@synchronized (self) {
if (session.running)
return;
[window addSubview:self.view];
[window sendSubviewToBack:self.view];
[session startRunning];
}
}
@ -129,18 +143,16 @@
if (show && !session.running) {
[self performSelectorInBackground:@selector(startPreview:) withObject:nil];
} else if (!show && session.running) {
[self.view removeFromSuperview];
[session stopRunning];
[self performSelectorInBackground:@selector(stopPreview:) withObject:nil];
}
} else {
if (session != nil)
[session stopRunning];
[self.view removeFromSuperview];
[self stopPreview:nil];
}
}
-(void) viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[phoneMainView.switchCamera addTarget:self action:@selector(switchCameraPressed) forControlEvents:UIControlEventTouchUpInside];
}
-(void) viewDidDisappear:(BOOL)animated {

View file

@ -135,8 +135,8 @@
[self updateCallAndBackButtons];
}
-(void) viewWillDisappear:(BOOL)animated {
[mMainScreenWithVideoPreview showPreview:NO];
-(void) viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
}
@ -244,7 +244,7 @@
-(void) displayIncomingCall:(LinphoneCall*) call NotificationFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName {
[mMainScreenWithVideoPreview showPreview:NO];
if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)]
&& [UIApplication sharedApplication].applicationState != UIApplicationStateActive) {
// Create a new notification
@ -304,6 +304,7 @@
}
-(void) displayCall: (LinphoneCall*) call InProgressFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName {
[mMainScreenWithVideoPreview showPreview:NO];
if (self.presentedViewController != (UIViewController*)mIncallViewController) {
[self presentModalViewController:(UIViewController*)mIncallViewController animated:true];
}
@ -316,6 +317,7 @@
}
-(void) displayInCall: (LinphoneCall*) call FromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName {
[mMainScreenWithVideoPreview showPreview:NO];
if (self.presentedViewController != (UIViewController*)mIncallViewController && (call == 0x0 ||
linphone_call_get_dir(call)==LinphoneCallIncoming)){
[self presentModalViewController:(UIViewController*)mIncallViewController animated:true];
@ -336,6 +338,7 @@
-(void) displayVideoCall:(LinphoneCall*) call FromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName {
[mMainScreenWithVideoPreview showPreview:NO];
[mIncallViewController displayVideoCall:call FromUI:viewCtrl
forUser:username
withDisplayName:displayName];

@ -1 +1 @@
Subproject commit edad295e0596eebc7ca4aed7472e0e3bdc696b41
Subproject commit 0e496ed3d9f19528b0a2db5050c11030ca6a1312