Commit 453c5606 authored by Guillaume BIENKOWSKI's avatar Guillaume BIENKOWSKI

Prevent crash when the user has removed the access to the camera in iOS.

parent 25e08954
......@@ -297,11 +297,19 @@ static void capture_queue_cleanup(void* p) {
}
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];
if ( input && [session canAddInput] ){
[input retain]; // keep reference on an externally allocated object
[session addInput:input];
} else {
ms_error("Error: input nil or cannot be added: %p", input);
}
if( output && [session canAddOutput:output] ){
[session addOutput:output];
} else {
ms_error("Error: output nil or cannot be added: %p", output);
}
}
- (void)dealloc {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment