From: David Vossel Date: Tue, 2 Mar 2010 19:12:26 +0000 (+0000) Subject: Merged revisions 249893 via svnmerge from X-Git-Tag: 1.6.2.6-rc1~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07a05534e0950ef5e86cde75b8a64053179efd00;p=thirdparty%2Fasterisk.git Merged revisions 249893 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ........ r249893 | dvossel | 2010-03-02 13:08:38 -0600 (Tue, 02 Mar 2010) | 11 lines fixes adaptive jitterbuffer configuration 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/branches/1.6.2@249895 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c index 0765308c9c..75f63aecb3 100644 --- a/channels/chan_alsa.c +++ b/channels/chan_alsa.c @@ -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; diff --git a/channels/chan_console.c b/channels/chan_console.c index fccb1e7453..933cca3567 100644 --- a/channels/chan_console.c +++ b/channels/chan_console.c @@ -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; diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 1d4c55a886..309876f726 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -175,7 +175,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; diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c index d608cc05c5..b5bc0ec84d 100644 --- a/channels/chan_gtalk.c +++ b/channels/chan_gtalk.c @@ -78,7 +78,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; diff --git a/channels/chan_h323.c b/channels/chan_h323.c index 2346175de6..be8c78d90a 100644 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -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; diff --git a/channels/chan_jingle.c b/channels/chan_jingle.c index d239fd717f..717f702b81 100644 --- a/channels/chan_jingle.c +++ b/channels/chan_jingle.c @@ -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; diff --git a/channels/chan_local.c b/channels/chan_local.c index 37869a8a74..7ccdc8a5aa 100644 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -59,6 +59,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, int format, void *data, int *cause); diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 863aee911e..771286da7b 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -92,7 +92,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; diff --git a/channels/chan_oss.c b/channels/chan_oss.c index 5fa0a50a19..cf29b60a05 100644 --- a/channels/chan_oss.c +++ b/channels/chan_oss.c @@ -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; diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 3b343850a6..2f916c610f 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -558,7 +558,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 */ diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index 84bcd4d751..4753e08e8c 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -163,7 +163,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; diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c index 36805694e3..ed31a7b3a5 100644 --- a/channels/chan_unistim.c +++ b/channels/chan_unistim.c @@ -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; diff --git a/channels/chan_usbradio.c b/channels/chan_usbradio.c index f7b2066ce2..7ae9159c31 100644 --- a/channels/chan_usbradio.c +++ b/channels/chan_usbradio.c @@ -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; diff --git a/channels/misdn_config.c b/channels/misdn_config.c index 4a90bbec1e..2a330551f2 100644 --- a/channels/misdn_config.c +++ b/channels/misdn_config.c @@ -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; diff --git a/configs/alsa.conf.sample b/configs/alsa.conf.sample index f550306185..fa2ff1d9bb 100644 --- a/configs/alsa.conf.sample +++ b/configs/alsa.conf.sample @@ -57,6 +57,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". ;----------------------------------------------------------------------------------- diff --git a/configs/chan_dahdi.conf.sample b/configs/chan_dahdi.conf.sample index 9b958c087b..f40af59a2c 100644 --- a/configs/chan_dahdi.conf.sample +++ b/configs/chan_dahdi.conf.sample @@ -812,6 +812,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". ;----------------------------------------------------------------------------------- ; diff --git a/configs/console.conf.sample b/configs/console.conf.sample index ff58605a38..7a40ed02e1 100644 --- a/configs/console.conf.sample +++ b/configs/console.conf.sample @@ -64,6 +64,13 @@ ; (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". ;----------------------------------------------------------------------------------- diff --git a/configs/mgcp.conf.sample b/configs/mgcp.conf.sample index c20b34a7c1..5d42ac17c6 100644 --- a/configs/mgcp.conf.sample +++ b/configs/mgcp.conf.sample @@ -35,6 +35,13 @@ ; (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". ;----------------------------------------------------------------------------------- diff --git a/configs/misdn.conf.sample b/configs/misdn.conf.sample index ca7f454974..5cadfb0dec 100644 --- a/configs/misdn.conf.sample +++ b/configs/misdn.conf.sample @@ -158,6 +158,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". ;----------------------------------------------------------------------------------- diff --git a/configs/oss.conf.sample b/configs/oss.conf.sample index 48f0ced904..3b9f5de0a9 100644 --- a/configs/oss.conf.sample +++ b/configs/oss.conf.sample @@ -66,6 +66,13 @@ ; (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". ;----------------------------------------------------------------------------------- diff --git a/configs/sip.conf.sample b/configs/sip.conf.sample index 5cc3d8398e..e4e62ecb78 100644 --- a/configs/sip.conf.sample +++ b/configs/sip.conf.sample @@ -799,6 +799,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". ;----------------------------------------------------------------------------------- diff --git a/configs/usbradio.conf.sample b/configs/usbradio.conf.sample index 5ba9815ca1..6af373e6d1 100644 --- a/configs/usbradio.conf.sample +++ b/configs/usbradio.conf.sample @@ -48,6 +48,13 @@ ; (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". ;----------------------------------------------------------------------------------- diff --git a/include/asterisk/abstract_jb.h b/include/asterisk/abstract_jb.h index 2a1b89fd18..a1f3cdd9d8 100644 --- a/include/asterisk/abstract_jb.h +++ b/include/asterisk/abstract_jb.h @@ -57,9 +57,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; }; @@ -69,6 +71,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" diff --git a/main/abstract_jb.c b/main/abstract_jb.c index c325d3acac..90cd7d14e3 100644 --- a/main/abstract_jb.c +++ b/main/abstract_jb.c @@ -593,6 +593,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 { @@ -739,6 +743,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); }