From b075be1caa2160c61631a399264998f768c0de1d Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Thu, 9 Jan 2003 23:11:05 +0000 Subject: [PATCH] Version 0.3.0 from FTP git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@582 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- translate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/translate.c b/translate.c index 0c5b1ddbf9..2d1ab42f30 100755 --- a/translate.c +++ b/translate.c @@ -227,7 +227,7 @@ static void calc_cost(struct ast_translator *t) } gettimeofday(&start, NULL); /* Call the encoder until we've processed one second of time */ - while(sofar < 1000) { + while(sofar < 8000) { f = t->sample(); if (!f) { ast_log(LOG_WARNING, "Translator '%s' failed to produce a sample frame.\n", t->name); @@ -238,7 +238,7 @@ static void calc_cost(struct ast_translator *t) t->framein(pvt, f); ast_frfree(f); while((out = t->frameout(pvt))) { - sofar += out->timelen; + sofar += out->samples; ast_frfree(out); } } @@ -246,6 +246,8 @@ static void calc_cost(struct ast_translator *t) t->destroy(pvt); cost = (finish.tv_sec - start.tv_sec) * 1000 + (finish.tv_usec - start.tv_usec) / 1000; t->cost = cost; + if (!t->cost) + t->cost = 1; } static int show_translation(int fd, int argc, char *argv[])