[asterisk-commits] file: branch file/bridging r172780 - in /team/file/bridging: bridges/ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun Feb 1 20:02:23 CST 2009
Author: file
Date: Sun Feb 1 20:02:22 2009
New Revision: 172780
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=172780
Log:
Optimize bridge_softmix a bit by copying over the audio and then going through and subtracting our own only if we had some. Fix a locking order issue with bridge merging. Thanks Vadim.
Modified:
team/file/bridging/bridges/bridge_softmix.c
team/file/bridging/main/bridging.c
Modified: team/file/bridging/bridges/bridge_softmix.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/bridging/bridges/bridge_softmix.c?view=diff&rev=172780&r1=172779&r2=172780
==============================================================================
--- team/file/bridging/bridges/bridge_softmix.c (original)
+++ team/file/bridging/bridges/bridge_softmix.c Sun Feb 1 20:02:22 2009
@@ -226,12 +226,14 @@
struct softmix_channel *sc = bridge_channel->bridge_pvt;
int i = 0;
- /* Copy from local final buffer to our final buffer while subtracting our audio if present */
- for (i = 0; i < SOFTMIX_DATALEN; i++) {
- sc->final_buf[i] = buf[i];
- /* Subtract our own audio from the end frame if present */
- if (sc->have_audio)
+ /* Copy from local final buffer to our final buffer */
+ memcpy(sc->final_buf, buf, sizeof(sc->final_buf));
+
+ /* If we provided audio then take it out */
+ if (sc->have_audio) {
+ for (i = 0; i < SOFTMIX_DATALEN; i++) {
ast_slinear_saturated_subtract(&sc->final_buf[i], &sc->our_buf[i]);
+ }
}
/* The frame is now ready for use... */
Modified: team/file/bridging/main/bridging.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/bridging/main/bridging.c?view=diff&rev=172780&r1=172779&r2=172780
==============================================================================
--- team/file/bridging/main/bridging.c (original)
+++ team/file/bridging/main/bridging.c Sun Feb 1 20:02:22 2009
@@ -1039,8 +1039,8 @@
/* If the first bridge currently has 2 channels and is not capable of becoming a multimixing bridge we can not merge */
if ((bridge0->num + bridge1->num) > 2 && (!(bridge0->technology->capabilities & AST_BRIDGE_CAPABILITY_MULTIMIX) && !ast_test_flag(&bridge0->feature_flags, AST_BRIDGE_FLAG_SMART))) {
+ ao2_unlock(bridge1);
ao2_unlock(bridge0);
- ao2_unlock(bridge1);
ast_debug(1, "Can't merge bridge %p into bridge %p, multimix is needed and it could not be acquired.\n", bridge1, bridge0);
return -1;
}
@@ -1049,8 +1049,8 @@
/* Perform smart bridge operation on bridge we are merging into so it can change bridge technology if needed */
if (smart_bridge_operation(bridge0, NULL, bridge0->num + bridge1->num)) {
+ ao2_unlock(bridge1);
ao2_unlock(bridge0);
- ao2_unlock(bridge1);
ast_debug(1, "Can't merge bridge %p into bridge %p, tried to perform smart bridge operation and failed.\n", bridge1, bridge0);
return -1;
}
@@ -1105,8 +1105,8 @@
ast_debug(1, "Merged channels from bridge %p into bridge %p\n", bridge1, bridge0);
+ ao2_unlock(bridge1);
ao2_unlock(bridge0);
- ao2_unlock(bridge1);
return 0;
}
More information about the asterisk-commits
mailing list