linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Linphone-developers] Linphone iOS Crash in iOS 8 When No Camera Access


From: Qian Li
Subject: [Linphone-developers] Linphone iOS Crash in iOS 8 When No Camera Access
Date: Thu, 13 Nov 2014 17:31:37 +0800

Hi,

I found an crash in iOS when Camera is not allowed in iOS 8.

The breakpoint is at

- (void)openDevice:(const char*) deviceId {
NSError *error = nil;
unsigned int i = 0;
AVCaptureDevice * device = NULL;
self->deviceId = deviceId;


NSArray * array = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
for (i = 0 ; i < [array count]; i++) {
AVCaptureDevice * currentDevice = [array objectAtIndex:i];
if(!strcmp([[currentDevice uniqueID] UTF8String], deviceId)) {
device = currentDevice;
break;
}
}
if (device == NULL) {
ms_error("Error: camera %s not found, using default one", deviceId);
device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
}
input = [AVCaptureDeviceInput deviceInputWithDevice:device
  error:&error];
[input retain]; // keep reference on an externally allocated object


AVCaptureSession *session = [(AVCaptureVideoPreviewLayer *)self.layer session];
[session addInput:input];
[session addOutput:output];
}

The file should be linphone-iphone/submodules/linphone/mediastreamer2/src/videofilters/ioscapture.m

The stack trace is:

Thread 1Queue : com.apple.main-thread (serial)
#0 0x36ab7c64 in objc_exception_throw ()
#1 0x27de61ae in -[AVCaptureSession _addInputWithNoConnections:] ()
#2 0x27de5a8e in -[AVCaptureSession addInput:] ()
#3 0x004a7aec in -[IOSCapture openDevice:]
#4 0x004a9852 in ms_v4ios_create_reader 
#5 0x004b3286 in video_preview_start 
#6 0x00466300 in linphone_core_iterate 
#7 0x00116732 in -[LinphoneManager iterate]
#8 0x29fbfc00 in __NSFireTimer ()
#9 0x292762a6 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ ()
#10 0x29275e22 in __CFRunLoopDoTimer ()
#11 0x29274072 in __CFRunLoopRun ()
#12 0x291c2210 in CFRunLoopRunSpecific ()
#13 0x291c2022 in CFRunLoopRunInMode ()
#14 0x305750a8 in GSEventRunModal ()
#15 0x2c7ce1d0 in UIApplicationMain ()
#16 0x0000c808 in main
#17 0x0000b028 in start ()

Maybe the input should be checked before adding it in iOS 8. According to the documentation,

You can only add an input to a session using this method if canAddInput: returns YES.

and the sample code in the documentation,
  • AVCaptureSession *captureSession = [[AVCaptureSession alloc] init];
  • AVCaptureDevice *audioCaptureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
  • NSError *error = nil;
  • AVCaptureDeviceInput *audioInput = [AVCaptureDeviceInput deviceInputWithDevice:audioCaptureDevice error:&error];
  • if (audioInput) {
  • [captureSession addInput:audioInput];
  • }
  • else {
  • // Handle the failure.
  • }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]