SceneKit hang when change scene at runtime that contain AVCaptureDevice as material

Hi, I'm creating an app using SceneKit with AVCaptureDevice as material of some geometry. However I find there, maybe, is a bug in SceneKit. When I try to change the current scene in a SCNView at runtime, SceneKit will hang for 3 - 5 second if the new scene containing geometry with AVCaptureDevice as material.


It doesn't happen everytime, but you will hit this bug when repeat changing the scene for a few time. I try to debug and find it seems it is a thread interlocking bug between the AVFoundation and SceneKit.


Does anyone try this before? Or how to solve it?


Debug Log : https://bit.ly/2FAB1hK


Sample Code Screen: https://bit.ly/2THhrFh , https://bit.ly/2JYv2IG