[asterisk-commits] kpfleming: trunk r46529 - in /trunk: ./ main/translate.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Oct 30 15:27:57 MST 2006


Author: kpfleming
Date: Mon Oct 30 16:27:56 2006
New Revision: 46529

URL: http://svn.digium.com/view/asterisk?rev=46529&view=rev
Log:
Merged revisions 46526 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r46526 | kpfleming | 2006-10-30 16:19:55 -0600 (Mon, 30 Oct 2006) | 3 lines

when unregistering a translator, don't rebuild the translation matrix unless needed
when filtering formats out of an offer, ensure we check for translation ability in both directions

........

Modified:
    trunk/   (props changed)
    trunk/main/translate.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/main/translate.c
URL: http://svn.digium.com/view/asterisk/trunk/main/translate.c?rev=46529&r1=46528&r2=46529&view=diff
==============================================================================
--- trunk/main/translate.c (original)
+++ trunk/main/translate.c Mon Oct 30 16:27:56 2006
@@ -655,18 +655,25 @@
 {
 	char tmp[80];
 	struct ast_translator *u;
+	int found = 0;
+
 	AST_LIST_LOCK(&translators);
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&translators, u, list) {
 		if (u == t) {
 			AST_LIST_REMOVE_CURRENT(&translators, list);
 			if (option_verbose > 1)
 				ast_verbose(VERBOSE_PREFIX_2 "Unregistered translator '%s' from format %s to %s\n", term_color(tmp, t->name, COLOR_MAGENTA, COLOR_BLACK, sizeof(tmp)), ast_getformatname(1 << t->srcfmt), ast_getformatname(1 << t->dstfmt));
+			found = 1;
 			break;
 		}
 	}
 	AST_LIST_TRAVERSE_SAFE_END;
-	rebuild_matrix(0);
+
+	if (found)
+		rebuild_matrix(0);
+
 	AST_LIST_UNLOCK(&translators);
+
 	return (u ? 0 : -1);
 }
 
@@ -776,6 +783,11 @@
 		   to this format, remove it from the result */
 		if (!tr_matrix[src_audio][powerof(x)].step)
 			res &= ~x;
+
+		/* now check the opposite direction */
+		if (!tr_matrix[powerof(x)][src_audio].step)
+			res &= ~x;
+
 	}
 
 	/* For a given source video format, traverse the list of
@@ -796,6 +808,10 @@
 		   to this format, remove it from the result */
 		if (!tr_matrix[src_video][powerof(x)].step)
 			res &= ~x;
+
+		/* now check the opposite direction */
+		if (!tr_matrix[powerof(x)][src_video].step)
+			res &= ~x;
 	}
 
 	AST_LIST_UNLOCK(&translators);



More information about the asterisk-commits mailing list