aboutsummaryrefslogtreecommitdiffstats
path: root/rtp.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-05-14 23:41:12 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-05-14 23:41:12 +0000
commit226b476d7fd4a072b99ee91c366d4e7bee6e95a2 (patch)
treeac08bf19de647db7541c64d73db4799c4eef2978 /rtp.c
parent22dd5e0c8d3023f7dcad15489703f52b8cad395f (diff)
properly strip incoming padded RTP frames (bug #4264)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5652 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'rtp.c')
-rwxr-xr-xrtp.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/rtp.c b/rtp.c
index 8c727197b..9fde8b857 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;