diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-06-03 17:21:06 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-06-03 17:21:06 +0000 |
commit | f8e42423ba838f74caab37dc1e0a103542121193 (patch) | |
tree | 31aedf32e9a5f0b693d961b1dcf7733b1e15a799 /main | |
parent | ff37f9e1a548b24c0a83d309352fa56554867435 (diff) |
Merged revisions 267492 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r267492 | mmichelson | 2010-06-03 12:09:11 -0500 (Thu, 03 Jun 2010) | 6 lines
Remove unnecessary code relating to PLC.
The logic for handling generic PLC is now handled in ast_write in
channel.c instead of in translation code.
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@267507 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/translate.c | 46 |
1 files changed, 6 insertions, 40 deletions
diff --git a/main/translate.c b/main/translate.c index 1e85a3744..293ab3203 100644 --- a/main/translate.c +++ b/main/translate.c @@ -88,22 +88,19 @@ static force_inline int powerof(unsigned int d) /*! * \brief Allocate the descriptor, required outbuf space, - * and possibly also plc and desc. + * and possibly desc. */ static void *newpvt(struct ast_translator *t) { struct ast_trans_pvt *pvt; int len; - int useplc = t->plc_samples > 0 && t->useplc; /* cache, because it can change on the fly */ char *ofs; /* * compute the required size adding private descriptor, - * plc, buffer, AST_FRIENDLY_OFFSET. + * buffer, AST_FRIENDLY_OFFSET. */ len = sizeof(*pvt) + t->desc_size; - if (useplc) - len += sizeof(plc_state_t); if (t->buf_size) len += AST_FRIENDLY_OFFSET + t->buf_size; pvt = ast_calloc(1, len); @@ -115,10 +112,6 @@ static void *newpvt(struct ast_translator *t) pvt->pvt = ofs; ofs += t->desc_size; } - if (useplc) { /* then plc state */ - pvt->plc = (plc_state_t *)ofs; - ofs += sizeof(plc_state_t); - } if (t->buf_size) /* finally buffer and header */ pvt->outbuf.c = ofs + AST_FRIENDLY_OFFSET; /* call local init routine, if present */ @@ -151,10 +144,9 @@ static void destroy(struct ast_trans_pvt *pvt) ast_module_unref(t->module); } -/*! \brief framein wrapper, deals with plc and bound checks. */ +/*! \brief framein wrapper, deals with bound checks. */ static int framein(struct ast_trans_pvt *pvt, struct ast_frame *f) { - int16_t *dst = pvt->outbuf.i16; int ret; int samples = pvt->samples; /* initial value */ @@ -168,18 +160,8 @@ static int framein(struct ast_trans_pvt *pvt, struct ast_frame *f) ast_log(LOG_WARNING, "no samples for %s\n", pvt->t->name); } if (pvt->t->buffer_samples) { /* do not pass empty frames to callback */ - if (f->datalen == 0) { /* perform PLC with nominal framesize of 20ms/160 samples */ - if (pvt->plc) { - int l = pvt->t->plc_samples; - if (pvt->samples + l > pvt->t->buffer_samples) { - ast_log(LOG_WARNING, "Out of buffer space\n"); - return -1; - } - l = plc_fillin(pvt->plc, dst + pvt->samples, l); - pvt->samples += l; - pvt->datalen = pvt->samples * 2; /* SLIN has 2bytes for 1sample */ - } - /* We don't want generic PLC. If the codec has native PLC, then do that */ + if (f->datalen == 0) { /* perform native PLC if available */ + /* If the codec has native PLC, then do that */ if (!pvt->t->native_plc) return 0; } @@ -192,13 +174,6 @@ static int framein(struct ast_trans_pvt *pvt, struct ast_frame *f) * it otherwise. */ ret = pvt->t->framein(pvt, f); - /* possibly store data for plc */ - if (!ret && pvt->plc) { - int l = pvt->t->plc_samples; - if (pvt->samples < l) - l = pvt->samples; - plc_rx(pvt->plc, dst + pvt->samples - l, l); - } /* diagnostic ... */ if (pvt->samples == samples) ast_log(LOG_WARNING, "%s did not update samples %d\n", @@ -644,16 +619,7 @@ int __ast_register_translator(struct ast_translator *t, struct ast_module *mod) ast_log(LOG_WARNING, "Invalid translator path: (%s codec is not valid)\n", t->srcfmt == -1 ? "starting" : "ending"); return -1; } - if (t->plc_samples) { - if (t->buffer_samples < t->plc_samples) { - ast_log(LOG_WARNING, "plc_samples %d buffer_samples %d\n", - t->plc_samples, t->buffer_samples); - return -1; - } - if (t->dstfmt != powerof(AST_FORMAT_SLINEAR)) - ast_log(LOG_WARNING, "plc_samples %d format %x\n", - t->plc_samples, t->dstfmt); - } + if (t->srcfmt >= MAX_FORMAT) { ast_log(LOG_WARNING, "Source format %s is larger than MAX_FORMAT\n", ast_getformatname(t->srcfmt)); return -1; |