[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase1_step3 r305250 - /team/dvossel/fixt...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 31 16:54:06 CST 2011


Author: dvossel
Date: Mon Jan 31 16:54:02 2011
New Revision: 305250

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=305250
Log:
addresses reviewboard comments

Modified:
    team/dvossel/fixtheworld_phase1_step3/channels/chan_agent.c

Modified: team/dvossel/fixtheworld_phase1_step3/channels/chan_agent.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/channels/chan_agent.c?view=diff&rev=305250&r1=305249&r2=305250
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/channels/chan_agent.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/channels/chan_agent.c Mon Jan 31 16:54:02 2011
@@ -799,11 +799,7 @@
 	}
 	if (!res) {
 		struct ast_format tmpfmt;
-		if ((ast_best_codec(p->chan->nativeformats, &tmpfmt))) {
-			res = ast_set_read_format(p->chan, &tmpfmt);
-		} else {
-			res = -1;
-		}
+		res = ast_set_read_format_from_cap(p->chan, p->chan->nativeformats);
 		ast_debug(3, "Set read format, result '%d'\n", res);
 		if (res)
 			ast_log(LOG_WARNING, "Unable to set read format to %s\n", ast_getformatname(&tmpfmt));
@@ -815,11 +811,7 @@
 
 	if (!res) {
 		struct ast_format tmpfmt;
-		if ((ast_best_codec(p->chan->nativeformats, &tmpfmt))) {
-			res = ast_set_write_format(p->chan, &tmpfmt);
-		} else {
-			res = -1;
-		}
+		res = ast_set_write_format_from_cap(p->chan, p->chan->nativeformats);
 		ast_debug(3, "Set write format, result '%d'\n", res);
 		if (res)
 			ast_log(LOG_WARNING, "Unable to set write format to %s\n", ast_getformatname(&tmpfmt));
@@ -2007,20 +1999,14 @@
 					ast_mutex_lock(&p->lock);
 					if (!res) {
 						struct ast_format tmpfmt;
-						res = -1;
-						if ((ast_best_codec(chan->nativeformats, &tmpfmt))) {
-							res = ast_set_read_format(chan, &tmpfmt);
-						}
+						res = ast_set_read_format_from_cap(chan, chan->nativeformats);
 						if (res) {
 							ast_log(LOG_WARNING, "Unable to set read format to %s\n", ast_getformatname(&tmpfmt));
 						}
 					}
 					if (!res) {
 						struct ast_format tmpfmt;
-						res = -1;
-						if ((ast_best_codec(chan->nativeformats, &tmpfmt))) {
-							res = ast_set_write_format(chan, &tmpfmt);
-						}
+						res = ast_set_write_format_from_cap(chan, chan->nativeformats);
 						if (res) {
 							ast_log(LOG_WARNING, "Unable to set write format to %s\n", ast_getformatname(&tmpfmt));
 						}




More information about the asterisk-commits mailing list