summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorJenkins2 <jenkins2@gerrit.asterisk.org>2017-11-30 09:30:55 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-11-30 09:30:55 -0600
commit0f4152307ad2b831df10fb23605b033d6f1b0ae1 (patch)
treed5f0585a3c8f2202796b53854859850c802ea5d9 /main
parent8e979ce41b6e82a762ff3284449c2149c2933aeb (diff)
parentc46cab49a32f488cec0196ec8e2e4c4f8e7386b8 (diff)
Merge "translate: Transcode siren14, speex32, silk24, and silk12 via slin16." into 13
Diffstat (limited to 'main')
-rw-r--r--main/translate.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/main/translate.c b/main/translate.c
index 4a342e81b..f0a7f72c3 100644
--- a/main/translate.c
+++ b/main/translate.c
@@ -34,6 +34,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <sys/time.h>
#include <sys/resource.h>
#include <math.h>
+#include <stdlib.h>
#include "asterisk/lock.h"
#include "asterisk/channel.h"
@@ -1404,6 +1405,20 @@ int ast_translator_best_choice(struct ast_format_cap *dst_cap,
ao2_replace(bestdst, dst);
besttablecost = matrix_get(x, y)->table_cost;
beststeps = matrix_get(x, y)->multistep;
+ } else if (matrix_get(x, y)->table_cost == besttablecost
+ && matrix_get(x, y)->multistep == beststeps) {
+ int gap_selected = abs(ast_format_get_sample_rate(best)
+ - ast_format_get_sample_rate(bestdst));
+ int gap_current = abs(ast_format_get_sample_rate(src)
+ - ast_format_get_sample_rate(dst));
+
+ if (gap_current < gap_selected) {
+ /* better than what we have so far */
+ ao2_replace(best, src);
+ ao2_replace(bestdst, dst);
+ besttablecost = matrix_get(x, y)->table_cost;
+ beststeps = matrix_get(x, y)->multistep;
+ }
}
}
}