[asterisk-commits] rmudgett: branch group/bridge_construction r383329 - /team/group/bridge_const...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Mar 18 14:55:53 CDT 2013
Author: rmudgett
Date: Mon Mar 18 14:55:49 2013
New Revision: 383329
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=383329
Log:
Use better names and declaraction locations for variables in bridge_make_compatible().
Modified:
team/group/bridge_construction/main/bridging.c
Modified: team/group/bridge_construction/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/main/bridging.c?view=diff&rev=383329&r1=383328&r2=383329
==============================================================================
--- team/group/bridge_construction/main/bridging.c (original)
+++ team/group/bridge_construction/main/bridging.c Mon Mar 18 14:55:49 2013
@@ -1092,25 +1092,24 @@
static int bridge_make_compatible(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
{
- struct ast_format formats[2];
-
- ast_format_copy(&formats[0], ast_channel_readformat(bridge_channel->chan));
- ast_format_copy(&formats[1], ast_channel_writeformat(bridge_channel->chan));
+ struct ast_format read_format;
+ struct ast_format write_format;
+ struct ast_format best_format;
+ char codec_buf[512];
+
+ ast_format_copy(&read_format, ast_channel_readformat(bridge_channel->chan));
+ ast_format_copy(&write_format, ast_channel_writeformat(bridge_channel->chan));
/* Are the formats currently in use something this bridge can handle? */
if (!ast_format_cap_iscompatible(bridge->technology->format_capabilities, ast_channel_readformat(bridge_channel->chan))) {
- struct ast_format best_format;
-
ast_best_codec(bridge->technology->format_capabilities, &best_format);
/* Read format is a no go... */
- if (option_debug) {
- char codec_buf[512];
- ast_debug(1, "Bridge technology %s wants to read any of formats %s but channel has %s\n",
- bridge->technology->name,
- ast_getformatname_multiple(codec_buf, sizeof(codec_buf), bridge->technology->format_capabilities),
- ast_getformatname(&formats[0]));
- }
+ ast_debug(1, "Bridge technology %s wants to read any of formats %s but channel has %s\n",
+ bridge->technology->name,
+ ast_getformatname_multiple(codec_buf, sizeof(codec_buf), bridge->technology->format_capabilities),
+ ast_getformatname(&read_format));
+
/* Switch read format to the best one chosen */
if (ast_set_read_format(bridge_channel->chan, &best_format)) {
ast_log(LOG_WARNING, "Failed to set channel %s to read format %s\n",
@@ -1121,22 +1120,18 @@
bridge, ast_channel_name(bridge_channel->chan), ast_getformatname(&best_format));
} else {
ast_debug(1, "Bridge %p is happy that channel %s already has read format %s\n",
- bridge, ast_channel_name(bridge_channel->chan), ast_getformatname(&formats[0]));
- }
-
- if (!ast_format_cap_iscompatible(bridge->technology->format_capabilities, &formats[1])) {
- struct ast_format best_format;
-
+ bridge, ast_channel_name(bridge_channel->chan), ast_getformatname(&read_format));
+ }
+
+ if (!ast_format_cap_iscompatible(bridge->technology->format_capabilities, &write_format)) {
ast_best_codec(bridge->technology->format_capabilities, &best_format);
/* Write format is a no go... */
- if (option_debug) {
- char codec_buf[512];
- ast_debug(1, "Bridge technology %s wants to write any of formats %s but channel has %s\n",
- bridge->technology->name,
- ast_getformatname_multiple(codec_buf, sizeof(codec_buf), bridge->technology->format_capabilities),
- ast_getformatname(&formats[1]));
- }
+ ast_debug(1, "Bridge technology %s wants to write any of formats %s but channel has %s\n",
+ bridge->technology->name,
+ ast_getformatname_multiple(codec_buf, sizeof(codec_buf), bridge->technology->format_capabilities),
+ ast_getformatname(&write_format));
+
/* Switch write format to the best one chosen */
if (ast_set_write_format(bridge_channel->chan, &best_format)) {
ast_log(LOG_WARNING, "Failed to set channel %s to write format %s\n",
@@ -1147,7 +1142,7 @@
bridge, ast_channel_name(bridge_channel->chan), ast_getformatname(&best_format));
} else {
ast_debug(1, "Bridge %p is happy that channel %s already has write format %s\n",
- bridge, ast_channel_name(bridge_channel->chan), ast_getformatname(&formats[1]));
+ bridge, ast_channel_name(bridge_channel->chan), ast_getformatname(&write_format));
}
return 0;
More information about the asterisk-commits
mailing list