FAQ: different payload number at SDP offer and answer

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.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章