asterisk driver bug fixes, Thanks Antonio
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 3 Apr 2014 21:31:12 +0000 (21:31 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 3 Apr 2014 21:31:12 +0000 (21:31 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1487 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/asterisk/asterisk-codec2.patch
codec2-dev/asterisk/codec_codec2.c
codec2-dev/asterisk/ex_codec2.h

index 695d323791a4093d8a4788a7c6522cbdfa352b0f..53569ff9311a6f58bcb529469f2d064a245da31c 100644 (file)
@@ -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;
index 5d477f65795a7dc3b84ff9659f48f55f06ddeb99..d161be7e86d62977d2cdfd74f395da69d20b0de1 100644 (file)
@@ -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;
 }
index 98b6214d7f4438277420fc4fb371ef9983d4f2bb..ac5782ddb8183383b5cd118ec7e217bedeac6c4e 100644 (file)
@@ -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)