是“:"吗?或“/"在属性标记的 SDP 值中,它们周围有可选的空格吗? [英] Are the ":" or "/" in SDP values for attributes tokens by themselves with spaces optionally allowed around them?

查看:42
本文介绍了是“:"吗?或“/"在属性标记的 SDP 值中,它们周围有可选的空格吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 SDP 中,冒号 (':') 和斜杠 ('/') 用于许多属性值(标准和 a= 扩展).这里只是其中的几个:

In SDP, colon(':') and slash('/') are used in many attribute values (both the standard and a= extensions). Here are just a few of them:

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

我想知道(用于解析和生成 SDP),它们周围是否允许空间.所有示例都指出它们周围没有空间.我认为给出 SDP 语法的 RFC 4566 的第 9 节对此并不清楚.

I want to know (both for parsing and generating SDP), if space is allowed around them. All examples point to not having a space around them. I think Section 9 of RFC 4566 which gives the grammar for SDP is not clear about this.

推荐答案

我会说,通常,SDP 不喜欢空格.rfc4566 的第一条规则没有回答您的问题,但这是一个开始:

I would say, that usually, SDP don't like whitespace. The first rule from rfc4566 is not answering your question, but it's a start:

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 中的带宽参数开始

Let's start with the bandwidth parameter where the definition exists in rfc4566

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

从上面:

  • bwtype 中不允许有空格,因为 %x20 不是 token-char
  • 的一部分
  • 带宽中不允许有空格,因为它只包含DIGIT.
  • :"的左边或右边没有空格,否则,规范将使用类似bwtype SP ":" SP带宽
  • there is no whitespace allowed in bwtype because %x20 is not part of token-char
  • there is no whitespace allowed in bandwidth because it contains only DIGIT.
  • there is no whitespace on left or right of ":", otherwise, the specification would use something like bwtype SP ":" SP bandwidth

对于rtpmap,在RFC4566第6节中,rtpmap的定义在这里:

For rtpmap, in RFC4566 Section 6, the definition of rtpmap is here:

a=rtpmap:<payload type> <encoding name>/<clock rate> [/<encoding
  parameters>]

这似乎在时钟速率和编码参数之间引入了空格的要求(但它不是 BNF 格式!!!).但是,有一个此处的勘误表报告这是一个错误.

This seems to introduce the requirement for a space between clock rate and encoding parameter (but it's NOT BNF format!!!). However, there is an errata here which reports that was an error.

根据我的经验,rtpmap execpt 中payload type 和payload 定义之间不允许有空格.

According to my experience, it is not allowed to have space in rtpmap execpt between payload type and the payload definition.

对于rtpmap,您还可以查看较新的ietf文档rfc4566bis 提供了 rtpmap 的 BNF 定义,而这个显然没有空格:

For rtpmap, you may also check the newer ietf document rfc4566bis which provides a BNF definition for rtpmap, and this one is clearly without space:

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 is more tricky, but the definition in newer rfc4566bis is allowing spaces in byte-string BNF definition:

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.

Also, from experience, some rfc are using space around ";" and other are not. I'm not able to find the exact reason, but it may be related to the fact that spaces are allowed in Content-Type HTML header. To read more about this, you may check rfc4855 and rfc2045.

这篇关于是“:"吗?或“/"在属性标记的 SDP 值中,它们周围有可选的空格吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆