]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Nobody saw this coming, I bet.
authorNorth Antara <north@ntbox.com>
Thu, 1 Jun 2006 04:35:00 +0000 (04:35 +0000)
committerNorth Antara <north@ntbox.com>
Thu, 1 Jun 2006 04:35:00 +0000 (04:35 +0000)
jitterbuffer!

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@31250 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_skinny.c
configs/skinny.conf.sample

index e966a00ace861efe8fc7611cd661873a853bc33d..249541c32cffabc3d88765526915633211a71305 100644 (file)
@@ -69,6 +69,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/utils.h"
 #include "asterisk/dsp.h"
 #include "asterisk/stringfields.h"
+#include "asterisk/abstract_jb.h"
 
 /*************************************
  * Skinny/Asterisk Protocol Settings *
@@ -116,6 +117,15 @@ typedef unsigned int       UINT32;
 #define htoles(x) __bswap_16(x)
 #endif
 
+/*! Global jitterbuffer configuration - by default, jb is disabled */
+static struct ast_jb_conf default_jbconf =
+{
+       .flags = 0,
+       .max_size = -1,
+       .resync_threshold = -1,
+       .impl = ""
+};
+static struct ast_jb_conf global_jbconf;
 
 /*********************
  * Protocol Messages *
@@ -816,6 +826,8 @@ struct skinny_subchannel {
        int nat;
        int outgoing;
        int alreadygone;
+       struct ast_jb_conf jbconf;
+
        struct skinny_subchannel *next;
 };
 
@@ -1603,6 +1615,10 @@ static struct skinny_device *build_device(char *cat, struct ast_variable *v)
                                                        callnums++;
                                                        sub->cxmode = SKINNY_CX_INACTIVE;
                                                        sub->nat = nat;
+
+                                                       /* Assign default jb conf to the new skinny_subchannel */
+                                                       memcpy(&sub->jbconf, &global_jbconf, sizeof(struct ast_jb_conf));
+
                                                        sub->next = l->sub;
                                                        l->sub = sub;
                                                } else {
@@ -2292,6 +2308,10 @@ static struct ast_channel *skinny_new(struct skinny_subchannel *sub, int state)
                                tmp = NULL;
                        }
                }
+
+               /* Configure the new channel jb */
+               if (tmp && sub && sub->rtp)
+                       ast_jb_configure(tmp, &sub->jbconf);
        } else {
                ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
        }
@@ -3094,10 +3114,21 @@ static int reload_config(void)
                ast_log(LOG_NOTICE, "Unable to load config %s, Skinny disabled\n", config);
                return 0;
        }
-       /* load the general section */
        memset(&bindaddr, 0, sizeof(bindaddr));
+
+       /* Copy the default jb config over global_jbconf */
+       memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
+
+       /* load the general section */
        v = ast_variable_browse(cfg, "general");
        while(v) {
+               /* handle jb conf */
+               if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
+               {
+                       v = v->next;
+                       continue;
+               }
+
                /* Create the interface list */
                if (!strcasecmp(v->name, "bindaddr")) {
                        if (!(hp = ast_gethostbyname(v->value, &ahp))) {
index 8a910205a8471ef451a1af82746626cef7f3cee3..ab368b1ab7f2eb4e2d1189e86634fb6d2d99f0a2 100644 (file)
@@ -10,6 +10,33 @@ keepAlive=120
 ;allow=all
 ;disallow=
 
+;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
+;jbenable = yes              ; Enables the use of a jitterbuffer on the receiving side of a
+                             ; skinny channel. Defaults to "no". An enabled jitterbuffer will
+                             ; be used only if the sending side can create and the receiving
+                             ; side can not accept jitter. The skinny channel can accept
+                             ; jitter, thus a jitterbuffer on the receive skinny side will be
+                             ; used only if it is forced and enabled.
+
+;jbforce = no                ; Forces the use of a jitterbuffer on the receive side of a skinny
+                             ; channel. Defaults to "no".
+
+;jbmaxsize = 200             ; Max length of the jitterbuffer in milliseconds.
+
+;jbresyncthreshold = 1000    ; Jump in the frame timestamps over which the jitterbuffer is
+                             ; resynchronized. Useful to improve the quality of the voice, with
+                             ; big jumps in/broken timestamps, usualy sent from exotic devices
+                             ; and programs. Defaults to 1000.
+
+;jbimpl = fixed              ; Jitterbuffer implementation, used on the receiving side of a
+                             ; skinny channel. Two implementation are currently available
+                             ; - "fixed" (with size always equals to jbmaxsize)
+                             ; - "adaptive" (with variable size, actually the new jb of IAX2).
+                             ; Defaults to fixed.
+
+;jblog = no                  ; Enables jitterbuffer frame logging. Defaults to "no".
+;-----------------------------------------------------------------------------------
+
 
 ; Typical config for 12SP+
 ;[florian]