From 23d7376f4dc5f25d36594704b859df256fa12e1d Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" <kpfleming@digium.com> Date: Sat, 14 May 2005 23:41:12 +0000 Subject: [PATCH] properly strip incoming padded RTP frames (bug #4264) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5652 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- rtp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rtp.c b/rtp.c index 8c727197b5..9fde8b857b 100755 --- a/rtp.c +++ b/rtp.c @@ -429,6 +429,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp) int version; int payloadtype; int hdrlen = 12; + int padding; int mark; int ext; int x; @@ -482,10 +483,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; -- GitLab