[asterisk-commits] file: branch file/bridge_native r385887 - /team/file/bridge_native/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 16 13:00:48 CDT 2013


Author: file
Date: Tue Apr 16 13:00:46 2013
New Revision: 385887

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385887
Log:
Fix a bug where the return value of compatible wasn't properly checked, and be more aggressive with changing technologies.

Modified:
    team/file/bridge_native/main/bridging.c

Modified: team/file/bridge_native/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/main/bridging.c?view=diff&rev=385887&r1=385886&r2=385887
==============================================================================
--- team/file/bridge_native/main/bridging.c (original)
+++ team/file/bridge_native/main/bridging.c Tue Apr 16 13:00:46 2013
@@ -1036,7 +1036,7 @@
 				current->name);
 			continue;
 		}
-		if (bridge && current->compatible && current->compatible(bridge)) {
+		if (bridge && current->compatible && !current->compatible(bridge)) {
 			ast_debug(1, "Bridge technology %s is not compatible with properties of existing bridge.\n",
 				current->name);
 			continue;
@@ -1044,11 +1044,6 @@
 		if (best && best->preference < current->preference) {
 			ast_debug(1, "Bridge technology %s has preference %d while %s has preference %d. Skipping.\n",
 				current->name, current->preference, best->name, best->preference);
-			continue;
-		}
-		if (bridge && (bridge->technology == current)) {
-			ast_debug(1, "Bridge technology %s is already being used on existing provided bridge.\n",
-				current->name);
 			continue;
 		}
 		best = current;
@@ -1544,11 +1539,6 @@
 		new_capabilities = bridge->technology->capabilities;
 	} else if (bridge->technology->capabilities & AST_BRIDGE_CAPABILITY_1TO1MIX) {
 		if (bridge->num_channels <= 2) {
-			if (bridge->technology->capabilities & AST_BRIDGE_CAPABILITY_NATIVE) {
-				ast_debug(1, "Bridge %s channel count (%u) is within limits for %s technology, not performing smart bridge operation.\n",
-					bridge->uniqueid, bridge->num_channels, bridge->technology->name);
-				return 0;
-			}
 			/* If we start out as a generic 1to1mix technology try to migrate to native for performance reasons */
 			new_capabilities = AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_NATIVE;
 		} else {
@@ -1556,11 +1546,6 @@
 		}
 	} else if (bridge->technology->capabilities & AST_BRIDGE_CAPABILITY_MULTIMIX) {
 		if (2 < bridge->num_channels) {
-			if (bridge->technology->capabilities & AST_BRIDGE_CAPABILITY_NATIVE) {
-				ast_debug(1, "Bridge %s channel count (%u) is within limits for %s technology, not performing smart bridge operation.\n",
-					bridge->uniqueid, bridge->num_channels, bridge->technology->name);
-				return 0;
-			}
 			new_capabilities = AST_BRIDGE_CAPABILITY_MULTIMIX | AST_BRIDGE_CAPABILITY_NATIVE;
 		} else {
 			new_capabilities = AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_NATIVE;
@@ -1590,6 +1575,13 @@
 		ast_log(LOG_WARNING, "Bridge %s has no bridge technology available to support it\n",
 			bridge->uniqueid);
 		return -1;
+	}
+
+	if (new_technology == bridge->technology) {
+		ast_debug(1, "Bridge %s is using existing technology.\n",
+			bridge->uniqueid);
+		ast_module_unref(bridge->technology->mod);
+		return 0;
 	}
 
 	ast_copy_string(dummy_bridge.uniqueid, bridge->uniqueid, sizeof(dummy_bridge.uniqueid));




More information about the asterisk-commits mailing list