]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Handle the CC field in the RTP header. (issue #9384 reported by DoodleHu)
authorJoshua Colp <jcolp@digium.com>
Tue, 19 Jun 2007 17:00:58 +0000 (17:00 +0000)
committerJoshua Colp <jcolp@digium.com>
Tue, 19 Jun 2007 17:00:58 +0000 (17:00 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@69992 65c4cc65-6c06-0410-ace0-fbb531ad65f3

rtp.c

diff --git a/rtp.c b/rtp.c
index 81cddd0c739179d7766f4de3a3bda23f2feb8fd7..f0430b5111f24ed01069ad6680cb55db12acc335 100644 (file)
--- a/rtp.c
+++ b/rtp.c
@@ -437,6 +437,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
        int padding;
        int mark;
        int ext;
+       int cc;
        int x;
        char iabuf[INET_ADDRSTRLEN];
        unsigned int ssrc;
@@ -497,6 +498,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
        padding = seqno & (1 << 29);
        mark = seqno & (1 << 23);
        ext = seqno & (1 << 28);
+       cc = (seqno & 0xF000000) >> 24;
        seqno &= 0xffff;
        timestamp = ntohl(rtpheader[1]);
        ssrc = ntohl(rtpheader[2]);
@@ -514,10 +516,15 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
                res -= rtp->rawdata[AST_FRIENDLY_OFFSET + res - 1];
        }
        
+       if (cc) {
+               /* CSRC fields present */
+               hdrlen += cc*4;
+       }
+
        if (ext) {
                /* RTP Extension present */
+               hdrlen += (ntohl(rtpheader[hdrlen/4]) & 0xffff) << 2;
                hdrlen += 4;
-               hdrlen += (ntohl(rtpheader[3]) & 0xffff) << 2;
        }
 
        if (res < hdrlen) {