Sets the sample buffer delegate and the queue on which callbacks should be invoked.
- iOS 4.0+
- macOS 10.7+
- Mac Catalyst 13.0+
An object conforming to the
AVCaptureprotocol that will receive sample buffers after they are captured.
Video Data Output Sample Buffer Delegate
The queue on which callbacks should be invoked. You must use a serial dispatch queue, to guarantee that video frames will be delivered in order.
The sampleBufferCallbackQueue parameter may not be
NULL, except when setting the
When a new video sample buffer is captured, it is sent to the sample buffer delegate using
capture. All delegate methods are invoked on the specified dispatch queue.
If the queue is blocked when new frames are captured, those frames will be automatically dropped at a time determined by the value of the
always property. This allows you to process existing frames on the same queue without having to manage the potential memory usage increases that would otherwise occur when that processing is unable to keep up with the rate of incoming frames.
If your frame processing is consistently unable to keep up with the rate of incoming frames, you should consider using the
min property, which will generally yield better performance characteristics and more consistent frame rates than frame dropping alone.
If you need to minimize the chances of frames being dropped, you should specify a queue on which a sufficiently small amount of processing is being done outside of receiving sample buffers. However, if you migrate extra processing to another queue, you are responsible for ensuring that memory usage does not grow without bound from frames that have not been processed.