gorastudio-git / SCNRecorder

The best way to record your AR experience!
MIT License
201 stars 51 forks source link

Crashing on iPad Pro 2020 and iOS 14+ #17

Closed zeman-88 closed 4 years ago

zeman-88 commented 4 years ago

Hello, when I try to take a photo or a video using your library on iPad Pro 2020 and iOS 14, the whole app freezes. I am not able to determine what's causing it because the debugger doesn't tell you anything; simply the app completely freezes. This wasn't the case on iOS 13+, exactly the same code.

What do you think it is? Would you mind looking into it? Many thanks.

v-grigoriev commented 4 years ago

Is this only reproducible on iPad Pro?

v-grigoriev commented 4 years ago

Which version of SCNRecorder are you using?

zeman-88 commented 4 years ago

Yes, only on iPad Pro 2020; I believe I may not be using the very latest, I’ll try to update and see if that helps. Why, did you make important fixes/changes lately? Many thanks.

zeman-88 commented 4 years ago

This issue was introduced with iOS 14.0.1; I don’t think it’s necessarily SCNRecorder’s fault, rather something that changed on Apple’s side, but sadly it makes the whole app where you use SCNRecorder freeze completely

v-grigoriev commented 4 years ago

I made a lot of improvements in the version 2.0 26 days ago. So if you use an older one it makes sense to update. Fortunately I will be able to test with iPad Pro 2020 tomorrow.

zeman-88 commented 4 years ago

Sounds good, thanks! I’ll be able to try out the new version soon, I’ll keep you posted.

pandraos commented 4 years ago

I'm having a similar problem with iPhone 11 Pro only when recording in landscape mode. The UI completely freezes while I record in landscape and returns to normal a few seconds after recording is done. The video generated is flawless.

Needless to say, the library works perfectly in portrait mode. It also seems to work properly if I start recording in portrait mode and rotate my phone to landscape halfway through the recording.

I hope the feedback helps.

Thank you for the great work and the amazing library!

v-grigoriev commented 4 years ago

I was able to reproduce the issue. But didn't find anything that can help to fix it. I even don't fully understand when freezing is happening, because at the same time recording goes smoothly. It might be something runloop related.

v-grigoriev commented 4 years ago

I think I have a solution to fix the issue, but still without understanding why does it happen.

@zeman-88 @pandraos I need your help to validate the fix. In your view controller with ARSCNView, in viewDidLoad, near sceneView.prepareForRecording() call, can you please add (sceneView.layer as? CAMetalLayer)?.framebufferOnly = false and verify is the issue gone.

pandraos commented 4 years ago

I just tried your suggested solution and it seems to work perfectly. I'll make sure to stress test it as much as I can. Thank you for the help.

zeman-88 commented 4 years ago

Thanks a lot @v-grigoriev , that fixes it. I wonder what's going on?

v-grigoriev commented 4 years ago

Yeah, there is a closed issue with something related to this. #11. Somewhy on pro models changing framebufferOnly when a recording starts produces unexpected bugs. (This is what SCNRecoder does under hood). So far I have no idea why.

v-grigoriev commented 4 years ago

@pandraos @zeman-88 FYI. Starting with 2.1.0 you don't need to set framebufferOnly anymore. I found a better way to capture pixels data.

pandraos commented 4 years ago

@pandraos @zeman-88 FYI. Starting with 2.1.0 you don't need to set framebufferOnly anymore. I found a better way to capture pixels data.

Thanks for the tip and for all your help!