-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with Moonfire NVR #1066
Comments
With @r0l1's patch bluenviron/gortsplib@212b081 (only the |
Hello,
Please report these issues to the retina developers. |
Thank you @aler9. Your detailed explanation will certainly help a lot to improve things. |
Hi. Moonfire/Retina developer here.
Not sure i agree. I don't actually care if the request succeeds (setting no parameters, as there's no body anyway) or fails with a 501 Not Implemented, so long as it extends the session time and doesn't drop the connection (more below). So If Do you accept RTCP receiver reports as keepalives? I believe the problem here is that rtsp-simple-server is dropping the connection after sending the 501. When using interleaved channels, this effectively kills the session. Why does it do that? (Even when using UDP, Moonfire/Retina doesn't gracefully handle loss of the RTSP connection right now. I know it should, but I haven't gotten around to it yet.)
What others? Retina's been tested with maybe a couple dozen implementations by now and hasn't had any problems with its keepalives.
Yeah, I can switch that. Is it relevant? What timeout are you using? |
Hello, this is the procedure to send RTSP keepalives from a RTSP client to a RTSP server:
This procedure is implemented by FFmpeg, GStreamer, VLC and rtsp-simple-server: Regarding timeout, i can assure you that there are cameras with timeouts < 30secs, and that taking the parameter from the Session header is the only reliable way to get a stable connection. |
That's the procedure those implementations use, sure. It's not what the ONVIF streaming spec recommends, and it's not mandated in the RTSP RFC, so I don't think it's the only valid approach. If I sent
Fair enough, and I'll fix my implementation there when I get a chance. But is it relevant to why this particular session failed? What timeout is rtsp-simple-server using? |
Current RTSP 1.0 specification (https://www.rfc-editor.org/rfc/rfc2326.html) clearly states that
If you're referring to the RTSP 2.0 specification (https://www.rfc-editor.org/rfc/rfc7826.html) it's not fully implemented by any major client and i think it will never be, since vendors have agreed to develop and support a new protocol (SRT). Anyway, it's the server that decides the keepalive method, not the client.
yes, as long as you're also including the
This is a workaround not included inside the main branch
Probably not since this server uses 60 seconds. BTW, let me give you an advice regarding RTSP: the problem of the protocol is that it's implemented (badly) into a lot of embedded hardware, that can't be changed. There are a lot of constraints that aren't specified inside the RFC but have become common practice since most vendors have chosen to adapt them. Therefore, you can chose to either support a RFC compliant and strict version of the protocol, that may work with software that is actively maintained and can be changed (like this server), or to relax constraints in order to support most cameras. This is unfortunately also true with protocols that follows RFCs more strictly, like WebRTC: open source developers (like the one of the pion project) tried to follow the specifications, but since Chrome/Chromium has an enormous market share, pion has been repeatedly adapted in order to better support Chromium. |
It also says this:
My expectation had been there shouldn't be any harm from sending an unsupported method. This has been true of all the servers I've tried until now. Note the lower case of the "should" not attempt to use those method again; I paid little attention to that optional advice since I'm not actually trying to set a parameter, just keep the connection warm... simple-rtsp-server is not just failing the request (400, 501, whatever) but also dropping the connection. With interleaved channels, that's a destructive action. I'd strongly advise changing this behavior.
Yeah I've also learned the same thing about RTSP implementations in general and have had to add various workarounds. I'm open to making changes to my implementation. I'm just surprised by your "this is the one way to do it" when I've seen contrary advice from a standard body.
I'm not. My code is intended to be purely RTSP/1.0, not 2.0. apologies for not being more precise before. I'm on my way to the airport now and a bit rushed... I'm typing this comment on my phone. (Although oddly enough I've noticed the onvif streaming spec refers to the 2.0 rfc in a couple places to clarify expectations, despite using 1.0 otherwise). It's frustrating that the rfc writers have essentially abandoned the RTSP/1.0 errata in favor of this incompatible protocol no one will ever use and folks like us are stuck reading tea leaves...) |
The server will be adapted in order to return 501 and not not drop the connection. |
(bluenviron/mediamtx#1066) Return 501 and keep connection open instead of returning 400 and closing the connection.
Alessandro Ros [asserts](bluenviron/mediamtx#1066 (comment)) that some servers have timeouts shorter than 30 seconds; this should improve compatibility with them. Also add some debug logging around keepalives.
The server has been adapted in order to return 501 in case of unhandled methods, starting from v0.20.0. |
Is there a way to change rtsp simple server timeout? |
This issue is being locked automatically because it has been closed for more than 6 months. |
Which version are you using?
v0.19.3
Which operating system are you using?
Describe the issue
When using Moonfire NVR as client, the connection breaks every 30 seconds. It seems that the SET_PARAMETER call used for keep alives is the root cause.
Describe how to replicate the issue
No special config needed, simply use Moonfire NVR as client, e.g. as described in related bug report scottlamb/moonfire-nvr#234
Did you attach the server logs?
yes, please see debug log:
Unlike in #842, a session header is included in the keep alive. Therefore I do not understand that the response is "400 Bad Request" and the connection is closed.
Did you attach a network dump?
no
The text was updated successfully, but these errors were encountered: