snowzach / doods2

API for detecting objects in images and video streams using Tensorflow
MIT License
221 stars 28 forks source link

Stream and MQTT mode unable to recover from stream errors #74

Closed fusetak closed 1 year ago

fusetak commented 1 year ago

When using either the websocket based /stream API or MQTT mode doods2 is not able to recover from network or other issues with the stream that it is consuming. It seems like when these issues happen doods2 either crashes or gets stuck in an infinite loop in fresh_frame.py.

It seems like this can be fixed by changing the conditional in streamer.py to detect an issue with the FreshestFrame.read() (ie: it returning no data) and then just re-creating the VideoCapture and FreshestFrame in order to re-establish the stream. I would happy to submit a PR to implement this idea if it seems like a good idea.

snowzach commented 1 year ago

That seems reasonable. If you're willing to try it, I will happily accept it.