Fix handling of zero-length frames when a codec is capable of native PLC.

Issue 9183, patch by Mihai.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@65877 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Jason Parker 19 years ago
parent f4fc851405
commit b4ea07a7eb

@ -203,6 +203,7 @@ static struct ast_translator ilbctolin = {
.sample = ilbctolin_sample, .sample = ilbctolin_sample,
.desc_size = sizeof(struct ilbc_coder_pvt), .desc_size = sizeof(struct ilbc_coder_pvt),
.buf_size = BUFFER_SAMPLES * 2, .buf_size = BUFFER_SAMPLES * 2,
.native_plc = 1,
}; };
static struct ast_translator lintoilbc = { static struct ast_translator lintoilbc = {

@ -355,6 +355,7 @@ static struct ast_translator speextolin = {
.desc_size = sizeof(struct speex_coder_pvt), .desc_size = sizeof(struct speex_coder_pvt),
.buffer_samples = BUFFER_SAMPLES, .buffer_samples = BUFFER_SAMPLES,
.buf_size = BUFFER_SAMPLES * 2, .buf_size = BUFFER_SAMPLES * 2,
.native_plc = 1,
}; };
static struct ast_translator lintospeex = { static struct ast_translator lintospeex = {

@ -104,6 +104,7 @@ struct ast_translator {
int desc_size; /*!< size of private descriptor in pvt->pvt, if any */ int desc_size; /*!< size of private descriptor in pvt->pvt, if any */
int plc_samples; /*!< set to the plc block size if used, 0 otherwise */ int plc_samples; /*!< set to the plc block size if used, 0 otherwise */
int useplc; /*!< current status of plc, changed at runtime */ int useplc; /*!< current status of plc, changed at runtime */
int native_plc; /*!< true if the translator can do native plc */
struct ast_module *module; /* opaque reference to the parent module */ struct ast_module *module; /* opaque reference to the parent module */

@ -174,6 +174,8 @@ static int framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
pvt->samples += l; pvt->samples += l;
pvt->datalen = pvt->samples * 2; /* SLIN has 2bytes for 1sample */ 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 (!pvt->t->native_plc)
return 0; return 0;
} }
if (pvt->samples + f->samples > pvt->t->buffer_samples) { if (pvt->samples + f->samples > pvt->t->buffer_samples) {

Loading…
Cancel
Save