aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-06-03 17:39:18 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-06-03 17:39:18 +0000
commitbbd2b8e467973919d3e924c41df4b64a40daef71 (patch)
tree17e8eaf1d117185f52e077c873b07085cc501512 /main
parentfc2a24fdc888e7c8515e40c3d835976819861163 (diff)
1.4 version of the dead PLC code fix.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@267539 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/translate.c46
1 files changed, 6 insertions, 40 deletions
diff --git a/main/translate.c b/main/translate.c
index a928470bf..fd6445dde 100644
--- a/main/translate.c
+++ b/main/translate.c
@@ -94,22 +94,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);
@@ -121,10 +118,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 = ofs + AST_FRIENDLY_OFFSET;
/* call local init routine, if present */
@@ -146,10 +139,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 = (int16_t *)pvt->outbuf;
int ret;
int samples = pvt->samples; /* initial value */
@@ -163,18 +155,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;
}
@@ -187,13 +169,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",
@@ -690,16 +665,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;