2021年4月23日星期五

Understanding BNF notation for an RTSP request

According to RTSP documentation page 21 https://tools.ietf.org/html/rfc2326, an RTSP response is:

   Request      =       Request-Line          ; Section 6.1                  *(      general-header        ; Section 5                  |       request-header        ; Section 6.2                  |       entity-header )       ; Section 8.1                          CRLF                          [ message-body ]      ; Section 4.3  

The *, as far as I know and according to https://www.w3.org/Notation.html, means "1 or more of the thing after it". So I'm interpreting the thing above as

*(general-header|request-header|entity-header)CRLF  

This would explain this example below, where the headers are of the type general-header \r\n, like this: Cseq: 2\r\nContent-Base: rtsp://example.com/media.mp4\r\nContent-Type: application/sdp\r\nContent-Length: 360\r\n:

S->C: RTSP/1.0 200 OK        CSeq: 2        Content-Base: rtsp://example.com/media.mp4        Content-Type: application/sdp        Content-Length: 460          m=video 0 RTP/AVP 96        a=control:streamid=0        a=range:npt=0-7.741000        a=length:npt=7.741000        a=rtpmap:96 MP4V-ES/5544        a=mimetype:string;"video/MP4V-ES"        a=AvgBitRate:integer;304018        a=StreamName:string;"hinted video track"        m=audio 0 RTP/AVP 97        a=control:streamid=1        a=range:npt=0-7.712000        a=length:npt=7.712000        a=rtpmap:97 mpeg4-generic/32000/2        a=mimetype:string;"audio/mpeg4-generic"        a=AvgBitRate:integer;65790        a=StreamName:string;"hinted audio track"  

The headers are in the form general-header \r\n (where \r\n is CRLF). But what about that extra white line (a \r\n) before the message body? This is not explained by the repetition.

I think I'm interpreting something wrong.

https://stackoverflow.com/questions/67202354/understanding-bnf-notation-for-an-rtsp-request April 22, 2021 at 03:31AM

没有评论:

发表评论