Search code examples
rtsp

Can an RTSP TEARDOWN request be received before a SETUP request?


I was under the impression that since a TEARDOWN request releases resources that are normally allocated when a SETUP is made, a TEARDOWN request was only necessary after the SETUP request.

However, I just had an Android device that sent a TEARDOWN immediately after receiving the response to a DESCRIBE request (before the SETUP request, the Session: parameter of the request was empty).

This was unexpected, and I was not able to have a confirmation, even by re-reading the RFC, if this is legit or not.

Can anybody provide information on this? Ideally with am official reference...


Solution

  • Servers should typically be prepared to talk to various clients, and it is a good idea to design servers error prone: clients might send weird commands and servers should reasonably respond. TEARDOWN stops streaming, so it makes no sense to issue it before SETUP, however it is still legit to send this command without SETUP, the server receiving it would just have nothing to do, no resources to free. It is up to server to decide whether to respond with 200 OK, or another status indicating that command makes no sense in this context (e.g. the provided session identifier is not valid).