Handle RTP Contributing Source Identifiers (CSRC)
RFC 3550 allows for parties to optionally specify a list of Contributing Source Identifiers in the RTP header. Skip over them when looking for the RTP body.
This commit is contained in:
parent
5680bceb6d
commit
c0677b53b1
|
@ -5322,16 +5322,20 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
|
||||||
|
|
||||||
|
|
||||||
if (rtp_session->recv_msg.header.version == 2) {
|
if (rtp_session->recv_msg.header.version == 2) {
|
||||||
|
if (rtp_session->recv_msg.header.cc > 0) { /* Contributing Source Identifiers (4 bytes = sizeof CSRC header)*/
|
||||||
|
rtp_session->recv_msg.ebody = RTP_BODY(rtp_session) + (rtp_session->recv_msg.header.cc * 4);
|
||||||
|
}
|
||||||
|
|
||||||
/* recalculate body length in case rtp extension used */
|
/* recalculate body length in case rtp extension used */
|
||||||
if (!rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] && !rtp_session->flags[SWITCH_RTP_FLAG_UDPTL] &&
|
if (!rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] && !rtp_session->flags[SWITCH_RTP_FLAG_UDPTL] &&
|
||||||
rtp_session->recv_msg.header.version == 2 && rtp_session->recv_msg.header.x) { /* header extensions */
|
rtp_session->recv_msg.header.version == 2 && rtp_session->recv_msg.header.x) { /* header extensions */
|
||||||
uint16_t length;
|
uint16_t length;
|
||||||
|
|
||||||
rtp_session->recv_msg.ext = (switch_rtp_hdr_ext_t *) rtp_session->recv_msg.body;
|
rtp_session->recv_msg.ext = (switch_rtp_hdr_ext_t *) RTP_BODY(rtp_session);
|
||||||
length = ntohs((uint16_t)rtp_session->recv_msg.ext->length);
|
length = ntohs((uint16_t)rtp_session->recv_msg.ext->length);
|
||||||
|
|
||||||
if (length < SWITCH_RTP_MAX_BUF_LEN_WORDS) {
|
if (length < SWITCH_RTP_MAX_BUF_LEN_WORDS) {
|
||||||
rtp_session->recv_msg.ebody = rtp_session->recv_msg.body + (length * 4) + 4;
|
rtp_session->recv_msg.ebody = (char *)rtp_session->recv_msg.ext + (length * 4) + 4;
|
||||||
if (*bytes > (length * 4 + 4)) {
|
if (*bytes > (length * 4 + 4)) {
|
||||||
*bytes -= (length * 4 + 4);
|
*bytes -= (length * 4 + 4);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue