From 95bf6f2fc3b74af2d456b48109241b4287699bf3 Mon Sep 17 00:00:00 2001 From: Terry Wilson Date: Thu, 19 May 2011 23:28:13 +0000 Subject: [PATCH] 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 --- include/asterisk/bridging.h | 4 ++-- include/asterisk/bridging_technology.h | 2 +- main/bridging.c | 21 +++++++-------------- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/include/asterisk/bridging.h b/include/asterisk/bridging.h index 3e34760022..5573f18adc 100644 --- a/include/asterisk/bridging.h +++ b/include/asterisk/bridging.h @@ -193,7 +193,7 @@ struct ast_bridge { * This creates a simple two party bridge that will be destroyed once one of * 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 * @@ -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 * together. */ -int ast_bridge_check(format_t capabilities); +int ast_bridge_check(enum ast_bridge_capability capabilities); /*! \brief Destroy a bridge * diff --git a/include/asterisk/bridging_technology.h b/include/asterisk/bridging_technology.h index 0659abd779..ed3602f28f 100644 --- a/include/asterisk/bridging_technology.h +++ b/include/asterisk/bridging_technology.h @@ -45,7 +45,7 @@ struct ast_bridge_technology { /*! Unique name to this bridge technology */ const char *name; /*! 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 */ enum ast_bridge_preference preference; /*! Callback for when a bridge is being created */ diff --git a/main/bridging.c b/main/bridging.c index a256cf038a..bce145ebcf 100644 --- a/main/bridging.c +++ b/main/bridging.c @@ -382,16 +382,13 @@ static void *bridge_thread(void *data) } /*! \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; AST_RWLIST_RDLOCK(&bridge_technologies); AST_RWLIST_TRAVERSE(&bridge_technologies, current, entry) { - char tmp1[256], tmp2[256]; - 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)); + ast_debug(1, "Bridge technology %s has capabilities %d and we want %d\n", current->name, current->capabilities, capabilities); if (current->suspended) { ast_debug(1, "Bridge technology %s is suspended. Skipping.\n", current->name); continue; @@ -448,7 +445,7 @@ static void destroy_bridge(void *obj) 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_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 (!bridge_technology) { - char codec_buf[256]; - ast_debug(1, "Failed to find a bridge technology to satisfy capabilities %s\n", - ast_getformatname_multiple(codec_buf, sizeof(codec_buf), capabilities)); + ast_debug(1, "Failed to find a bridge technology to satisfy capabilities %d\n", capabilities); return NULL; } @@ -503,7 +498,7 @@ struct ast_bridge *ast_bridge_new(format_t capabilities, int flags) 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; @@ -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. */ 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 temp_bridge = { .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 */ 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 %s to satisfy bridge %p\n", - ast_getformatname_multiple(codec_buf, sizeof(codec_buf), new_capabilities), bridge); + ast_debug(1, "Smart bridge operation was unable to find new bridge technology with capabilities %d to satisfy bridge %p\n", new_capabilities, bridge); return -1; }