属性标记的SDP值中的“:”或“ /”本身是否带有空格(可选)?

问题描述 投票:0回答:1

在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的语法尚不清楚。

webrtc sip sdp
1个回答
0
投票

我会说,通常,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

从上面:

  • 因为%x20不是token-char]的一部分,所以在[[bwtype中不允许使用空格。中不允许有空格,因为它仅包含
  • DIGIT
  • “的左边或右边没有空格,否则,规范将使用bwtype SP”:“ SP带宽
  • 对于rtpmap,在RFC4566第6节中,rtpmap的定义在这里:
  • 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正在使用

“;”

周围的空间,而另一些则没有。我找不到确切的原因,但可能与Content-Type HTML标头中允许使用空格的事实有关。要了解有关此内容的更多信息,可以检查rfc4855rfc2045
© www.soinside.com 2019 - 2024. All rights reserved.