codec_resample: Increase buffer for Opus Codec.
authorAlexander Traud <pabstraud@compuserve.com>
Tue, 1 Dec 2015 13:55:13 +0000 (14:55 +0100)
committerAlexander Traud <pabstraud@compuserve.com>
Tue, 1 Dec 2015 13:56:43 +0000 (14:56 +0100)
ASTERISK-25599 #close

Change-Id: I1f88a88c59fb4e1e62bbdbb100c7152d48e73f10

codecs/codec_resample.c

index 67e9ce2..3c8a149 100644 (file)
@@ -38,7 +38,7 @@ ASTERISK_REGISTER_FILE()
 #include "asterisk/translate.h"
 #include "asterisk/slin.h"
 
-#define OUTBUF_SIZE   8096
+#define OUTBUF_SAMPLES   5760
 
 static struct ast_translator *translators;
 static int trans_size;
@@ -114,7 +114,7 @@ static void resamp_destroy(struct ast_trans_pvt *pvt)
 static int resamp_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
 {
        SpeexResamplerState *resamp_pvt = pvt->pvt;
-       unsigned int out_samples = (OUTBUF_SIZE / sizeof(int16_t)) - pvt->samples;
+       unsigned int out_samples = OUTBUF_SAMPLES - pvt->samples;
        unsigned int in_samples;
 
        if (!f->datalen) {
@@ -167,8 +167,8 @@ static int load_module(void)
                        translators[idx].destroy = resamp_destroy;
                        translators[idx].framein = resamp_framein;
                        translators[idx].desc_size = 0;
-                       translators[idx].buffer_samples = (OUTBUF_SIZE / sizeof(int16_t));
-                       translators[idx].buf_size = OUTBUF_SIZE;
+                       translators[idx].buffer_samples = OUTBUF_SAMPLES;
+                       translators[idx].buf_size = (OUTBUF_SAMPLES * sizeof(int16_t));
                        memcpy(&translators[idx].src_codec, &codec_list[x], sizeof(struct ast_codec));
                        memcpy(&translators[idx].dst_codec, &codec_list[y], sizeof(struct ast_codec));
                        snprintf(translators[idx].name, sizeof(translators[idx].name), "slin %ukhz -> %ukhz",