在SDP中,冒号(':')和斜杠('/')用于许多属性值(标准和a =扩展名)。这里只是其中的一些:
b=AS:41
a=rtpmap:96 AMR-WB/16000/1
a=fmtp:96 mode-change-capability=2; max-red=80
我想知道(用于解析和生成SDP),如果在它们周围允许有空格。所有示例都指出在它们周围没有空格。我认为RFC 4566的第9节给出了SDP的语法尚不清楚。
我会说,通常,SDP不喜欢空格。来自rfc4566的第一条规则不能回答您的问题,但这只是一个开始:
An SDP session description consists of a number of lines of text of
the form:
<type>=<value>
where <type> MUST be exactly one case-significant character and
<value> is structured text whose format depends on <type>. In
general, <value> is either a number of fields delimited by a single
space character or a free format string, and is case-significant
unless a specific field defines otherwise. Whitespace MUST NOT be
used on either side of the "=" sign.
让我们从rfc4566中存在定义的bandwidth参数开始
bandwidth-fields = *(%x62 "=" bwtype ":" bandwidth CRLF)
; sub-rules of 'b='
bwtype = token
token = 1*(token-char)
token-char = %x21 / %x23-27 / %x2A-2B / %x2D-2E / %x30-39
/ %x41-5A / %x5E-7E
bandwidth = 1*DIGIT
从上面:
a=rtpmap:<payload type> <encoding name>/<clock rate> [/<encoding
parameters>]
这似乎引入了对时钟速率和编码参数之间的空格的要求(但这不是BNF格式!!!)。但是,有一个errata here报告该错误。
根据我的经验,在rtpmap execpt中,和有效负载定义之间不允许有空格。payload type
对于rtpmap,您还可以检查较新的ietf文档rfc4566bis,该文档为rtpmap提供了BNF定义,并且该文档显然没有空格:rtpmap-value = payload-type SP encoding-name
"/" clock-rate [ "/" encoding-params ]
payload-type = zero-based-integer
encoding-name = token
clock-rate = integer
encoding-params = channels
channels = integer
fmtp比较棘手,但是较新的rfc4566bis中的定义允许
byte-string BNF定义中包含空格:
fmtp-value = fmt SP format-specific-params
format-specific-params = byte-string
byte-string = 1*(%x01-09/%x0B-0C/%x0E-FF)
;any byte except NUL, CR, or LF
而且,根据经验,一些rfc正在使用“;”