mainsail-crew / crowsnest

Webcam Service for multiple Cams
GNU General Public License v3.0
315 stars 74 forks source link

Camera Streamer UDP Ghost Stream #135

Open Xaver106 opened 1 year ago

Xaver106 commented 1 year ago

What happened

Camera Streamer currently has an isse, where a stream keeps running after it has been closed. This can overwhelm older Hardware quite quickly. In my case even causing me to no longer be able to reach my mainsail instance. https://github.com/ayufan/camera-streamer/issues/55

What did you expect to happen

A mention about this on the Documentation.

How to reproduce

Explainewd in the Linked Bug Report: https://github.com/ayufan/camera-streamer/issues/55

Additional information

It is probably best to either not reccomend the camera Streamer as default or add a warning.

Xaver106 commented 1 year ago

Ustreamer seems to still depend on the legacy camera support. Not using the WebRTC Stream option and sticking to the MJPEG-streamer seems to not trigger the Ghost Stream

jpiccari commented 1 year ago

Ghost streams are caused by lack of proper shutdown of the stream by the clients. Chrome, Edge, Safari, etc do not properly signal closing the peer connection and instead just stop receiving communication. For mobile devices this happens quite frequently due to locking/unlocking a phone. I have a fix that adds a keep-alive type mechanism to camera-streamer but it will also require updates to Mainsail as it has its own front-end code displaying the stream.

I haven't looking into the rtsp implementation used within Mainsail/camera-streamer but that might be another viable workaround.

meteyou commented 1 year ago

@jpiccari Mainsail doesn't have a rtsp stream client right now, but feel free to contact me, if you need help to implement the keep-alive mechanism in the webrtc client in Mainsail.

jpiccari commented 1 year ago

I can submit a PR with the changes I have in my local mainsail. It will be dependent on camera-streamer being updated (also need to submit a PR over there) and frankly, camera-streamer is just not very reliable (webrtc or otherwise) in my experience running on a Raspberry Pi 3B+ so even with the fix I think it is probably better for users to look to ustreamer + janus-gateway for webrtc streaming (although I haven't been able to set that up yet, anyone point me to some docs?).