]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
correctly handle rtp padding (bug #4270)
authorRussell Bryant <russell@russellbryant.com>
Tue, 31 May 2005 12:55:43 +0000 (12:55 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 31 May 2005 12:55:43 +0000 (12:55 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/v1-0@5802 65c4cc65-6c06-0410-ace0-fbb531ad65f3

rtp.c

diff --git a/rtp.c b/rtp.c
index acbbf29ca77686e08154e76aff4819a7408eee20..c41faa7bb86394ff4e4d648acace77dde22a9be9 100755 (executable)
--- a/rtp.c
+++ b/rtp.c
@@ -407,6 +407,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
        int version;
        int payloadtype;
        int hdrlen = 12;
+       int padding;
        int mark;
        int ext;
        char iabuf[INET_ADDRSTRLEN];
@@ -458,10 +459,17 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
                return &null_frame;
        
        payloadtype = (seqno & 0x7f0000) >> 16;
+       padding = seqno & (1 << 29);
        mark = seqno & (1 << 23);
        ext = seqno & (1 << 28);
        seqno &= 0xffff;
        timestamp = ntohl(rtpheader[1]);
+       
+       if (padding) {
+               /* Remove padding bytes */
+               res -= rtp->rawdata[AST_FRIENDLY_OFFSET + res - 1];
+       }
+       
        if (ext) {
                /* RTP Extension present */
                hdrlen += 4;