]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
fixes adaptive jitterbuffer configuration
authorDavid Vossel <dvossel@digium.com>
Tue, 2 Mar 2010 19:08:38 +0000 (19:08 +0000)
committerDavid Vossel <dvossel@digium.com>
Tue, 2 Mar 2010 19:08:38 +0000 (19:08 +0000)
When configuring the adaptive jitterbuffer, the target_extra
value not only could not be set from the configuration, but was
not even being set to its proper default.  This value is required
in order for the adaptive jitterbuffer to work correctly.  To resolve
this a config option has been added to expose this value to the conf
files, and a default value is provided when no config specific value
is present.

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

24 files changed:
channels/chan_alsa.c
channels/chan_console.c
channels/chan_dahdi.c
channels/chan_gtalk.c
channels/chan_h323.c
channels/chan_jingle.c
channels/chan_local.c
channels/chan_mgcp.c
channels/chan_oss.c
channels/chan_sip.c
channels/chan_skinny.c
channels/chan_unistim.c
channels/chan_usbradio.c
channels/misdn_config.c
configs/alsa.conf.sample
configs/chan_dahdi.conf.sample
configs/console.conf.sample
configs/mgcp.conf.sample
configs/misdn.conf.sample
configs/oss.conf.sample
configs/sip.conf.sample
configs/usbradio.conf.sample
include/asterisk/abstract_jb.h
main/abstract_jb.c

index b52a03c08a0a35ecd61d77c0020043a5c6e1b571..3f8d26d5a6726a411a1e3bd449e7ddbe29dc6cba 100644 (file)
@@ -62,7 +62,8 @@ static struct ast_jb_conf default_jbconf = {
        .flags = 0,
        .max_size = -1,
        .resync_threshold = -1,
-       .impl = ""
+       .impl = "",
+       .target_extra = -1,
 };
 static struct ast_jb_conf global_jbconf;
 
index df23c3dd12da0cd4750987be3fa9e68d383a9323..93a51ae4ebda08a740bdde25d2648f8b8d2c6c63 100644 (file)
@@ -177,7 +177,8 @@ static struct ast_jb_conf default_jbconf = {
        .flags = 0,
        .max_size = -1,
        .resync_threshold = -1,
-       .impl = ""
+       .impl = "",
+       .target_extra = -1,
 };
 static struct ast_jb_conf global_jbconf;
 
index cd1dbcfc350d3a8b8a6fc66291df38517e17b4bf..dacd234b373473a7d588c341dbf32047e1515d69 100644 (file)
@@ -269,7 +269,8 @@ static struct ast_jb_conf default_jbconf =
        .flags = 0,
        .max_size = -1,
        .resync_threshold = -1,
-       .impl = ""
+       .impl = "",
+       .target_extra = -1,
 };
 static struct ast_jb_conf global_jbconf;
 
index 8655806b0ac1701bedf879d02b1425dfa235f0e2..252e3fe20a54ef12edd7a110516f90dffaad98ef 100644 (file)
@@ -79,7 +79,8 @@ static struct ast_jb_conf default_jbconf =
        .flags = 0,
        .max_size = -1,
        .resync_threshold = -1,
-       .impl = ""
+       .impl = "",
+       .target_extra = -1,
 };
 static struct ast_jb_conf global_jbconf;
 
index 32d9443d41a36cf92abb3dee467d0be701a14310..145a3f5bb45727ebc57d731da579cb6230d0c65f 100644 (file)
@@ -118,7 +118,8 @@ static struct ast_jb_conf default_jbconf =
        .flags = 0,
        .max_size = -1,
        .resync_threshold = -1,
-       .impl = ""
+       .impl = "",
+       .target_extra = -1,
 };
 static struct ast_jb_conf global_jbconf;
 
index c1181dbfe50eb0f5bbb4bf6fc386ef937bf67626..b876dfd0d87b311e3cda580a3a7eb5b6cecd47dd 100644 (file)
@@ -77,7 +77,8 @@ static struct ast_jb_conf default_jbconf =
        .flags = 0,
        .max_size = -1,
        .resync_threshold = -1,
-       .impl = ""
+       .impl = "",
+       .target_extra = -1,
 };
 static struct ast_jb_conf global_jbconf;
 
index 51c4c2b87244463f4f85a3c76da88f01d04dbcee..80044f484dcfeccda15ef8a03e03055cca51304d 100644 (file)
@@ -58,6 +58,7 @@ static struct ast_jb_conf g_jb_conf = {
        .max_size = -1,
        .resync_threshold = -1,
        .impl = "",
+       .target_extra = -1,
 };
 
 static struct ast_channel *local_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
index 4910b0035948174ea52a6b5d78aa61e9ad25c6f3..5dfafb84ab29a64240a1865e2997fc97a9bf9f81 100644 (file)
@@ -99,7 +99,8 @@ static struct ast_jb_conf default_jbconf =
        .flags = 0,
        .max_size = -1,
        .resync_threshold = -1,
-       .impl = ""
+       .impl = "",
+       .target_extra = -1,
 };
 static struct ast_jb_conf global_jbconf;
 
index 37717049e2e7f735fcd814397d2fe792838c097b..09ca4b830640ea3808c53bb2a204a1dc247902b8 100644 (file)
@@ -72,6 +72,7 @@ static struct ast_jb_conf default_jbconf =
        .max_size = -1,
        .resync_threshold = -1,
        .impl = "",
+       .target_extra = -1,
 };
 static struct ast_jb_conf global_jbconf;
 
index 6aa8350e09fd2332ccd887988d8776e24c2c60bf..9944c00fdd290f072b53a241c35ebd6cae3a31cc 100644 (file)
@@ -555,7 +555,8 @@ static struct ast_jb_conf default_jbconf =
        .flags = 0,
        .max_size = -1,
        .resync_threshold = -1,
-       .impl = ""
+       .impl = "",
+       .target_extra = -1,
 };
 static struct ast_jb_conf global_jbconf;                /*!< Global jitterbuffer configuration */
 
index b0aa4e0a0f81e040d062aca7449534918e0358ac..126e94bdcaf68a77f8850056b5fbbe1ae16eba54 100644 (file)
@@ -220,7 +220,8 @@ static struct ast_jb_conf default_jbconf =
        .flags = 0,
        .max_size = -1,
        .resync_threshold = -1,
-       .impl = ""
+       .impl = "",
+       .target_extra = -1,
 };
 static struct ast_jb_conf global_jbconf;
 
index 79df466503f47d02fd7a012a44f94724b73b9478..0ebf879a1c566de7e48de1a6d86b1dbc7c91bfc8 100644 (file)
@@ -188,10 +188,11 @@ static void dummy(char *unused, ...)
 /*! \brief Global jitterbuffer configuration - by default, jb is disabled */
 static struct ast_jb_conf default_jbconf =
 {
-        .flags = 0,
+       .flags = 0,
        .max_size = -1,
        .resync_threshold = -1,
-       .impl = ""
+       .impl = "",
+       .target_extra = -1,
 };
 static struct ast_jb_conf global_jbconf;
                                
index dad7fc91f7f83871a622a470b98812027c3fdae2..e330b9f5c7bf4a04d6634717350b7142249344f8 100644 (file)
@@ -193,6 +193,7 @@ static struct ast_jb_conf default_jbconf =
        .max_size = -1,
        .resync_threshold = -1,
        .impl = "",
+       .target_extra = -1,
 };
 static struct ast_jb_conf global_jbconf;
 
index c16650680e2d7fd265f35eda46c2d5eeb2641974..82d3547f73e4190fe2302870e849eaa897cb2f77 100644 (file)
@@ -54,6 +54,7 @@ static struct ast_jb_conf default_jbconf =
        .max_size = -1,
        .resync_threshold = -1,
        .impl = "",
+       .target_extra = -1,
 };
 
 static struct ast_jb_conf global_jbconf;
index 0579cb33b7749f12be38e34c6942651b908e083f..ced5b4485a7803d5a4fd1f2f81432287a479c024 100644 (file)
@@ -66,6 +66,13 @@ extension=s
                               ; (with size always equals to jbmax-size) and "adaptive" (with
                               ; variable size, actually the new jb of IAX2). Defaults to fixed.
 
+; jbtargetextra = 40          ; This option only affects the jb when 'jbimpl = adaptive' is set.
+                              ; The option represents the number of milliseconds by which the new
+                              ; jitter buffer will pad its size. the default is 40, so without
+                              ; modification, the new jitter buffer will set its size to the jitter
+                              ; value plus 40 milliseconds. increasing this value may help if your
+                              ; network normally has low jitter, but occasionally has spikes.
+
 ; jblog = no                  ; Enables jitterbuffer frame logging. Defaults to "no".
 ;-----------------------------------------------------------------------------------
 
index 6f65169c516f692678489c2ad21149b3c85b07b1..942375341024e2f97d52641cb541e7e7e97ab63f 100644 (file)
@@ -855,6 +855,13 @@ pickupgroup=1
                               ; (with size always equals to jbmax-size) and "adaptive" (with
                               ; variable size, actually the new jb of IAX2). Defaults to fixed.
 
+; jbtargetextra = 40          ; This option only affects the jb when 'jbimpl = adaptive' is set.
+                              ; The option represents the number of milliseconds by which the new
+                              ; jitter buffer will pad its size. the default is 40, so without
+                              ; modification, the new jitter buffer will set its size to the jitter
+                              ; value plus 40 milliseconds. increasing this value may help if your
+                              ; network normally has low jitter, but occasionally has spikes.
+
 ; jblog = no                  ; Enables jitterbuffer frame logging. Defaults to "no".
 ;-----------------------------------------------------------------------------------
 ;
index 9bd502696aca321ccb60dc3d8f67d00aa8ae5741..606254eeea45e71b441fc7f77b45f5bd3b6f486b 100644 (file)
                               ; (with size always equals to jbmax-size) and "adaptive" (with
                               ; variable size, actually the new jb of IAX2). Defaults to fixed.
 
+; jbtargetextra = 40          ; This option only affects the jb when 'jbimpl = adaptive' is set.
+                              ; The option represents the number of milliseconds by which the new
+                              ; jitter buffer will pad its size. the default is 40, so without
+                              ; modification, the new jitter buffer will set its size to the jitter
+                              ; value plus 40 milliseconds. increasing this value may help if your
+                              ; network normally has low jitter, but occasionally has spikes.
+
 ; jblog = no                  ; Enables jitterbuffer frame logging. Defaults to "no".
 ;-----------------------------------------------------------------------------------
 
index c69602d7ad7fea3069d45abfaf862f3c196323e1..f5e5473d1b39e5a6531e528256969890b56205d5 100644 (file)
@@ -40,6 +40,13 @@ matchdigittimeout = 5000  ; defaults 3000 = 3s
                               ; (with size always equals to jbmax-size) and "adaptive" (with
                               ; variable size, actually the new jb of IAX2). Defaults to fixed.
 
+; jbtargetextra = 40          ; This option only affects the jb when 'jbimpl = adaptive' is set.
+                              ; The option represents the number of milliseconds by which the new
+                              ; jitter buffer will pad its size. the default is 40, so without
+                              ; modification, the new jitter buffer will set its size to the jitter
+                              ; value plus 40 milliseconds. increasing this value may help if your
+                              ; network normally has low jitter, but occasionally has spikes.
+
 ; jblog = no                  ; Enables jitterbuffer frame logging. Defaults to "no".
 ;-----------------------------------------------------------------------------------
 
index f4ca486e9b28806b5a8f2aed6784516af481dd72..9de874e9257638172c4178337c25fc74db372576 100644 (file)
@@ -132,6 +132,13 @@ crypt_keys=test,muh
                               ; (with size always equals to jbmaxsize) and "adaptive" (with
                               ; variable size, actually the new jb of IAX2). Defaults to fixed.
 
+; jbtargetextra = 40          ; This option only affects the jb when 'jbimpl = adaptive' is set.
+                              ; The option represents the number of milliseconds by which the new
+                              ; jitter buffer will pad its size. the default is 40, so without
+                              ; modification, the new jitter buffer will set its size to the jitter
+                              ; value plus 40 milliseconds. increasing this value may help if your
+                              ; network normally has low jitter, but occasionally has spikes.
+
 ; jblog = no                  ; Enables jitterbuffer frame logging. Defaults to "no".
 ;-----------------------------------------------------------------------------------
 
index d29d3ac52aef324268a6914c686faa02fc6d8e80..c3781a2a28c17d4f617179f55972f9e411508bb6 100644 (file)
                                   ; (with size always equals to jbmax-size) and "adaptive" (with
                                   ; variable size, actually the new jb of IAX2). Defaults to fixed.
 
+    ; jbtargetextra = 40          ; This option only affects the jb when 'jbimpl = adaptive' is set.
+                                  ; The option represents the number of milliseconds by which the new
+                                  ; jitter buffer will pad its size. the default is 40, so without
+                                  ; modification, the new jitter buffer will set its size to the jitter
+                                  ; value plus 40 milliseconds. increasing this value may help if your
+                                  ; network normally has low jitter, but occasionally has spikes.
+
     ; jblog = no                  ; Enables jitterbuffer frame logging. Defaults to "no".
     ;-----------------------------------------------------------------------------------
 
index 7109935e7f314a1a3e3ec33c841534c9876d3146..c4c4b83eacd35b19e94768f1616c494c171c7430 100644 (file)
@@ -892,6 +892,13 @@ srvlookup=yes                   ; Enable DNS SRV lookups on outbound calls
                               ; (with size always equals to jbmaxsize) and "adaptive" (with
                               ; variable size, actually the new jb of IAX2). Defaults to fixed.
 
+; jbtargetextra = 40          ; This option only affects the jb when 'jbimpl = adaptive' is set.
+                              ; The option represents the number of milliseconds by which the new jitter buffer
+                              ; will pad its size. the default is 40, so without modification, the new
+                              ; jitter buffer will set its size to the jitter value plus 40 milliseconds.
+                              ; increasing this value may help if your network normally has low jitter,
+                              ; but occasionally has spikes.
+
 ; jblog = no                  ; Enables jitterbuffer frame logging. Defaults to "no".
 ;-----------------------------------------------------------------------------------
 
index 5ba9815ca1c0576ab30f07dd8f09954941948242..6af373e6d17721f338a26ec50e0517d202d9d0a1 100644 (file)
                               ; (with size always equals to jbmax-size) and "adaptive" (with
                               ; variable size, actually the new jb of IAX2). Defaults to fixed.
 
+; jbtargetextra = 40          ; This option only affects the jb when 'jbimpl = adaptive' is set.
+                              ; The option represents the number of milliseconds by which the new
+                              ; jitter buffer will pad its size. the default is 40, so without
+                              ; modification, the new jitter buffer will set its size to the jitter
+                              ; value plus 40 milliseconds. increasing this value may help if your
+                              ; network normally has low jitter, but occasionally has spikes.
+
 ; jblog = no                  ; Enables jitterbuffer frame logging. Defaults to "no".
 ;-----------------------------------------------------------------------------------
 
index 5827787c5292cca669f7fd717e296de2243ff4b7..4efa924b8f70d33444a779813e9df045d1d5cc47 100644 (file)
@@ -59,9 +59,11 @@ struct ast_jb_conf
        /*! \brief Max size of the jitterbuffer implementation. */
        long max_size;
        /*! \brief Resynchronization threshold of the jitterbuffer implementation. */
-       long resync_threshold;
+       long resync_threshold;
        /*! \brief Name of the jitterbuffer implementation to be used. */
-       char impl[AST_JB_IMPL_NAME_SIZE];
+       char impl[AST_JB_IMPL_NAME_SIZE];
+       /*! \brief amount of additional jitterbuffer adjustment */
+       long target_extra;
 };
 
 
@@ -71,6 +73,7 @@ struct ast_jb_conf
 #define AST_JB_CONF_FORCE "force"
 #define AST_JB_CONF_MAX_SIZE "maxsize"
 #define AST_JB_CONF_RESYNCH_THRESHOLD "resyncthreshold"
+#define AST_JB_CONF_TARGET_EXTRA "targetextra"
 #define AST_JB_CONF_IMPL "impl"
 #define AST_JB_CONF_LOG "log"
 
index dd159c1f05a4cdfe61d030c2d26279690fbfe624..f23c176b1d1d04b7650bb1c6c821394b58cf270a 100644 (file)
@@ -592,6 +592,10 @@ int ast_jb_read_conf(struct ast_jb_conf *conf, const char *varname, const char *
        } else if (!strcasecmp(name, AST_JB_CONF_IMPL)) {
                if (!ast_strlen_zero(value))
                        snprintf(conf->impl, sizeof(conf->impl), "%s", value);
+       } else if (!strcasecmp(name, AST_JB_CONF_TARGET_EXTRA)) {
+               if (sscanf(value, "%30d", &tmp) == 1) {
+                       conf->target_extra = tmp;
+               }
        } else if (!strcasecmp(name, AST_JB_CONF_LOG)) {
                ast_set2_flag(conf, ast_true(value), AST_JB_LOG);
        } else {
@@ -738,6 +742,7 @@ static void *jb_create_adaptive(struct ast_jb_conf *general_config, long resynch
                jbconf.max_jitterbuf = general_config->max_size;
                jbconf.resync_threshold = general_config->resync_threshold;
                jbconf.max_contig_interp = 10;
+               jbconf.target_extra = general_config->target_extra;
                jb_setconf(adaptivejb, &jbconf);
        }