aboutsummaryrefslogtreecommitdiffstats
path: root/rtp.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-11-11 04:07:03 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-11-11 04:07:03 +0000
commit2fa6d0b41c332fb44ebdd1b353525acdb9c0d363 (patch)
treeb26826732702f7657f0919b876252d7603ea823a /rtp.c
parent87a362153826a8eb12951b8d993ab2f71d55f4a0 (diff)
Fix wrap around for rtp (bug #5595)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7069 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'rtp.c')
-rwxr-xr-xrtp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/rtp.c b/rtp.c
index 75979d821..653355e08 100755
--- a/rtp.c
+++ b/rtp.c
@@ -1098,6 +1098,8 @@ static unsigned int calc_txstamp(struct ast_rtp *rtp, struct timeval *delivery)
/* Use previous txcore if available */
t = (delivery && !ast_tvzero(*delivery)) ? *delivery : ast_tvnow();
ms = ast_tvdiff_ms(t, rtp->txcore);
+ if (ms < 0)
+ ms = 0;
/* Use what we just got for next time */
rtp->txcore = t;
return (unsigned int) ms;
@@ -1226,14 +1228,14 @@ static int ast_rtp_raw_write(struct ast_rtp *rtp, struct ast_frame *f, int codec
char iabuf[INET_ADDRSTRLEN];
int hdrlen = 12;
int res;
- int ms;
+ unsigned int ms;
int pred;
int mark = 0;
ms = calc_txstamp(rtp, &f->delivery);
/* Default prediction */
if (f->subclass < AST_FORMAT_MAX_AUDIO) {
- pred = rtp->lastts + f->samples;
+ pred = rtp->lastts + f->samples;
/* Re-calculate last TS */
rtp->lastts = rtp->lastts + ms * 8;