mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 18:55:19 +00:00 
			
		
		
		
	Revert part of a change to the bridging API code
The capabilities used in the bridging API are very different than the ones used for formats. When the conversion was made expanding the bit width of codecs, the bridging code was accidentally accosted in ways that it didn't deserve. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@319920 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		| @@ -193,7 +193,7 @@ struct ast_bridge { | |||||||
|  * This creates a simple two party bridge that will be destroyed once one of |  * This creates a simple two party bridge that will be destroyed once one of | ||||||
|  * the channels hangs up. |  * the channels hangs up. | ||||||
|  */ |  */ | ||||||
| struct ast_bridge *ast_bridge_new(format_t capabilities, int flags); | struct ast_bridge *ast_bridge_new(enum ast_bridge_capability capabilities, int flags); | ||||||
|  |  | ||||||
| /*! \brief See if it is possible to create a bridge | /*! \brief See if it is possible to create a bridge | ||||||
|  * |  * | ||||||
| @@ -211,7 +211,7 @@ struct ast_bridge *ast_bridge_new(format_t capabilities, int flags); | |||||||
|  * This sees if it is possible to create a bridge capable of bridging two channels |  * This sees if it is possible to create a bridge capable of bridging two channels | ||||||
|  * together. |  * together. | ||||||
|  */ |  */ | ||||||
| int ast_bridge_check(format_t capabilities); | int ast_bridge_check(enum ast_bridge_capability capabilities); | ||||||
|  |  | ||||||
| /*! \brief Destroy a bridge | /*! \brief Destroy a bridge | ||||||
|  * |  * | ||||||
|   | |||||||
| @@ -45,7 +45,7 @@ struct ast_bridge_technology { | |||||||
| 	/*! Unique name to this bridge technology */ | 	/*! Unique name to this bridge technology */ | ||||||
| 	const char *name; | 	const char *name; | ||||||
| 	/*! The capabilities that this bridge technology is capable of */ | 	/*! The capabilities that this bridge technology is capable of */ | ||||||
| 	format_t capabilities; | 	int capabilities; | ||||||
| 	/*! Preference level that should be used when determining whether to use this bridge technology or not */ | 	/*! Preference level that should be used when determining whether to use this bridge technology or not */ | ||||||
| 	enum ast_bridge_preference preference; | 	enum ast_bridge_preference preference; | ||||||
| 	/*! Callback for when a bridge is being created */ | 	/*! Callback for when a bridge is being created */ | ||||||
|   | |||||||
| @@ -382,16 +382,13 @@ static void *bridge_thread(void *data) | |||||||
| } | } | ||||||
|  |  | ||||||
| /*! \brief Helper function used to find the "best" bridge technology given a specified capabilities */ | /*! \brief Helper function used to find the "best" bridge technology given a specified capabilities */ | ||||||
| static struct ast_bridge_technology *find_best_technology(format_t capabilities) | static struct ast_bridge_technology *find_best_technology(enum ast_bridge_capability capabilities) | ||||||
| { | { | ||||||
| 	struct ast_bridge_technology *current = NULL, *best = NULL; | 	struct ast_bridge_technology *current = NULL, *best = NULL; | ||||||
|  |  | ||||||
| 	AST_RWLIST_RDLOCK(&bridge_technologies); | 	AST_RWLIST_RDLOCK(&bridge_technologies); | ||||||
| 	AST_RWLIST_TRAVERSE(&bridge_technologies, current, entry) { | 	AST_RWLIST_TRAVERSE(&bridge_technologies, current, entry) { | ||||||
| 		char tmp1[256], tmp2[256]; | 		ast_debug(1, "Bridge technology %s has capabilities %d and we want %d\n", current->name, current->capabilities, capabilities); | ||||||
| 		ast_debug(1, "Bridge technology %s has capabilities %s and we want %s\n", current->name, |  | ||||||
| 			ast_getformatname_multiple(tmp1, sizeof(tmp1), current->capabilities), |  | ||||||
| 			ast_getformatname_multiple(tmp2, sizeof(tmp2), capabilities)); |  | ||||||
| 		if (current->suspended) { | 		if (current->suspended) { | ||||||
| 			ast_debug(1, "Bridge technology %s is suspended. Skipping.\n", current->name); | 			ast_debug(1, "Bridge technology %s is suspended. Skipping.\n", current->name); | ||||||
| 			continue; | 			continue; | ||||||
| @@ -448,7 +445,7 @@ static void destroy_bridge(void *obj) | |||||||
| 	return; | 	return; | ||||||
| } | } | ||||||
|  |  | ||||||
| struct ast_bridge *ast_bridge_new(format_t capabilities, int flags) | struct ast_bridge *ast_bridge_new(enum ast_bridge_capability capabilities, int flags) | ||||||
| { | { | ||||||
| 	struct ast_bridge *bridge = NULL; | 	struct ast_bridge *bridge = NULL; | ||||||
| 	struct ast_bridge_technology *bridge_technology = NULL; | 	struct ast_bridge_technology *bridge_technology = NULL; | ||||||
| @@ -470,9 +467,7 @@ struct ast_bridge *ast_bridge_new(format_t capabilities, int flags) | |||||||
|  |  | ||||||
| 	/* If no bridge technology was found we can't possibly do bridging so fail creation of the bridge */ | 	/* If no bridge technology was found we can't possibly do bridging so fail creation of the bridge */ | ||||||
| 	if (!bridge_technology) { | 	if (!bridge_technology) { | ||||||
| 		char codec_buf[256]; | 		ast_debug(1, "Failed to find a bridge technology to satisfy capabilities %d\n", capabilities); | ||||||
| 		ast_debug(1, "Failed to find a bridge technology to satisfy capabilities %s\n", |  | ||||||
| 			ast_getformatname_multiple(codec_buf, sizeof(codec_buf), capabilities)); |  | ||||||
| 		return NULL; | 		return NULL; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -503,7 +498,7 @@ struct ast_bridge *ast_bridge_new(format_t capabilities, int flags) | |||||||
| 	return bridge; | 	return bridge; | ||||||
| } | } | ||||||
|  |  | ||||||
| int ast_bridge_check(format_t capabilities) | int ast_bridge_check(enum ast_bridge_capability capabilities) | ||||||
| { | { | ||||||
| 	struct ast_bridge_technology *bridge_technology = NULL; | 	struct ast_bridge_technology *bridge_technology = NULL; | ||||||
|  |  | ||||||
| @@ -591,7 +586,7 @@ static int bridge_make_compatible(struct ast_bridge *bridge, struct ast_bridge_c | |||||||
| /*! \brief Perform the smart bridge operation. Basically sees if a new bridge technology should be used instead of the current one. */ | /*! \brief Perform the smart bridge operation. Basically sees if a new bridge technology should be used instead of the current one. */ | ||||||
| static int smart_bridge_operation(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, int count) | static int smart_bridge_operation(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, int count) | ||||||
| { | { | ||||||
| 	format_t new_capabilities = 0; | 	enum ast_bridge_capability new_capabilities = 0; | ||||||
| 	struct ast_bridge_technology *new_technology = NULL, *old_technology = bridge->technology; | 	struct ast_bridge_technology *new_technology = NULL, *old_technology = bridge->technology; | ||||||
| 	struct ast_bridge temp_bridge = { | 	struct ast_bridge temp_bridge = { | ||||||
| 		.technology = bridge->technology, | 		.technology = bridge->technology, | ||||||
| @@ -621,9 +616,7 @@ static int smart_bridge_operation(struct ast_bridge *bridge, struct ast_bridge_c | |||||||
|  |  | ||||||
| 	/* Attempt to find a new bridge technology to satisfy the capabilities */ | 	/* Attempt to find a new bridge technology to satisfy the capabilities */ | ||||||
| 	if (!(new_technology = find_best_technology(new_capabilities))) { | 	if (!(new_technology = find_best_technology(new_capabilities))) { | ||||||
| 		char codec_buf[256]; | 		ast_debug(1, "Smart bridge operation was unable to find new bridge technology with capabilities %d to satisfy bridge %p\n", new_capabilities, bridge); | ||||||
| 		ast_debug(1, "Smart bridge operation was unable to find new bridge technology with capabilities %s to satisfy bridge %p\n", |  | ||||||
| 			ast_getformatname_multiple(codec_buf, sizeof(codec_buf), new_capabilities), bridge); |  | ||||||
| 		return -1; | 		return -1; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user