diff options
author | Kevin P. Fleming <kpfleming@digium.com> | 2012-07-23 21:27:56 +0000 |
---|---|---|
committer | Kevin P. Fleming <kpfleming@digium.com> | 2012-07-23 21:27:56 +0000 |
commit | b5193428a7825005a36434e4917dcbaca64ad21d (patch) | |
tree | bee56a50520d343be4f852926c2af730f4917a5f /codecs/codec_ilbc.c | |
parent | b6a0ae0b35797bcdf5368e7d0e2223c6321c9b21 (diff) |
Enable usage of system-provided iLBC library.
The WebRTC version of the iLBC codec is now package as a library and is
available on some platforms. This patch allows codec_ilbc to be built against
that library if it is present.
Review: https://reviewboard.asterisk.org/r/1964/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370407 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'codecs/codec_ilbc.c')
-rw-r--r-- | codecs/codec_ilbc.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/codecs/codec_ilbc.c b/codecs/codec_ilbc.c index 11c171211..dacdd1eff 100644 --- a/codecs/codec_ilbc.c +++ b/codecs/codec_ilbc.c @@ -21,11 +21,12 @@ /*! \file * * \brief Translate between signed linear and Internet Low Bitrate Codec - * + * * \ingroup codecs */ /*** MODULEINFO + <use>ilbc</use> <support_level>core</support_level> ***/ @@ -37,8 +38,18 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/module.h" #include "asterisk/utils.h" +#ifdef ILBC_WEBRTC +#include <ilbc.h> +typedef WebRtc_UWord16 ilbc_bytes; +typedef WebRtc_Word16 ilbc_block; +#define BUF_TYPE i16 +#else #include "ilbc/iLBC_encode.h" #include "ilbc/iLBC_decode.h" +typedef unsigned char ilbc_bytes; +typedef float ilbc_block; +#define BUF_TYPE uc +#endif #define USE_ILBC_ENHANCER 0 #define ILBC_MS 30 @@ -86,7 +97,7 @@ static int ilbctolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) the tail location. Read in as many frames as there are */ int x,i; int16_t *dst = pvt->outbuf.i16; - float tmpf[ILBC_SAMPLES]; + ilbc_block tmpf[ILBC_SAMPLES]; if (!f->data.ptr && f->datalen) { ast_debug(1, "issue 16070, ILIB ERROR. data = NULL datalen = %d src = %s\n", f->datalen, f->src ? f->src : "no src set"); @@ -144,13 +155,13 @@ static struct ast_frame *lintoilbc_frameout(struct ast_trans_pvt *pvt) if (pvt->samples < ILBC_SAMPLES) return NULL; while (pvt->samples >= ILBC_SAMPLES) { - float tmpf[ILBC_SAMPLES]; + ilbc_block tmpf[ILBC_SAMPLES]; int i; /* Encode a frame of data */ for (i = 0 ; i < ILBC_SAMPLES ; i++) tmpf[i] = tmp->buf[samples + i]; - iLBC_encode( pvt->outbuf.uc + datalen, tmpf, &tmp->enc); + iLBC_encode( (ilbc_bytes*)pvt->outbuf.BUF_TYPE + datalen, tmpf, &tmp->enc); datalen += ILBC_FRAME_LEN; samples += ILBC_SAMPLES; |