aboutsummaryrefslogtreecommitdiffstats
path: root/main/translate.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-03-06 00:16:30 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-03-06 00:16:30 +0000
commit1fb47926d2de3a02e5f452b8d7c9945ca2fa58b2 (patch)
tree2c2ea15fbaf06e62b0950f17e96140076eb7c75f /main/translate.c
parentcb639936d1e86c30af8a0537928c74ee8c67d480 (diff)
Merged revisions 105933 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r105933 | russell | 2008-03-04 19:54:16 -0600 (Tue, 04 Mar 2008) | 13 lines Merged revisions 105932 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r105932 | russell | 2008-03-04 19:52:18 -0600 (Tue, 04 Mar 2008) | 5 lines Fix a bug that I just noticed in the RTP code. The calculation for setting the len field in an ast_frame of audio was wrong when G.722 is in use. The len field represents the number of ms of audio that the frame contains. It would have set the value to be twice what it should be. ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@106310 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/translate.c')
-rw-r--r--main/translate.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/main/translate.c b/main/translate.c
index 83a93a4d2..be10b11b2 100644
--- a/main/translate.c
+++ b/main/translate.c
@@ -298,14 +298,6 @@ struct ast_trans_pvt *ast_translator_build_path(int dest, int source)
return head;
}
-static inline int format_rate(int format)
-{
- if (format == AST_FORMAT_G722 || format == AST_FORMAT_SLINEAR16)
- return 16000;
-
- return 8000;
-}
-
/*! \brief do the actual translation */
struct ast_frame *ast_translate(struct ast_trans_pvt *path, struct ast_frame *f, int consume)
{
@@ -342,7 +334,7 @@ struct ast_frame *ast_translate(struct ast_trans_pvt *path, struct ast_frame *f,
path->nextout = f->delivery;
}
/* Predict next incoming sample */
- path->nextin = ast_tvadd(path->nextin, ast_samp2tv(f->samples, format_rate(f->subclass)));
+ path->nextin = ast_tvadd(path->nextin, ast_samp2tv(f->samples, ast_format_rate(f->subclass)));
}
delivery = f->delivery;
for ( ; out && p ; p = p->next) {
@@ -366,7 +358,7 @@ struct ast_frame *ast_translate(struct ast_trans_pvt *path, struct ast_frame *f,
/* Predict next outgoing timestamp from samples in this
frame. */
- path->nextout = ast_tvadd(path->nextout, ast_samp2tv(out->samples, format_rate(out->subclass)));
+ path->nextout = ast_tvadd(path->nextout, ast_samp2tv(out->samples, ast_format_rate(out->subclass)));
} else {
out->delivery = ast_tv(0, 0);
ast_set2_flag(out, has_timing_info, AST_FRFLAG_HAS_TIMING_INFO);
@@ -390,7 +382,7 @@ static void calc_cost(struct ast_translator *t, int seconds)
struct rusage start;
struct rusage end;
int cost;
- int out_rate = format_rate(t->dstfmt);
+ int out_rate = ast_format_rate(t->dstfmt);
if (!seconds)
seconds = 1;