stopScanning() hangs the app sometimes
alistra opened this issue · comments
The code in stopScanning
does stop the session on the side queue to not block the main queue
dispatch_async(self.privateSessionQueue, ^{
// Must be dispatched as it is blocking
[session stopRunning];
});
but sometimes the hang is caused by [self removeDeviceInput];
which is done on the main thread. This removes inputs from the AVCaptureSession
. This should also be done on a side queue. Also probably the code to remove outputs too.
There is an example how it should look like here https://stackoverflow.com/questions/21844675/how-to-stop-avcapturesession-properly
Thanks for letting me know. I've fixed this in the latest push - let me know if that fixes it on your end. If it does, I can release a new version.
I tested it out and it works like a charm now, please go ahead and release
I am concerned about the details of the code change, I added a remark to the commit directly. Please give this a thought before releasing.