aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_iax2.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-05-19 00:01:11 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-05-19 00:01:11 +0000
commitf345cc2a2f4563266ec4f9c3aad6ca4125e7b7c3 (patch)
tree963b914b363c2ca14048f89f7ef97df03da0763d /channels/chan_iax2.c
parenta677d5f6ba7943ad0101100a389c0fbbd375be46 (diff)
Merge skew reduction (bug #4222)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5717 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_iax2.c')
-rwxr-xr-xchannels/chan_iax2.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index d22cd4f35..aae841665 100755
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -375,7 +375,7 @@ static struct iax2_registry *registrations;
#define DEFAULT_TRUNKDATA 640 * 10 /* 40ms, uncompressed linear * 10 channels */
#define MAX_TRUNKDATA 640 * 200 /* 40ms, uncompressed linear * 200 channels */
-#define MAX_TIMESTAMP_SKEW 640
+#define MAX_TIMESTAMP_SKEW 160 /* maximum difference between actual and predicted ts for sending */
/* If consecutive voice frame timestamps jump by more than this many milliseconds, then jitter buffer will resync */
#define TS_GAP_FOR_JB_RESYNC 5000
@@ -3476,6 +3476,11 @@ static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, str
* next multiple of frame size (so our
* silent periods are multiples of
* frame size too) */
+
+ if (abs(ms - p->nextpred) > MAX_TIMESTAMP_SKEW)
+ ast_log(LOG_DEBUG,"predicted timestamp skew (%u) > max (%u), using real ts instead.",
+ abs(ms - p->nextpred), MAX_TIMESTAMP_SKEW);
+
if (f->samples >= 8) /* check to make sure we dont core dump */
{
int diff = ms % (f->samples / 8);