I’ve been having an issue with re-enabling streaming using the
STCaptureSession after disabling streaming a number of times. I’m curious to know if others have encountered this and have come up with some workaround that can serve as a temporary fix while the SDK dev team comes up with a fix for this.
To be clear, I begin a session by initializing a normal
STCaptureSession to stream both depth and color frames, very similarly to how this is done in the demo Scanner app, passing config options to begin monitoring and enabling streaming. Once a model is captured, the streaming is disabled in order to review the model in another controller. If the model needs to be recaptured, we return to the previous controller and reuse the same
STCaptureSession object, reenabling streaming to resume the capture process. In most cases, reenabling the stream works as you would expect, but in some cases, streaming does not work at all, causing me not to be able to receive any depth or color frame data. When I fall into this state, the screen appears to be frozen with the last color frame that was received before disabling streaming. All the
STCaptureSession properties indicate that the sensor is still connected and ready and its
isStreaming property does return true. I don’t receive any delegate calls from the capture session that would indicate that anything went wrong, like any changes in the sensor mode or camera mode. I believe this should a scenario that would fall in the
STCaptureSessionColorCameraModeUnknown state but that is not identified through the delegate call.
Another thing that may be important to note is that I do notice that in most cases that I experience this behavior, if not all, I do notice this reduced frame rate issue mentioned in the latest SDK release post:
I’m not entirely sure if these issues are related, but this may be relevant to the SDK dev team.
At the moment, the only solution that I have in place to help in this situation involves identifying when there may be long delays between frames in a streaming session. When a delay is observed, I display a message to alert the user to reconnect the sensor, though this is not a solution I am happy with. Ideally I would prefer if there were some trick to programmatically reset the capture session without interrupting the user experience. I’m curious to know if others have encountered this and if anyone has come up with some workaround that would easily reinitialize the capture session programmatically instead of promoting to do it manually.
Any help would be appreciated.