diff options
-rw-r--r-- | .cleancount | 2 | ||||
-rw-r--r-- | codecs/codec_ilbc.c | 1 | ||||
-rw-r--r-- | codecs/codec_speex.c | 1 | ||||
-rw-r--r-- | include/asterisk/translate.h | 1 | ||||
-rw-r--r-- | main/translate.c | 4 |
5 files changed, 7 insertions, 2 deletions
diff --git a/.cleancount b/.cleancount index 64bb6b746..e85087aff 100644 --- a/.cleancount +++ b/.cleancount @@ -1 +1 @@ -30 +31 diff --git a/codecs/codec_ilbc.c b/codecs/codec_ilbc.c index 34847fcc7..637f22d12 100644 --- a/codecs/codec_ilbc.c +++ b/codecs/codec_ilbc.c @@ -203,6 +203,7 @@ static struct ast_translator ilbctolin = { .sample = ilbctolin_sample, .desc_size = sizeof(struct ilbc_coder_pvt), .buf_size = BUFFER_SAMPLES * 2, + .native_plc = 1, }; static struct ast_translator lintoilbc = { diff --git a/codecs/codec_speex.c b/codecs/codec_speex.c index c08de5879..182b33eb9 100644 --- a/codecs/codec_speex.c +++ b/codecs/codec_speex.c @@ -358,6 +358,7 @@ static struct ast_translator speextolin = { .desc_size = sizeof(struct speex_coder_pvt), .buffer_samples = BUFFER_SAMPLES, .buf_size = BUFFER_SAMPLES * 2, + .native_plc = 1, }; static struct ast_translator lintospeex = { diff --git a/include/asterisk/translate.h b/include/asterisk/translate.h index 5e28c6236..ec939e6b5 100644 --- a/include/asterisk/translate.h +++ b/include/asterisk/translate.h @@ -104,6 +104,7 @@ struct ast_translator { 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 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 */ diff --git a/main/translate.c b/main/translate.c index c7387a713..7ed772458 100644 --- a/main/translate.c +++ b/main/translate.c @@ -174,7 +174,9 @@ static int framein(struct ast_trans_pvt *pvt, struct ast_frame *f) pvt->samples += l; pvt->datalen = pvt->samples * 2; /* SLIN has 2bytes for 1sample */ } - return 0; + /* We don't want generic PLC. If the codec has native PLC, then do that */ + if (!pvt->t->native_plc) + return 0; } if (pvt->samples + f->samples > pvt->t->buffer_samples) { ast_log(LOG_WARNING, "Out of buffer space\n"); |