keshavdv / unifi-cam-proxy

Enable non-Ubiquiti cameras to work with Unifi NVR
MIT License
1.65k stars 230 forks source link

Better resiliency #149

Closed ascott18 closed 2 years ago

ascott18 commented 2 years ago

A few changes for better resiliency that I had in my own fork prior to your work on the Amcrest stuff (thanks again for that - never thought to look for a dedicated python package):

I removed the has_connected logic for ConnectionRefused because one can imagine a scenario after a power outage where the device running unifi-cam-proxy recovers faster than the CKG2+ (or whatever Protect is running on). The introduction of a log message will make it clear to the user what is happening if they misconfigured the IP address that Protect is running at.

If you end up wanting to go a different route on #148, feel free to close this PR and just copy the changes for core.py.

keshavdv commented 2 years ago

Thanks for the fixes! This is definitely better than just breaking outright when hitting pipe buffer limits but I'll probably give take another stab at safely collecting the output mainly for debugging purposes. It's really hard to help on most bug reports on specific cameras without access to similar hardware or a wealth of stream information. Since there might be three or more ffmpeg processes all piping to stderr, I imagine it might be hard to decipher what's going on if they all die simultaneously or without a bit more structure.