]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Revert part of a change to the bridging API code
authorTerry Wilson <twilson@digium.com>
Thu, 19 May 2011 23:28:13 +0000 (23:28 +0000)
committerTerry Wilson <twilson@digium.com>
Thu, 19 May 2011 23:28:13 +0000 (23:28 +0000)
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
include/asterisk/bridging_technology.h
main/bridging.c

index 3e34760022bf853296f8b46e2dbecf3438103e7d..5573f18adcafafdd2c70f44646f560c005aa1650 100644 (file)
@@ -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
  *
index 0659abd779be03f6c6bb6ffddd7e9b9a9c98cdf4..ed3602f28f20a656ea1bdf502717d0044d32efee 100644 (file)
@@ -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 */
index a256cf038a2d05a06d656de6f53559c3f9378947..bce145ebcf20fd2b0fa99f414f1ea3522097fc13 100644 (file)
@@ -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;
        }