mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
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
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -509,6 +509,8 @@ Codecs
|
||||
and CELT. You are able to set up a call and have attribute information pass.
|
||||
This should help considerably with video calls.
|
||||
|
||||
* The iLBC codec can now use a system-provided iLBC library if one is installed,
|
||||
just like the GSM codec.
|
||||
|
||||
Logging
|
||||
-------------------
|
||||
|
@@ -13,6 +13,7 @@ GENERIC_ODBC=@PBX_GENERIC_ODBC@
|
||||
GMIME=@PBX_GMIME@
|
||||
GNU_LD=@GNU_LD@
|
||||
GSM=@PBX_GSM@
|
||||
ILBC=@PBX_ILBC@
|
||||
GTK2=@PBX_GTK2@
|
||||
H323=@PBX_H323@
|
||||
HOARD=@PBX_HOARD@
|
||||
|
@@ -29,6 +29,12 @@ GSM_INCLUDE:=-Igsm/inc
|
||||
$(if $(filter codec_gsm,$(EMBEDDED_MODS)),modules.link,codec_gsm.so): gsm/lib/libgsm.a
|
||||
endif
|
||||
|
||||
ifneq ($(ILBC_INTERNAL),no)
|
||||
$(if $(filter codec_ilbc,$(EMBEDDED_MODS)),modules.link,codec_ilbc.so): $(LIBILBC)
|
||||
else
|
||||
ILBC_INCLUDE+=-DILBC_WEBRTC
|
||||
endif
|
||||
|
||||
|
||||
clean::
|
||||
$(MAKE) -C gsm clean
|
||||
@@ -50,8 +56,6 @@ $(LIBILBC):
|
||||
@$(MAKE) -C ilbc all _ASTCFLAGS="$(filter-out -Wmissing-prototypes -Wmissing-declarations -Wshadow,$(_ASTCFLAGS)) $(AST_NO_STRICT_OVERFLOW)"
|
||||
|
||||
|
||||
$(if $(filter codec_ilbc,$(EMBEDDED_MODS)),modules.link,codec_ilbc.so): $(LIBILBC)
|
||||
|
||||
$(if $(filter codec_g722,$(EMBEDDED_MODS)),modules.link,codec_g722.so): g722/g722_encode.o g722/g722_decode.o
|
||||
g722/g722_encode.o g722/g722_decode.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,codec_g722)
|
||||
|
||||
|
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
/*** 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;
|
||||
|
21
configure.ac
21
configure.ac
@@ -390,6 +390,7 @@ AST_EXT_LIB_SETUP([CRYPTO], [OpenSSL Cryptography], [crypto])
|
||||
AST_EXT_LIB_SETUP([DAHDI], [DAHDI], [dahdi])
|
||||
AST_EXT_LIB_SETUP([FFMPEG], [Ffmpeg and avcodec], [avcodec])
|
||||
AST_EXT_LIB_SETUP([GSM], [External GSM], [gsm], [, use 'internal' GSM otherwise])
|
||||
AST_EXT_LIB_SETUP([ILBC], [System iLBC], [ilbc], [, use 'internal' iLBC otherwise])
|
||||
AST_EXT_LIB_SETUP([GTK2], [gtk2], [gtk2])
|
||||
AST_EXT_LIB_SETUP([GMIME], [GMime], [gmime])
|
||||
AST_EXT_LIB_SETUP([OPENH323], [OpenH323], [h323])
|
||||
@@ -1250,6 +1251,26 @@ if test "${USE_GSM}" != "no"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
ILBC_INTERNAL="yes"
|
||||
AC_SUBST(ILBC_INTERNAL)
|
||||
ILBC_SYSTEM="yes"
|
||||
if test "${USE_ILBC}" != "no"; then
|
||||
if test "${ILBC_DIR}" = "internal"; then
|
||||
ILBC_SYSTEM="no"
|
||||
elif test "${ILBC_DIR}" != ""; then
|
||||
ILBC_INTERNAL="no"
|
||||
fi
|
||||
if test "${ILBC_SYSTEM}" = "yes"; then
|
||||
AST_PKG_CONFIG_CHECK(ILBC, libilbc)
|
||||
if test "$PBX_ILBC" = '1'; then
|
||||
ILBC_INTERNAL='no'
|
||||
fi
|
||||
fi
|
||||
if test "${ILBC_INTERNAL}" = "yes"; then
|
||||
PBX_ILBC=1
|
||||
fi
|
||||
fi
|
||||
|
||||
AST_EXT_LIB_CHECK([ICONV], [iconv], [iconv_open], [iconv.h])
|
||||
# GNU libiconv #define's iconv_open to libiconv_open, so we need to search for that symbol
|
||||
AST_EXT_LIB_CHECK([ICONV], [iconv], [libiconv_open], [iconv.h])
|
||||
|
@@ -327,6 +327,9 @@
|
||||
/* Define to 1 if you have the Iksemel Jabber library. */
|
||||
#undef HAVE_IKSEMEL
|
||||
|
||||
/* Define if your system has the ILBC libraries. */
|
||||
#undef HAVE_ILBC
|
||||
|
||||
/* Define if your system has the UW IMAP Toolkit c-client library. */
|
||||
#undef HAVE_IMAP_TK
|
||||
|
||||
|
@@ -141,6 +141,10 @@ GSM_INTERNAL=@GSM_INTERNAL@
|
||||
GSM_INCLUDE=@GSM_INCLUDE@
|
||||
GSM_LIB=@GSM_LIB@
|
||||
|
||||
ILBC_INTERNAL=@ILBC_INTERNAL@
|
||||
ILBC_INCLUDE=@ILBC_INCLUDE@
|
||||
ILBC_LIB=@ILBC_LIB@
|
||||
|
||||
GTK2_INCLUDE=@GTK2_INCLUDE@
|
||||
GTK2_LIB=@GTK2_LIB@
|
||||
|
||||
|
Reference in New Issue
Block a user