Skip to content

The Pixel Buffers received from ARKit and saved during frame capture are not used in a very safe manner #363

@himanshunaidu

Description

@himanshunaidu

They are saved as CIImage objects backed by the pixel buffers. However, these pixel buffers are the original ARKit buffers, and are thus owned by ARKit. They may be recycled at any time.
In the current setup, this may not pose a major issue as the ARSession is paused whenever the capture button is clicked, thus the pixel buffers have a lower possibility of being recycled.
But in the future, when this pause becomes optional (e.g. to enable Dead Reckoning), these buffers cannot be relied upon.

The following are some of the ways this issue can be prevented:

  1. Manually copy all the buffers into new pixel buffers and wrap that with a new CIImage.
  2. Create a CGImage from the CIImage which would result in the new CIImage being backed by a CGImage not touched by anyone else. Easier to implement, and historically, has been safer. But this will be inefficient compared to other solutions.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions