[svn-commits] kpfleming: branch 1.2 r38347 - /branches/1.2/channel.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Jul 27 08:40:04 MST 2006


Author: kpfleming
Date: Thu Jul 27 10:40:03 2006
New Revision: 38347

URL: http://svn.digium.com/view/asterisk?rev=38347&view=rev
Log:
do a better job avoiding translation path teardown/setup when not needed

Modified:
    branches/1.2/channel.c

Modified: branches/1.2/channel.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channel.c?rev=38347&r1=38346&r2=38347&view=diff
==============================================================================
--- branches/1.2/channel.c (original)
+++ branches/1.2/channel.c Thu Jul 27 10:40:03 2006
@@ -2328,10 +2328,6 @@
 	int native;
 	int res;
 	
-	/* if already in the desired format nothing to do here */
-	if (*format == fmt)
-		return 0;
-
 	native = chan->nativeformats;
 	/* Find a translation path from the native format to one of the desired formats */
 	if (!direction)
@@ -2349,6 +2345,13 @@
 	
 	/* Now we have a good choice for both. */
 	ast_mutex_lock(&chan->lock);
+
+	if ((*rawformat == native) && (*format == fmt)) {
+		/* the channel is already in these formats, so nothing to do */
+		ast_mutex_unlock(&chan->lock);
+		return 0;
+	}
+
 	*rawformat = native;
 	/* User perspective is fmt */
 	*format = fmt;



More information about the svn-commits mailing list