Webrtc 这是一句话:&引用;或/&引用;在属性标记的SDP值中,标记本身周围是否允许有空格?

Webrtc 这是一句话:&引用;或/&引用;在属性标记的SDP值中,标记本身周围是否允许有空格?,webrtc,sip,sdp,Webrtc,Sip,Sdp,在SDP中,许多属性值(标准扩展名和a=扩展名)都使用冒号(“:”)和斜杠(“/”)。以下是其中的几个: b=AS:41 a=rtpmap:96 AMR-WB/16000/1 a=fmtp:96 mode-change-capability=2; max-red=80 我想知道(用于解析和生成SDP),它们周围是否允许有空间。所有的例子都指向它们周围没有空间。我认为RFC4566的第9节给出了SDP的语法,但它对此并不清楚。我想说,通常,SDP不喜欢空白。rfc4566的第一条规则

在SDP中,许多属性值(标准扩展名和a=扩展名)都使用冒号(“:”)和斜杠(“/”)。以下是其中的几个:

  b=AS:41
  a=rtpmap:96 AMR-WB/16000/1
  a=fmtp:96 mode-change-capability=2; max-red=80

我想知道(用于解析和生成SDP),它们周围是否允许有空间。所有的例子都指向它们周围没有空间。我认为RFC4566的第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.
从上面:

  • bwtype中不允许空白,因为%x20不是标记字符的一部分
  • 带宽中不允许空白,因为它只包含
  • 在“:”的左侧或右侧没有空格,否则,规范将使用类似于bwtype SP:“SP bandwidth
对于rtpmap,在RFC4566第6节中,rtpmap的定义如下:

a=rtpmap:<payload type> <encoding name>/<clock rate> [/<encoding
  parameters>]
fmtp更复杂,但较新版本中的定义允许在字节字符串中使用空格

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使用了“;”周围的空格,而其他rfc则没有。我无法找到确切的原因,但这可能与内容类型HTML标头中允许使用空格有关。要了解更多信息,您可以查看和。

我想说的是,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.
从上面:

  • bwtype中不允许空白,因为%x20不是标记字符的一部分
  • 带宽中不允许空白,因为它只包含
  • 在“:”的左侧或右侧没有空格,否则,规范将使用类似于bwtype SP:“SP bandwidth
对于rtpmap,在RFC4566第6节中,rtpmap的定义如下:

a=rtpmap:<payload type> <encoding name>/<clock rate> [/<encoding
  parameters>]
fmtp更复杂,但较新版本中的定义允许在字节字符串中使用空格

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使用了“;”周围的空格,而其他rfc则没有。我无法找到确切的原因,但这可能与内容类型HTML标头中允许使用空格有关。要了解更多信息,您可以检查和。

因此,除非语法中指定了显式SP,否则可以安全地(或几乎如此)假设没有空间?如果语法不允许空间,当然没有!只有在找不到语法时才会出现问题……因此,除非语法中指定了显式SP,否则可以安全地(或几乎如此)假设没有空间?如果语法不允许空间,当然没有!只有当你找不到语法时问题才会出现。。。