diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-05-09 13:56:43 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-05-09 13:56:43 +0000 |
commit | cabec1d2f6494e831c4780b8cfaae23227989491 (patch) | |
tree | e516b2fc71443d94b10f4fa0139e9d4cbd7822ff /jitterbuf.c | |
parent | 1bcbf414c6d8c7fd9d03cfc6880d31628a384fc2 (diff) |
Jitter buffer improvements (bug #4167)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5610 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'jitterbuf.c')
-rwxr-xr-x | jitterbuf.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/jitterbuf.c b/jitterbuf.c index 365ec44f0..e319776ca 100755 --- a/jitterbuf.c +++ b/jitterbuf.c @@ -489,7 +489,7 @@ static int _jb_get(jitterbuf *jb, jb_frame *frameout, long now) /* target */ - jb->info.target = jb->info.jitter + jb->info.min + 2 * jb->info.last_voice_ms; + jb->info.target = jb->info.jitter + jb->info.min + JB_TARGET_EXTRA; /* if a hard clamp was requested, use it */ if ((jb->info.max_jitterbuf) && ((jb->info.target - jb->info.min) > jb->info.max_jitterbuf)) { @@ -509,8 +509,8 @@ static int _jb_get(jitterbuf *jb, jb_frame *frameout, long now) if (!jb->info.silence) { /* we want to grow */ if ((diff > 0) && - /* we haven't grown in 2 frames' length */ - (((jb->info.last_adjustment + 2 * jb->info.last_voice_ms ) < now) || + /* we haven't grown in the delay length */ + (((jb->info.last_adjustment + JB_ADJUST_DELAY) < now) || /* we need to grow more than the "length" we have left */ (diff > queue_last(jb) - queue_next(jb)) ) ) { @@ -558,7 +558,10 @@ static int _jb_get(jitterbuf *jb, jb_frame *frameout, long now) } /* we want to shrink; shrink at 1 frame / 500ms */ - if (diff < -2 * jb->info.last_voice_ms && + /* unless we don't have a frame, then shrink 1 frame */ + /* every 80ms (though perhaps we can shrink even faster */ + /* in this case) */ + if (diff < -JB_TARGET_EXTRA && ((!frame && jb->info.last_adjustment + 80 < now) || (jb->info.last_adjustment + 500 < now))) { |