From: drowe67 Date: Thu, 3 Apr 2014 21:31:12 +0000 (+0000) Subject: asterisk driver bug fixes, Thanks Antonio X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=5ff395c57e8fa4434e2a8f6902a08ef8c7639b8c;p=freetel-svn-tracking.git asterisk driver bug fixes, Thanks Antonio git-svn-id: https://svn.code.sf.net/p/freetel/code@1487 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/asterisk/asterisk-codec2.patch b/codec2-dev/asterisk/asterisk-codec2.patch index 695d3237..53569ff9 100644 --- a/codec2-dev/asterisk/asterisk-codec2.patch +++ b/codec2-dev/asterisk/asterisk-codec2.patch @@ -14,7 +14,7 @@ { AST_FORMAT_ADPCM, "adpcm" , 8000, "ADPCM", 40, 10, 300, 10, 20 }, /*!< codec_adpcm.c */ { AST_FORMAT_SLINEAR, "slin", 8000, "16 bit Signed Linear PCM", 160, 10, 70, 10, 20, AST_SMOOTHER_FLAG_BE }, /*!< Signed linear */ { AST_FORMAT_LPC10, "lpc10", 8000, "LPC10", 7, 20, 20, 20, 20 }, /*!< codec_lpc10.c */ -+ { AST_FORMAT_CODEC2, "codec2", 8000, "Codec 2", 7, 20, 20, 20, 20 }, /*!< codec_codec2.c */ ++ { AST_FORMAT_CODEC2, "codec2", 8000, "Codec 2", 6, 20, 20, 20, 20 }, /*!< codec_codec2.c */ { AST_FORMAT_G729A, "g729", 8000, "G.729A", 10, 10, 230, 10, 20, AST_SMOOTHER_FLAG_G729 }, /*!< Binary commercial distribution */ { AST_FORMAT_SPEEX, "speex", 8000, "SpeeX", 10, 10, 60, 10, 20 }, /*!< codec_speex.c */ { AST_FORMAT_SPEEX16, "speex16", 16000, "SpeeX 16khz", 10, 10, 60, 10, 20 }, /*!< codec_speex.c */ @@ -23,7 +23,7 @@ samples += (((char *)(f->data.ptr))[7] & 0x1) * 8; break; + case AST_FORMAT_CODEC2: -+ samples = 160 * (f->datalen / 7); ++ samples = 160 * (f->datalen / 6); + break; case AST_FORMAT_ULAW: case AST_FORMAT_ALAW: @@ -33,7 +33,7 @@ len = (samples / 160) * 33; break; + case AST_FORMAT_CODEC2: -+ len = (samples / 160) * 7; ++ len = (samples / 160) * 6; + break; case AST_FORMAT_G729A: len = samples / 8; diff --git a/codec2-dev/asterisk/codec_codec2.c b/codec2-dev/asterisk/codec_codec2.c index 5d477f65..d161be7e 100644 --- a/codec2-dev/asterisk/codec_codec2.c +++ b/codec2-dev/asterisk/codec_codec2.c @@ -32,7 +32,7 @@ #define BUFFER_SAMPLES 8000 #define CODEC2_SAMPLES 160 -#define CODEC2_FRAME_LEN 7 +#define CODEC2_FRAME_LEN 6 /* Sample frame data */ @@ -41,7 +41,7 @@ struct codec2_translator_pvt { /* both codec2tolin and codec2togsm */ struct CODEC2 *codec2; - short buf[BUFFER_SAMPLES]; /* lintocodec2, temporary storage */ + int16_t buf[BUFFER_SAMPLES]; /* lintocodec2, temporary storage */ }; static int codec2_new(struct ast_trans_pvt *pvt) @@ -49,6 +49,8 @@ static int codec2_new(struct ast_trans_pvt *pvt) struct codec2_translator_pvt *tmp = pvt->pvt; tmp->codec2 = codec2_create(CODEC2_MODE_2400); + if (!tmp->codec2) + return -1; return 0; } diff --git a/codec2-dev/asterisk/ex_codec2.h b/codec2-dev/asterisk/ex_codec2.h index 98b6214d..ac5782dd 100644 --- a/codec2-dev/asterisk/ex_codec2.h +++ b/codec2-dev/asterisk/ex_codec2.h @@ -8,7 +8,7 @@ */ static uint8_t ex_codec2[] = { - 0x3e,0x06,0x4a,0xbb,0x9e,0x40,0xc0 + 0xea,0xca,0x14,0x85,0x91,0x78 }; static struct ast_frame *codec2_sample(void)