Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv29672

Modified Files:
        jitterbuf.c jitterbuf.h 
Log Message:
Jitter buffer improvements (bug #4167)


Index: jitterbuf.c
===================================================================
RCS file: /usr/cvsroot/asterisk/jitterbuf.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- jitterbuf.c 22 Apr 2005 13:11:34 -0000      1.6
+++ jitterbuf.c 9 May 2005 13:56:43 -0000       1.7
@@ -489,7 +489,7 @@
 
 
        /* 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 @@
        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 @@
                }
 
                /* 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))) {
 

Index: jitterbuf.h
===================================================================
RCS file: /usr/cvsroot/asterisk/jitterbuf.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- jitterbuf.h 17 Mar 2005 21:30:19 -0000      1.1
+++ jitterbuf.h 9 May 2005 13:56:43 -0000       1.2
@@ -30,6 +30,10 @@
 #define JB_HISTORY_DROPPCT_MAX 4
        /* the size of the buffer we use to keep the top and botton timestamps 
for dropping */
 #define JB_HISTORY_MAXBUF_SZ   JB_HISTORY_SZ * JB_HISTORY_DROPPCT_MAX / 100 
+       /* amount of additional jitterbuffer adjustment  */
+#define JB_TARGET_EXTRA 40
+       /* ms between growing and shrinking; may not be honored if jitterbuffer 
runs out of space */
+#define JB_ADJUST_DELAY 40
 
 
 /* return codes */

_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to