3

Our app uses AVCaptureSession for qr/barcode scanning. There is a simple close button that has become unresponsive in iOS 8.

It appears the output buffer is overloading the main UI thread.

It looks like the current output is on the main thread:

[captureOutput setSampleBufferDelegate:self queue:dispatch_get_main_queue()];

Should I be running this all on a separate thread? Current attempts to run on a background thread have failed.

Barett
  • 5,826
  • 6
  • 51
  • 55
josh k
  • 268
  • 1
  • 11
  • I am trying to also do this in a separate thread [here](https://github.com/dashesy/pyavfcam/blob/develop/src/modules/avf_impl.m) and have failed. Have you found a way to `start` and `stop` the thing on a thread other than main thread? Even the callbacks do not come when I `startRunning` from a non-main thread. – dashesy Sep 23 '15 at 18:33

1 Answers1

0

I had similar difficulties. I found that the UI thread was being over burdened by the work that I was doing in the sample buffer delegate's captureOutput(AVCaptureOutput, CMSampleBuffer, AVCaptureConnection) method. I moved that work off of the main thread and voila! alls good.

Substituting DispatchQueue.global() for DispatchQueue.main does the trick.

Verticon
  • 2,419
  • 16
  • 34