diff --git a/daemon/configure.ac b/daemon/configure.ac index 93f5e5f827263d4316845e3c850962ad9e147e15..1962eb81dc110987c080a1686e554fe74a2429ad 100644 --- a/daemon/configure.ac +++ b/daemon/configure.ac @@ -272,9 +272,17 @@ AC_DEFINE_UNQUOTED([HAVE_SPEEXDSP], `if test "x$with_speexdsp" = "xyes"; then ec AM_CONDITIONAL(BUILD_SPEEXDSP, test "x$with_speexdsp" = "xyes" ) -dnl iLBC is default-enabled, since it's included -AC_ARG_ENABLE([ilbc], AS_HELP_STRING([--disable-ilbc], [Disable iLBC codec])) -AM_CONDITIONAL(BUILD_ILBC, test "x$enable_ilbc" != "xno") +dnl iLBC is enabled if it's installed +AC_ARG_WITH([with-libilbc], + [AS_HELP_STRING([--with-libilbc], + [support ilbc audio @<:@default=check@:>@])], + [], + [with_libilbc=check]) +AS_CASE(["$with_libilbc"], + [yes], [PKG_CHECK_MODULES([libilbc], [libilbc], [HAVE_LIBILBC=1])], + [no], [], + [PKG_CHECK_MODULES([libilbc], [libilbc], [HAVE_LIBILBC=1], [HAVE_LIBILBC=0])]) +AM_CONDITIONAL([BUILD_ILBC], [test "$with_libilbc" != no -a "$HAVE_LIBILBC" -eq 1]) # IAX diff --git a/daemon/libs/compile_pjsip.sh b/daemon/libs/compile_pjsip.sh index 1828425bacdd2238af25c7952c0372eac7f6df7c..752e0f37fed0c0100316a5798ca7c857a83f4a9e 100755 --- a/daemon/libs/compile_pjsip.sh +++ b/daemon/libs/compile_pjsip.sh @@ -1,5 +1,19 @@ #!/bin/bash +OPTIONS="--disable-oss + --disable-video + --enable-ext-sound + --disable-speex-aec + --disable-g711-codec + --disable-l16-codec + --disable-gsm-codec + --disable-g722-codec + --disable-g7221-codec + --disable-speex-codec + --disable-ilbc-codec + --disable-sdl + --disable-ffmpeg + --disable-v4l2" # TODO: autotools should be doing this cd "`dirname $BASH_SOURCE`"/pjproject-2.0.1 -CFLAGS="-fPIC" ./configure --disable-sound --disable-video && make dep && make -j1 && echo "pjsip successfully compiled" +./configure $OPTIONS && make dep && make -j1 && echo "pjsip successfully compiled" diff --git a/daemon/src/audio/codecs/Makefile.am b/daemon/src/audio/codecs/Makefile.am index 4fc15ca5b79058cd98cd8623e60bcf29650f5555..56de9469dbb9e8eb4ec744c1986827bd5aa49108 100644 --- a/daemon/src/audio/codecs/Makefile.am +++ b/daemon/src/audio/codecs/Makefile.am @@ -38,13 +38,11 @@ INSTALL_SPEEX_UB_RULE = install-libcodec_speex_ub_so endif if BUILD_ILBC -include $(src)/libs/pjproject-2.0.1/build.mak - ILBC_LIB = libcodec_ilbc.so libcodecdescriptor_la_CXXFLAGS = -DBUILD_ILBC libcodec_ilbc_so_SOURCES = ilbc.cpp -libcodec_ilbc_so_CXXFLAGS = -fPIC -g -Wall -I$(top_srcdir)/libs/pjproject-2.0.1/third_party/ -libcodec_ilbc_so_LDFLAGS = --shared -lc $(top_srcdir)/libs/pjproject-2.0.1/third_party/lib/libilbccodec-$(TARGET_NAME).a +libcodec_ilbc_so_CXXFLAGS = -fPIC -g -Wall $(libilbc_CFLAGS) +libcodec_ilbc_so_LDFLAGS = --shared -lc $(libilbc_LIBS) libcodec_ilbc_so_LDADD = libcodecdescriptor.la INSTALL_ILBC_RULE = install-libcodec_ilbc_so endif diff --git a/daemon/src/audio/codecs/ilbc.cpp b/daemon/src/audio/codecs/ilbc.cpp index 53b1ad5d3af7b25d15a90c2af457fe3d1e9a0392..831991ef9719ed7255a40b4ca69c1107f94d7ec5 100644 --- a/daemon/src/audio/codecs/ilbc.cpp +++ b/daemon/src/audio/codecs/ilbc.cpp @@ -33,16 +33,13 @@ #include <algorithm> extern "C" { -#include "ilbc/iLBC_encode.h" -#include "ilbc/iLBC_decode.h" +#include <ilbc.h> } class Ilbc: public sfl::AudioCodec { public: Ilbc() : sfl::AudioCodec(ILBC_PAYLOAD, "iLBC", 8000, ILBC_FRAME_SIZE, 1), - dst_float_(), - src_float_(), ilbc_dec_(), ilbc_enc_() { @@ -54,32 +51,19 @@ class Ilbc: public sfl::AudioCodec { // iLBC expects floating point data, so we have to convert int decode(short *dst, unsigned char *src, size_t /*buf_size*/) { - /* zero out the buffer */ - std::fill(dst_float_.begin(), dst_float_.end(), 0); - const int NORMAL_MODE = 1; - iLBC_decode(dst_float_.data(), src, &ilbc_dec_, NORMAL_MODE); - - std::copy(dst_float_.begin(), dst_float_.end(), dst); - + iLBC_decode(dst, reinterpret_cast<WebRtc_UWord16*>(src), &ilbc_dec_, NORMAL_MODE); return frameSize_; } int encode(unsigned char *dst, short* src, size_t /*buf_size*/) { - /* zero out the buffer */ - std::fill(src_float_.begin(), src_float_.end(), 0); - std::copy(src, src + ILBC_FRAME_SIZE, src_float_.begin()); - - iLBC_encode(dst, src_float_.data(), &ilbc_enc_); - + iLBC_encode(reinterpret_cast<WebRtc_UWord16*>(dst), src, &ilbc_enc_); return frameSize_; } private: static const int ILBC_FRAME_SIZE = 160; static const int ILBC_PAYLOAD = 105; - std::tr1::array<float, ILBC_FRAME_SIZE> dst_float_; - std::tr1::array<float, ILBC_FRAME_SIZE> src_float_; iLBC_Dec_Inst_t ilbc_dec_; iLBC_Enc_Inst_t ilbc_enc_; };