Skip to content
Snippets Groups Projects
Commit 4606d74a authored by Mark Spencer's avatar Mark Spencer
Browse files

Fix wrap around for rtp (bug #5595)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7069 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent c6e7b2a3
No related branches found
No related tags found
No related merge requests found
...@@ -1098,6 +1098,8 @@ static unsigned int calc_txstamp(struct ast_rtp *rtp, struct timeval *delivery) ...@@ -1098,6 +1098,8 @@ static unsigned int calc_txstamp(struct ast_rtp *rtp, struct timeval *delivery)
/* Use previous txcore if available */ /* Use previous txcore if available */
t = (delivery && !ast_tvzero(*delivery)) ? *delivery : ast_tvnow(); t = (delivery && !ast_tvzero(*delivery)) ? *delivery : ast_tvnow();
ms = ast_tvdiff_ms(t, rtp->txcore); ms = ast_tvdiff_ms(t, rtp->txcore);
if (ms < 0)
ms = 0;
/* Use what we just got for next time */ /* Use what we just got for next time */
rtp->txcore = t; rtp->txcore = t;
return (unsigned int) ms; return (unsigned int) ms;
...@@ -1226,14 +1228,14 @@ static int ast_rtp_raw_write(struct ast_rtp *rtp, struct ast_frame *f, int codec ...@@ -1226,14 +1228,14 @@ static int ast_rtp_raw_write(struct ast_rtp *rtp, struct ast_frame *f, int codec
char iabuf[INET_ADDRSTRLEN]; char iabuf[INET_ADDRSTRLEN];
int hdrlen = 12; int hdrlen = 12;
int res; int res;
int ms; unsigned int ms;
int pred; int pred;
int mark = 0; int mark = 0;
ms = calc_txstamp(rtp, &f->delivery); ms = calc_txstamp(rtp, &f->delivery);
/* Default prediction */ /* Default prediction */
if (f->subclass < AST_FORMAT_MAX_AUDIO) { if (f->subclass < AST_FORMAT_MAX_AUDIO) {
pred = rtp->lastts + f->samples; pred = rtp->lastts + f->samples;
/* Re-calculate last TS */ /* Re-calculate last TS */
rtp->lastts = rtp->lastts + ms * 8; rtp->lastts = rtp->lastts + ms * 8;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment