[svn-commits] dvossel: branch dvossel/hd_confbridge r311611 - in /team/dvossel/hd_confbridg...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Mar 23 16:35:41 CDT 2011


Author: dvossel
Date: Wed Mar 23 16:35:37 2011
New Revision: 311611

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=311611
Log:
Introduces the 'mixing_interval' option to confbridge.conf

Modified:
    team/dvossel/hd_confbridge/apps/app_confbridge.c
    team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
    team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h
    team/dvossel/hd_confbridge/bridges/bridge_softmix.c
    team/dvossel/hd_confbridge/configs/confbridge.conf.sample
    team/dvossel/hd_confbridge/include/asterisk/bridging.h
    team/dvossel/hd_confbridge/main/bridging.c

Modified: team/dvossel/hd_confbridge/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/app_confbridge.c?view=diff&rev=311611&r1=311610&r2=311611
==============================================================================
--- team/dvossel/hd_confbridge/apps/app_confbridge.c (original)
+++ team/dvossel/hd_confbridge/apps/app_confbridge.c Wed Mar 23 16:35:37 2011
@@ -763,6 +763,8 @@
 
 		/* Set the internal sample rate on the bridge from the bridge profile */
 		ast_bridge_set_internal_sample_rate(conference_bridge->bridge, conference_bridge->b_profile.internal_sample_rate);
+		/* Set the internal mixing interval on the bridge from the bridge profile */
+		ast_bridge_set_mixing_interval(conference_bridge->bridge, conference_bridge->b_profile.mix_interval);
 
 		/* Setup lock for playback channel */
 		ast_mutex_init(&conference_bridge->playback_lock);

Modified: team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c?view=diff&rev=311611&r1=311610&r2=311611
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c Wed Mar 23 16:35:37 2011
@@ -279,6 +279,21 @@
 		} else if (sscanf(value, "%30u", &b_profile->internal_sample_rate) != 1) {
 			return -1;
 		}
+	} else if (!strcasecmp(name, "mixing_interval")) {
+		if (sscanf(value, "%30u", &b_profile->mix_interval) != 1) {
+			return -1;
+		}
+		switch (b_profile->mix_interval) {
+		case 10:
+		case 20:
+		case 40:
+		case 80:
+			break;
+		default:
+			ast_log(LOG_WARNING, "invalid mixing interval %u\n", b_profile->mix_interval);
+			b_profile->mix_interval = 0;
+			return -1;
+		}
 	} else if (!strcasecmp(name, "record_conference")) {
 		b_profile->flags = ast_true(value) ?
 			b_profile->flags | BRIDGE_OPT_RECORD_CONFERENCE :
@@ -444,6 +459,7 @@
 	b_profile->internal_sample_rate = 0;
 	b_profile->flags = 0;
 	b_profile->max_members = 0;
+	b_profile->mix_interval = 0;
 	memset(b_profile->rec_file, 0, sizeof(b_profile->rec_file));
 	ao2_ref(b_profile->sounds, -1); /* sounds is read only.  Once it has been created
 	                                 * it can never be altered. This prevents having to
@@ -877,24 +893,33 @@
 
 	ast_cli(a->fd,"--------------------------------------------\n");
 	ast_cli(a->fd,"Name:                 %s\n", b_profile.name);
+
+	if (b_profile.internal_sample_rate) {
+		snprintf(tmp, sizeof(tmp), "%d", b_profile.internal_sample_rate);
+	} else {
+		snprintf(tmp, sizeof(tmp), "auto");
+	}
+	ast_cli(a->fd,"Internal Sample Rate: %s\n", tmp);
+
+	if (b_profile.mix_interval) {
+		ast_cli(a->fd,"Mixing Interval:      %d\n", b_profile.mix_interval);
+	} else {
+		ast_cli(a->fd,"Mixing Interval:      Default 20ms\n");
+	}
+
 	ast_cli(a->fd,"Record Conference:    %s\n",
 		b_profile.flags & BRIDGE_OPT_RECORD_CONFERENCE ?
 		"yes" : "no");
+
 	ast_cli(a->fd,"Record File:          %s\n",
 		ast_strlen_zero(b_profile.rec_file) ? "Auto Generated" :
 		b_profile.rec_file);
+
 	if (b_profile.max_members) {
 		ast_cli(a->fd,"Max Members:          %d\n", b_profile.max_members);
 	} else {
 		ast_cli(a->fd,"Max Members:          No Limit\n");
 	}
-	if (b_profile.internal_sample_rate) {
-		snprintf(tmp, sizeof(tmp), "%d", b_profile.internal_sample_rate);
-	} else {
-		snprintf(tmp, sizeof(tmp), "auto");
-	}
-	ast_cli(a->fd,"Internal Sample Rate: %s\n", tmp);
-
 	ast_cli(a->fd,"sound_only_person:    %s\n", conf_get_sound(CONF_SOUND_ONLY_PERSON, b_profile.sounds));
 	ast_cli(a->fd,"sound_has_joined:     %s\n", conf_get_sound(CONF_SOUND_HAS_JOINED, b_profile.sounds));
 	ast_cli(a->fd,"sound_has_left:       %s\n", conf_get_sound(CONF_SOUND_HAS_LEFT, b_profile.sounds));

Modified: team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h?view=diff&rev=311611&r1=311610&r2=311611
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h Wed Mar 23 16:35:37 2011
@@ -169,6 +169,7 @@
 	unsigned int flags;
 	unsigned int max_members;          /*!< The maximum number of participants allowed in the conference */
 	unsigned int internal_sample_rate; /*!< The internal sample rate of the bridge. 0 when set to auto adjust mode. */
+	unsigned int mix_interval;  /*!< The internal mixing interval used by the bridge. When set to 0 the bridgewill use a default interval. */
 	struct bridge_profile_sounds *sounds;
 	int delme;
 };

Modified: team/dvossel/hd_confbridge/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/bridges/bridge_softmix.c?view=diff&rev=311611&r1=311610&r2=311611
==============================================================================
--- team/dvossel/hd_confbridge/bridges/bridge_softmix.c (original)
+++ team/dvossel/hd_confbridge/bridges/bridge_softmix.c Wed Mar 23 16:35:37 2011
@@ -54,13 +54,13 @@
 #define MAX_DATALEN 3840
 
 /*! \brief Interval at which mixing will take place. Valid options are 10, 20, and 40. */
-#define SOFTMIX_INTERVAL 20
+#define DEFAULT_SOFTMIX_INTERVAL 20
 
 /*! \brief Size of the buffer used for sample manipulation */
-#define SOFTMIX_DATALEN(rate) ((rate/50) * (SOFTMIX_INTERVAL / 10))
+#define SOFTMIX_DATALEN(rate, interval) ((rate/50) * (interval / 10))
 
 /*! \brief Number of samples we are dealing with */
-#define SOFTMIX_SAMPLES(rate) (SOFTMIX_DATALEN(rate) / 2)
+#define SOFTMIX_SAMPLES(rate, interval) (SOFTMIX_DATALEN(rate, interval) / 2)
 
 /*! \brief Number of mixing iterations to perform between gathering statistics. */
 #define SOFTMIX_STAT_INTERVAL 100
@@ -98,6 +98,7 @@
 struct softmix_bridge_data {
 	struct ast_timer *timer;
 	unsigned int internal_rate;
+	unsigned int internal_mixing_interval;
 };
 
 struct softmix_stats {
@@ -275,43 +276,44 @@
 
 static void softmix_bridge_data_destroy(void *obj)
 {
-	struct softmix_bridge_data *bridge_data = obj;
-	ast_timer_close(bridge_data->timer);
+	struct softmix_bridge_data *softmix_data = obj;
+	ast_timer_close(softmix_data->timer);
 }
 
 /*! \brief Function called when a bridge is created */
 static int softmix_bridge_create(struct ast_bridge *bridge)
 {
-	struct softmix_bridge_data *bridge_data;
-
-	if (!(bridge_data = ao2_alloc(sizeof(*bridge_data), softmix_bridge_data_destroy))) {
+	struct softmix_bridge_data *softmix_data;
+
+	if (!(softmix_data = ao2_alloc(sizeof(*softmix_data), softmix_bridge_data_destroy))) {
 		return -1;
 	}
-	if (!(bridge_data->timer = ast_timer_open())) {
-		ao2_ref(bridge_data, -1);
+	if (!(softmix_data->timer = ast_timer_open())) {
+		ao2_ref(softmix_data, -1);
 		return -1;
 	}
 
 	/* start at 8khz, let it grow from there */
-	bridge_data->internal_rate = 8000;
-
-	bridge->bridge_pvt = bridge_data;
+	softmix_data->internal_rate = 8000;
+	softmix_data->internal_mixing_interval = DEFAULT_SOFTMIX_INTERVAL;
+
+	bridge->bridge_pvt = softmix_data;
 	return 0;
 }
 
 /*! \brief Function called when a bridge is destroyed */
 static int softmix_bridge_destroy(struct ast_bridge *bridge)
 {
-	struct softmix_bridge_data *bridge_data = bridge->bridge_pvt;
+	struct softmix_bridge_data *softmix_data = bridge->bridge_pvt;
 	if (!bridge->bridge_pvt) {
 		return -1;
 	}
-	ao2_ref(bridge_data, -1);
+	ao2_ref(softmix_data, -1);
 	bridge->bridge_pvt = NULL;
 	return 0;
 }
 
-static void set_softmix_bridge_data(int rate, struct ast_bridge_channel *bridge_channel, int reset)
+static void set_softmix_bridge_data(int rate, int interval, struct ast_bridge_channel *bridge_channel, int reset)
 {
 	struct softmix_channel *sc = bridge_channel->bridge_pvt;
 	unsigned int channel_read_rate = ast_format_rate(&bridge_channel->chan->rawreadformat);
@@ -325,14 +327,14 @@
 	sc->write_frame.frametype = AST_FRAME_VOICE;
 	ast_format_set(&sc->write_frame.subclass.format, ast_format_slin_by_rate(rate), 0);
 	sc->write_frame.data.ptr = sc->final_buf;
-	sc->write_frame.datalen = SOFTMIX_DATALEN(rate);
-	sc->write_frame.samples = SOFTMIX_SAMPLES(rate);
+	sc->write_frame.datalen = SOFTMIX_DATALEN(rate, interval);
+	sc->write_frame.samples = SOFTMIX_SAMPLES(rate, interval);
 
 	sc->read_frame.frametype = AST_FRAME_VOICE;
 	ast_format_set(&sc->read_frame.subclass.format, ast_format_slin_by_rate(channel_read_rate), 0);
 	sc->read_frame.data.ptr = sc->our_buf;
-	sc->read_frame.datalen = SOFTMIX_DATALEN(channel_read_rate);
-	sc->read_frame.samples = SOFTMIX_SAMPLES(channel_read_rate);
+	sc->read_frame.datalen = SOFTMIX_DATALEN(channel_read_rate, interval);
+	sc->read_frame.samples = SOFTMIX_SAMPLES(channel_read_rate, interval);
 
 	/* Setup smoother */
 	ast_slinfactory_init_with_format(&sc->factory, &sc->write_frame.subclass.format);
@@ -357,7 +359,7 @@
 static int softmix_bridge_join(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
 {
 	struct softmix_channel *sc = NULL;
-	struct softmix_bridge_data *bridge_data = bridge->bridge_pvt;
+	struct softmix_bridge_data *softmix_data = bridge->bridge_pvt;
 
 	/* Create a new softmix_channel structure and allocate various things on it */
 	if (!(sc = ast_calloc(1, sizeof(*sc)))) {
@@ -370,7 +372,9 @@
 	/* Can't forget to record our pvt structure within the bridged channel structure */
 	bridge_channel->bridge_pvt = sc;
 
-	set_softmix_bridge_data(bridge_data->internal_rate, bridge_channel, 0);
+	set_softmix_bridge_data(softmix_data->internal_rate,
+		softmix_data->internal_mixing_interval ? softmix_data->internal_mixing_interval : DEFAULT_SOFTMIX_INTERVAL,
+		bridge_channel, 0);
 
 	return 0;
 }
@@ -419,7 +423,7 @@
 static enum ast_bridge_write_result softmix_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
 {
 	struct softmix_channel *sc = bridge_channel->bridge_pvt;
-	struct softmix_bridge_data *bridge_data = bridge->bridge_pvt;
+	struct softmix_bridge_data *softmix_data = bridge->bridge_pvt;
 	int totalsilence = 0;
 	int silence_threshold = bridge_channel->tech_args.silence_threshold ?
 		bridge_channel->tech_args.silence_threshold :
@@ -452,7 +456,7 @@
 	/* Before adding audio in, make sure we haven't fallen behind. If audio has fallen
 	 * behind 4 times the amount of samples mixed on every iteration of the mixer, Re-sync
 	 * the audio by flushing the buffer before adding new audio in. */
-	if (ast_slinfactory_available(&sc->factory) > (4 * SOFTMIX_SAMPLES(bridge_data->internal_rate))) {
+	if (ast_slinfactory_available(&sc->factory) > (4 * SOFTMIX_SAMPLES(softmix_data->internal_rate, softmix_data->internal_mixing_interval))) {
 		ast_slinfactory_flush(&sc->factory);
 	}
 
@@ -497,7 +501,7 @@
 }
 
 static void gather_softmix_stats(struct softmix_stats *stats,
-	const struct softmix_bridge_data *bridge_data,
+	const struct softmix_bridge_data *softmix_data,
 	struct ast_bridge_channel *bridge_channel)
 {
 	int channel_native_rate;
@@ -509,7 +513,7 @@
 	if (channel_native_rate > stats->highest_supported_rate) {
 		stats->highest_supported_rate = channel_native_rate;
 	}
-	if (channel_native_rate > bridge_data->internal_rate) {
+	if (channel_native_rate > softmix_data->internal_rate) {
 		for (i = 0; i < ARRAY_LEN(stats->sample_rates); i++) {
 			if (stats->sample_rates[i] == channel_native_rate) {
 				stats->num_channels[i]++;
@@ -521,7 +525,7 @@
 			}
 		}
 		stats->num_above_internal_rate++;
-	} else if (channel_native_rate == bridge_data->internal_rate) {
+	} else if (channel_native_rate == softmix_data->internal_rate) {
 		stats->num_at_internal_rate++;
 	}
 }
@@ -533,7 +537,7 @@
  * \retval 0, no changes to internal rate 
  * \ratval 1, internal rate was changed, update all the channels on the next mixing iteration.
  */
-static unsigned int analyse_softmix_stats(struct softmix_stats *stats, struct softmix_bridge_data *bridge_data)
+static unsigned int analyse_softmix_stats(struct softmix_stats *stats, struct softmix_bridge_data *softmix_data)
 {
 	int i;
 	/* Re-adjust the internal bridge sample rate if
@@ -545,9 +549,9 @@
 	if (stats->locked_rate) {
 		/* if the rate is locked by the bridge, only update it if it differs
 		 * from the current rate we are using. */
-		if (bridge_data->internal_rate != stats->locked_rate) {
-			bridge_data->internal_rate = stats->locked_rate;
-			ast_debug(1, " Bridge is locked in at sample rate %d\n", bridge_data->internal_rate);
+		if (softmix_data->internal_rate != stats->locked_rate) {
+			softmix_data->internal_rate = stats->locked_rate;
+			ast_debug(1, " Bridge is locked in at sample rate %d\n", softmix_data->internal_rate);
 			return 1;
 		}
 	} else if (stats->num_above_internal_rate >= 2) {
@@ -586,13 +590,13 @@
 			}
 		}
 
-		ast_debug(1, " Bridge changed from %d To %d\n", bridge_data->internal_rate, best_rate);
-		bridge_data->internal_rate = best_rate;
+		ast_debug(1, " Bridge changed from %d To %d\n", softmix_data->internal_rate, best_rate);
+		softmix_data->internal_rate = best_rate;
 		return 1;
 	} else if (!stats->num_at_internal_rate && !stats->num_above_internal_rate) {
 		/* In this case, the highest supported rate is actually lower than the internal rate */
-		bridge_data->internal_rate = stats->highest_supported_rate;
-		ast_debug(1, " Bridge changed from %d to %d\n", bridge_data->internal_rate, stats->highest_supported_rate);
+		softmix_data->internal_rate = stats->highest_supported_rate;
+		ast_debug(1, " Bridge changed from %d to %d\n", softmix_data->internal_rate, stats->highest_supported_rate);
 		return 1;
 	}
 	return 0;
@@ -632,7 +636,7 @@
 {
 	struct softmix_stats stats = { { 0 }, };
 	struct softmix_mixing_array mixing_array;
-	struct softmix_bridge_data *bridge_data = bridge->bridge_pvt;
+	struct softmix_bridge_data *softmix_data = bridge->bridge_pvt;
 	struct ast_timer *timer;
 	struct softmix_translate_helper trans_helper;
 	int16_t buf[MAX_DATALEN] = { 0, };
@@ -642,15 +646,15 @@
 	int i, x;
 	int res = -1;
 
-	if (!(bridge_data = bridge->bridge_pvt)) {
+	if (!(softmix_data = bridge->bridge_pvt)) {
 		goto softmix_cleanup;
 	}
 
-	ao2_ref(bridge_data, 1);
-	timer = bridge_data->timer;
+	ao2_ref(softmix_data, 1);
+	timer = softmix_data->timer;
 	timingfd = ast_timer_fd(timer);
-	softmix_translate_helper_init(&trans_helper, bridge_data->internal_rate);
-	ast_timer_set_rate(timer, (1000 / SOFTMIX_INTERVAL));
+	softmix_translate_helper_init(&trans_helper, softmix_data->internal_rate);
+	ast_timer_set_rate(timer, (1000 / softmix_data->internal_mixing_interval));
 
 	/* Give the mixing array room to grow, memory is cheap but allocations are expensive. */
 	if (softmix_mixing_array_init(&mixing_array, bridge->num + 10)) {
@@ -661,9 +665,9 @@
 	while (!bridge->stop && !bridge->refresh && bridge->array_num) {
 		struct ast_bridge_channel *bridge_channel = NULL;
 		int timeout = -1;
-		enum ast_format_id cur_slin_id = ast_format_slin_by_rate(bridge_data->internal_rate);
-		unsigned int softmix_samples = SOFTMIX_SAMPLES(bridge_data->internal_rate);
-		unsigned int softmix_datalen = SOFTMIX_DATALEN(bridge_data->internal_rate);
+		enum ast_format_id cur_slin_id = ast_format_slin_by_rate(softmix_data->internal_rate);
+		unsigned int softmix_samples = SOFTMIX_SAMPLES(softmix_data->internal_rate, softmix_data->internal_mixing_interval);
+		unsigned int softmix_datalen = SOFTMIX_DATALEN(softmix_data->internal_rate, softmix_data->internal_mixing_interval);
 
 		if (softmix_datalen > MAX_DATALEN) {
 			/* This should NEVER happen, but if it does we need to know about it. Almost
@@ -691,7 +695,7 @@
 
 		/* If the sample rate has changed, update the translator helper */
 		if (update_all_rates) {
-			softmix_translate_helper_change_rate(&trans_helper, bridge_data->internal_rate);
+			softmix_translate_helper_change_rate(&trans_helper, softmix_data->internal_rate);
 		}
 
 		/* Go through pulling audio from each factory that has it available */
@@ -700,12 +704,12 @@
 
 			/* Update the sample rate to match the bridge's native sample rate if necessary. */
 			if (update_all_rates) {
-				set_softmix_bridge_data(bridge_data->internal_rate, bridge_channel, 1);
+				set_softmix_bridge_data(softmix_data->internal_rate, softmix_data->internal_mixing_interval, bridge_channel, 1);
 			}
 
 			/* If stat_iteration_counter is 0, then collect statistics during this mixing interation */
 			if (!stat_iteration_counter) {
-				gather_softmix_stats(&stats, bridge_data, bridge_channel);
+				gather_softmix_stats(&stats, softmix_data, bridge_channel);
 			}
 
 			/* if the channel is suspended, don't check for audio, but still gather stats */
@@ -761,7 +765,7 @@
 
 		update_all_rates = 0;
 		if (!stat_iteration_counter) {
-			update_all_rates = analyse_softmix_stats(&stats, bridge_data);
+			update_all_rates = analyse_softmix_stats(&stats, softmix_data);
 			stat_iteration_counter = SOFTMIX_STAT_INTERVAL;
 		}
 		stat_iteration_counter--;
@@ -773,6 +777,13 @@
 		ast_waitfor_n_fd(&timingfd, 1, &timeout, NULL);
 		ast_timer_ack(timer, 1);
 		ao2_lock(bridge);
+
+		/* make sure to detect mixing interval changes if they occur. */
+		if (bridge->internal_mixing_interval && (bridge->internal_mixing_interval != softmix_data->internal_mixing_interval)) {
+			softmix_data->internal_mixing_interval = bridge->internal_mixing_interval;
+			ast_timer_set_rate(timer, (1000 / softmix_data->internal_mixing_interval));
+			update_all_rates = 1; /* if the interval changes, the rates must be adjusted as well just to be notified new interval.*/
+		}
 	}
 
 	res = 0;
@@ -780,8 +791,8 @@
 softmix_cleanup:
 	softmix_translate_helper_destroy(&trans_helper);
 	softmix_mixing_array_destroy(&mixing_array);
-	if (bridge_data) {
-		ao2_ref(bridge_data, -1);
+	if (softmix_data) {
+		ao2_ref(softmix_data, -1);
 	}
 	return res;
 }

Modified: team/dvossel/hd_confbridge/configs/confbridge.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/configs/confbridge.conf.sample?view=diff&rev=311611&r1=311610&r2=311611
==============================================================================
--- team/dvossel/hd_confbridge/configs/confbridge.conf.sample (original)
+++ team/dvossel/hd_confbridge/configs/confbridge.conf.sample Wed Mar 23 16:35:37 2011
@@ -96,6 +96,13 @@
                                ; closest sample rate Asterisk does support to the one requested
                                ; will be used.
 
+;mixing_interval=40     ; Sets the internal mixing interval in milliseconds for the bridge.  This
+                        ; number reflects how tight or loose the mixing will be for the conference.
+                        ; In order to improve performance a larger mixing interval such as 40ms may
+                        ; be chosen.  Using a larger mixing interval comes at the cost of introducing
+                        ; larger amounts of delay into the bridge.  Valid values here are 10, 20, 40,
+                        ; or 80.  By default 20ms is used.
+
 ; All sounds in the conference are customizable using the bridge profile options below.
 ; Simply state the option followed by the filename or full path of the filename after
 ; the option.  Example: sound_had_joined=conf-hasjoin  This will play the conf-hasjoin

Modified: team/dvossel/hd_confbridge/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/include/asterisk/bridging.h?view=diff&rev=311611&r1=311610&r2=311611
==============================================================================
--- team/dvossel/hd_confbridge/include/asterisk/bridging.h (original)
+++ team/dvossel/hd_confbridge/include/asterisk/bridging.h Wed Mar 23 16:35:37 2011
@@ -176,6 +176,10 @@
 	/*! The internal sample rate this bridge is mixed at when multiple channels are being mixed.
 	 *  If this value is 0, the bridge technology may auto adjust the internal mixing rate. */
 	unsigned int internal_sample_rate;
+	/*! The mixing interval indicates how quickly the bridges internal mixing should occur
+	 * for bridge technologies that mix audio. When set to 0, the bridge tech must choose a
+	 * default interval for itself. */
+	unsigned int internal_mixing_interval;
 	/*! Bit to indicate that the bridge thread is waiting on channels in the bridge array */
 	unsigned int waiting:1;
 	/*! Bit to indicate the bridge thread should stop */
@@ -462,6 +466,16 @@
  */
 void ast_bridge_set_internal_sample_rate(struct ast_bridge *bridge, unsigned int sample_rate);
 
+/*! \brief Adjust the internal mixing interval of a bridge used during
+ *         multimix mode.
+ *
+ * \param bridge_channel Channel to change the sample rate on.
+ * \param mixing_interval, the sample rate to change to.  If 0 is set
+ * the bridge tech is free to choose any mixing interval it uses by default.
+ */
+void ast_bridge_set_mixing_interval(struct ast_bridge *bridge, unsigned int mixing_interval);
+
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif

Modified: team/dvossel/hd_confbridge/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/main/bridging.c?view=diff&rev=311611&r1=311610&r2=311611
==============================================================================
--- team/dvossel/hd_confbridge/main/bridging.c (original)
+++ team/dvossel/hd_confbridge/main/bridging.c Wed Mar 23 16:35:37 2011
@@ -1456,6 +1456,13 @@
 	return 0;
 }
 
+void ast_bridge_set_mixing_interval(struct ast_bridge *bridge, unsigned int mixing_interval)
+{
+	ao2_lock(bridge);
+	bridge->internal_mixing_interval = mixing_interval;
+	ao2_unlock(bridge);
+}
+
 void ast_bridge_set_internal_sample_rate(struct ast_bridge *bridge, unsigned int sample_rate)
 {
 




More information about the svn-commits mailing list