2

According to RFC2326, a server may send an ANNOUNCE message at any time, and the client must be prepared to answer.

However, it isn't clear which CSeq would the ANNOUNCE message have.

When I send a request with a method (be it PLAY, DESCRIBE, OPTIONS, etc), it has a cseq number, let's call it x. Can I trust that any message from the server, with cseq == x, will be a response to my message with sequence number x?

If not, then how can I realiably know that the message with same sequence number as mine, it actually a response to it?

Community
  • 1
  • 1
Gatonito
  • 1,662
  • 5
  • 26
  • 55

1 Answers1

1

According to 12.17 RFC2326 12.17 CSeq

The CSeq field specifies the sequence number for an RTSP request-
   response pair. This field MUST be present in all requests and
   responses. For every RTSP request containing the given sequence
   number, there will be a corresponding response having the same
   number.

The ANNOUNCE CSeq message from the server should be an increment from the previous message and you should response with CSeq from the server's ANNOUNCE CSeq.

You can trust the server to respond with the same CSeq that you used in your PLAY, DESCRIBE, OPTIONS.

If the server sends you an ANNOUNCE with the sequence number N then your OK response needs to have the sequence N in it. If you send a PLAY command after your OK - the PLAY would need N+1 as sequence number. For example:

Server->Client:
ANNOUNCE rtsp://192.168.1.2:554/foo RTSP/1.0
CSeq: 42

Client->Server:
RTSP/1.0 200 OK
CSeq: 42

Client->Server:
SETUP rtsp://192.168.1.2:554/foo/bar.foo RTSP/1.0
CSeq: 43

Server->Client:
RTSP/1.0 200 OK
CSeq: 43
Markus Schumann
  • 7,636
  • 1
  • 21
  • 27
  • should I burn the CSeq received from an ANNOUNCE? That is, not use it in my next message? – Gatonito Apr 13 '21 at 03:24
  • If the server sends you an ANNOUNCE with the sequence number N then your OK response needs to have the sequence N in it. If you send a PLAY command after your OK - the PLAY would need N+1 as sequence number. – Markus Schumann Apr 13 '21 at 14:38