diff options
author | Jenkins2 <jenkins2@gerrit.asterisk.org> | 2017-11-30 10:06:25 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-11-30 10:06:25 -0600 |
commit | b4bbe04898c8a1aa577f1dbf279dde1677facb8b (patch) | |
tree | cda54c22e37bd947de79fd29bf77e76abec0a32c /main | |
parent | 4f6bd5898e8b8ece3e8cc18a2cb2854a068b323c (diff) | |
parent | a0654e40e3364b2c1eacb985309a8a8ee6221ca6 (diff) |
Merge "translate: Transcode siren14, speex32, silk24, and silk12 via slin16." into 15
Diffstat (limited to 'main')
-rw-r--r-- | main/translate.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/main/translate.c b/main/translate.c index 30f16492e..70e97f955 100644 --- a/main/translate.c +++ b/main/translate.c @@ -32,6 +32,7 @@ #include <sys/time.h> #include <sys/resource.h> #include <math.h> +#include <stdlib.h> #include "asterisk/lock.h" #include "asterisk/channel.h" @@ -1413,6 +1414,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; + } } } } |