[asterisk-commits] russell: branch file/bridging r110331 - /team/file/bridging/bridges/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 20 15:45:58 CDT 2008


Author: russell
Date: Thu Mar 20 15:45:58 2008
New Revision: 110331

URL: http://svn.digium.com/view/asterisk?view=rev&rev=110331
Log:
Modify bridge_softmix to operate in 16 kHz mode to support wideband conferencing.
I also added a todo comment to note that at some point, we should optimize this
so that if there aren't at least two 16 kHz channels on the bridge, that we should
fall back to 8 kHz mode for the sake of performance.

This has been tested with multiple Polycom 650's using G.722 and another Polycom
using ulaw, using app_confbridge.

Modified:
    team/file/bridging/bridges/bridge_softmix.c

Modified: team/file/bridging/bridges/bridge_softmix.c
URL: http://svn.digium.com/view/asterisk/team/file/bridging/bridges/bridge_softmix.c?view=diff&rev=110331&r1=110330&r2=110331
==============================================================================
--- team/file/bridging/bridges/bridge_softmix.c (original)
+++ team/file/bridging/bridges/bridge_softmix.c Thu Mar 20 15:45:58 2008
@@ -23,6 +23,11 @@
  * \author Joshua Colp <jcolp at digium.com>
  *
  * \ingroup bridges
+ *
+ * \todo This bridge operates in 16 kHz mode to support wideband conferencing.
+ * However, in the case that there are not at least 2 channels on the bridge
+ * that support 16 kHz audio, then this should be optimized to fall back to
+ * operating in 8 kHz mode.
  */
 
 #include "asterisk.h"
@@ -46,7 +51,7 @@
 #include "asterisk/slinfactory.h"
 
 #define SOFTMIX_INTERVAL 20 /* Valid options are 10, 20, and 30 */
-#define SOFTMIX_SAMPLES (160*(SOFTMIX_INTERVAL/10))
+#define SOFTMIX_SAMPLES (320 * (SOFTMIX_INTERVAL / 10))
 
 struct softmix_channel {
 	ast_mutex_t lock;
@@ -75,7 +80,7 @@
 
 	/* Setup frame parameters */
 	sc->frame.frametype = AST_FRAME_VOICE;
-	sc->frame.subclass = AST_FORMAT_SLINEAR;
+	sc->frame.subclass = AST_FORMAT_SLINEAR16;
 	sc->frame.data = sc->final_buf;
 	sc->frame.datalen = sizeof(sc->final_buf);
 	sc->frame.samples = SOFTMIX_SAMPLES;
@@ -115,7 +120,7 @@
 	ast_mutex_lock(&sc->lock);
 
 	/* If a frame was provided add it to the smoother */
-	if (frame->frametype == AST_FRAME_VOICE && frame->subclass == AST_FORMAT_SLINEAR)
+	if (frame->frametype == AST_FRAME_VOICE && frame->subclass == AST_FORMAT_SLINEAR16)
 		ast_slinfactory_feed(&sc->factory, frame);
 	
 	/* If a frame is ready to be written out, do so */
@@ -210,10 +215,10 @@
 			int adjust = abs(skew-previous_skew), new_adjust = 0;
 			if (adjust > 0)
 				new_adjust = abs(adjust-last_adjust);
-			base = ast_tvadd(base, ast_tv(0, ((SOFTMIX_INTERVAL-new_adjust)+SOFTMIX_INTERVAL)*1000));
+			base = ast_tvadd(base, ast_tv(0, ((SOFTMIX_INTERVAL - new_adjust) + SOFTMIX_INTERVAL) * 1000));
 			last_adjust = new_adjust;
 		} else {
-			base = ast_tvadd(base, ast_tv(0, (SOFTMIX_INTERVAL*2)*1000));
+			base = ast_tvadd(base, ast_tv(0, (SOFTMIX_INTERVAL * 2) * 1000));
 		}
 
 		/* Calculate next time until we should wake up */
@@ -242,7 +247,7 @@
 	.name = "softmix",
 	.capabilities = AST_BRIDGE_CAPABILITY_MULTIMIX | AST_BRIDGE_CAPABILITY_THREAD | AST_BRIDGE_CAPABILITY_MULTITHREADED,
 	.preference = AST_BRIDGE_PREFERENCE_LOW,
-	.formats = AST_FORMAT_SLINEAR,
+	.formats = AST_FORMAT_SLINEAR16,
 	.join = softmix_bridge_join,
 	.leave = softmix_bridge_leave,
 	.write = softmix_bridge_write,




More information about the asterisk-commits mailing list