FAQ: different payload number at SDP offer and answer

来源:互联网 发布:淘宝买身份证暗语 编辑:程序博客网 时间:2024/06/11 11:05

offer1:
...
m=audio 50364 RTP/AVP 103 101
a=rtpmap:103 g726-32/8000
...

 

answer1:
...
m=audio 18018 RTP/AVP 99 101
a=rtpmap:99 g726-32/8000
...

 

不少人会认为或者要求 sdp answer 里面的 g726-32 的 pt 要和 offer 里面的一样,都是 103。这里也是一个常见的误区。首先 SDP 是该 SDP 的所用者用来声明它希望接收的媒体信息要求。其次对于 dynamic payload 的 codec 协商,和常见的 G711 这些 static payload 协商机制是不一样的。static payload 的 codec 通过比较 payload type number 就可以确定。而 dynamic payload 的codec 则是通过比较 encoding name, clock rate, channel number 等参数,并不是比较 payload type number。

 

因此针对上面的例子,offer 方需要发送 payload type number 为 99 的 g726-32 给对方,而 answer 方需要发送 payload type number 为 103 的 g726-32 给对方。当然如果 SIP UA 无法处理这种情况的话,那么就双方对好 payload type number 去暂时解决吧。

 

 From 3264:

   In the case of RTP, if a particular codec was referenced with a
   specific payload type number in the offer, that same payload type
   number SHOULD be used for that codec in the answer.  Even if the same
   payload type number is used, the answer MUST contain rtpmap
   attributes to define the payload type mappings for dynamic payload
   types, and SHOULD contain mappings for static payload types.  The

   ...  The answerer MUST send using a media format in the offer
   that is also listed in the answer, and SHOULD send using the most
   preferred media format in the offer that is also listed in the
   answer.  In the case of RTP, it MUST use the payload type numbers
   from the offer, even if they differ from those in the answer.

Each end *receives* on the payload number it supplied, and *sends* on
the payload number it got from the other side.

原创粉丝点击