aboutsummaryrefslogtreecommitdiffstats
path: root/translate.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-18 21:39:20 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-18 21:39:20 +0000
commitfd7889f0d95bf16c9f72b5d226028fb62ca1a845 (patch)
tree7e993d7fa7f944497cb89614feef9a7dfd42f14e /translate.c
parent184bfd1c047b2e20da7480e5695eda31014a34f3 (diff)
correct array index calculation (thanks mtaht3!)
update header file comments to reflect new usage of structure field git-svn-id: http://svn.digium.com/svn/asterisk/trunk@21207 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'translate.c')
-rw-r--r--translate.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/translate.c b/translate.c
index 0edfa54ca..d71381753 100644
--- a/translate.c
+++ b/translate.c
@@ -400,6 +400,7 @@ static void rebuild_matrix(int samples)
ast_log(LOG_DEBUG, "Resetting translation matrix\n");
bzero(tr_matrix, sizeof(tr_matrix));
+
/* first, compute all direct costs */
AST_LIST_TRAVERSE(&translators, t, list) {
x = t->srcfmt;
@@ -413,6 +414,7 @@ static void rebuild_matrix(int samples)
tr_matrix[x][z].cost = t->cost;
}
}
+
/*
* For each triple x, y, z of distinct formats, check if there is
* a path from x to z through y which is cheaper than what is
@@ -656,6 +658,9 @@ int ast_translator_best_choice(int *dst, int *srcs)
unsigned int ast_translate_path_steps(unsigned int dest, unsigned int src)
{
+ /* convert bitwise format numbers into array indices */
+ src = powerof(src);
+ dest = powerof(dest);
if (!tr_matrix[src][dest].step)
return -1;
else