videokit-ai / videokit

Low-code, cross-platform media SDK for Unity Engine. Register at https://videokit.ai
https://videokit.ai
Apache License 2.0
105 stars 14 forks source link

Crash on iOS after CameraDevice.Discover #80

Closed LoopIssuer closed 11 months ago

LoopIssuer commented 11 months ago

Hi, We have crash on iOS devices (not all, and not always). Probably connected with this:

            var query = CameraDevice.Discover();
            var devices = query.Result.OrderBy(device => device is CameraDevice camera).ToList();

because once we get log right after CameraDevice.Discover:


NullReferenceException: Object reference not set to an instance of an object.
NatML.Vision.MeetPredictor.Predict (NatML.MLFeature[] inputs) (at <00000000000000000000000000000000>:0)
--------------------
Stacktrace:
NatML.Vision.MeetPredictor.Predict (NatML.MLFeature[] inputs) (at <00000000000000000000000000000000>:0)
Assets.Scripts.Presentation.VideoCall.VideoCallScene.VideoCall.NatMlMeetBackgroundRemover.SwitchCamera() () (at <00000000000000000000000000000000>:0)
UnityEngine.Events.UnityEvent.Invoke () (at <00000000000000000000000000000000>:0)
VideoKit.Devices.Outputs.TextureOutput.OnPixelBuffer () (at <00000000000000000000000000000000>:0)

I saw in newest release notes: "Fixed rare crash due to frame rate setting when CameraDevice.Discover is invoked."

We use Videokit 0.015 and vision.meet 1.0.7. Crash was on device: iPhone XR, iOS 16.6.1, CPU arm64e, GFX Apple A12 GPU

Please tell me, can this issue be connected to CameraDevice.Discover? Are you able to check if this still occurs on iOS? Maybe you can give me some workaround for previous "crash due to frame rate setting"?

Thank you in advance.

LoopIssuer commented 11 months ago

@olokobayusuf I would like just to add, that previously we tested with version 0.015-alpha-6 - there were sth like 5 times more crashes than in version 0.015.

olokobayusuf commented 11 months ago

The stack trace seems to indicate that the issue is coming from the MeetPredictor, not VideoKit. As for the crash from Meet, we'll be migrating this predictor to our new Function platform, and officially deprecating the NatML version. I'll follow up with steps on how to upgrade.

LoopIssuer commented 11 months ago

Hi, Could you please give steps on how to upgrade?

olokobayusuf commented 11 months ago

Hey @LoopIssuer , can you shoot me a PM on Discord? I'll share more about migrating from NatML to Function.