frank.zheng
changed
bug 8355
Comment # 7
on bug 8355
from frank.zheng
There is a reference implementation of rfc 5761:
http://doubango.googlecode.com/svn/branches/2.0/doubango/tinyRTP/src/trtp_manager.c#329
static int _trtp_manager_recv_data(const trtp_manager_t* self, const uint8_t*
data_ptr, tsk_size_t data_size, tnet_fd_t local_fd, const struct
sockaddr_storage* remote_addr)
{
tsk_bool_t is_rtp_rtcp, is_rtcp = tsk_false, is_rtp = tsk_false, is_stun,
is_dtls;
// defined when RTCP-MUX is disabled and RTCP port is equal to "RTP Port +
1"
// rfc5764 - 5.1.2. Reception
// rfc5761 - 4. Distinguishable RTP and RTCP Packets
is_rtp_rtcp = (127 < *data_ptr && *data_ptr < 192);
if(is_rtp_rtcp){
is_stun = is_dtls = tsk_false;
is_rtcp = (self->rtcp.local_socket && self->rtcp.local_socket->fd ==
local_fd);
if(!is_rtcp && data_size >= 2 && (data_ptr[1] & 0x80)){
if(is_rtp_rtcp){
switch((data_ptr[1] & 0x7F)){
case 64: case 65:
case 72: case 73: case 74: case 75: case 76:
case 77: case 78:
case 79: is_rtcp = tsk_true; break;
}
}
}
is_rtp = !is_rtcp;
}
else{
is_dtls = !is_rtp_rtcp && (19 < *data_ptr && *data_ptr < 64);
is_stun = !is_dtls && TNET_IS_STUN2_MSG(data_ptr, data_size); /* MUST
NOT USE: "(*data_ptr < 2)" beacause of "Old VAT" which starts with "0x00" */;
}
http://doubango.googlecode.com/svn/branches/2.0/doubango/tinyRTP/src/rtcp/trtp_rtcp_packet.c#90
Hope this will help.
frank.zheng
You are receiving this mail because:
- You are watching all bug changes.