aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-07-20 22:46:58 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-07-20 22:46:58 +0000
commit51853788bd6b35b1ad2055cb7d3a04df39120efe (patch)
tree6b6ef2f5d62616fa9a2841813ea63a8d83336987 /channels
parentcb74ac56ed09d0df6ccf5d4f4a0882f158580a64 (diff)
_really_ fix IAX2 crazy timestamp problem (bug #4747)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6180 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_iax2.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 2062b9f38..93d27262a 100755
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -3380,6 +3380,7 @@ static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, str
int ms;
int voice = 0;
int genuine = 0;
+ int adjust;
struct timeval *delivery = NULL;
@@ -3421,8 +3422,15 @@ static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, str
if (p->notsilenttx && abs(ms - p->nextpred) <= MAX_TIMESTAMP_SKEW) {
/* Adjust our txcore, keeping voice and
non-voice synchronized */
- p->offset = ast_tvadd(p->offset,
- ast_samp2tv((ms - p->nextpred)/10, 1000)); /* XXX what scale is this ??? */
+ /* We need someone who understands this code to comment here on
+ why the 'adjust' value is handled as if it was in units
+ of 10,000 microseconds, instead of milliseconds
+ */
+ adjust = (ms - p->nextpred);
+ if (adjust < 0)
+ p->offset = ast_tvsub(p->offset, ast_samp2tv(abs(adjust), 10000));
+ else if (adjust > 0)
+ p->offset = ast_tvadd(p->offset, ast_samp2tv(adjust, 10000));
if (!p->nextpred) {
p->nextpred = ms; /*f->samples / 8;*/