summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2014-01-03 03:44:05 +0000
committerNanang Izzuddin <nanang@teluu.com>2014-01-03 03:44:05 +0000
commit499bda86d351aed23348aa38103738231ae7d4c1 (patch)
tree0081194ef6f5ddfe6c32f8f1624429418abaea69
parentf00de059ddcdc4252b313b4194bc9fdd4b053c38 (diff)
Close #1720:
- Added configure flags --with-external-srtp and --disable-resample. - Added macro setting PJMEDIA_LIBSRTP_AUTO_INIT_DEINIT to allow application to handle libsrtp init & deinit by itself. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4701 74dad513-b988-da41-8d7b-12977e46ad98
-rwxr-xr-xaconfigure82
-rw-r--r--aconfigure.ac36
-rw-r--r--build.mak.in24
-rw-r--r--pjmedia/build/Makefile9
-rw-r--r--pjmedia/build/os-auto.mak.in36
-rw-r--r--pjmedia/build/os-darwinos.mak36
-rw-r--r--pjmedia/build/os-linux.mak36
-rw-r--r--pjmedia/build/os-rtems.mak1
-rw-r--r--pjmedia/build/os-win32.mak36
-rw-r--r--pjmedia/include/pjmedia/config.h13
-rw-r--r--pjmedia/src/pjmedia/transport_srtp.c10
-rw-r--r--third_party/build/Makefile2
-rw-r--r--third_party/build/os-auto.mak.in9
-rw-r--r--third_party/build/os-darwinos.mak2
-rw-r--r--third_party/build/os-linux.mak2
-rw-r--r--third_party/build/os-win32.mak2
16 files changed, 309 insertions, 27 deletions
diff --git a/aconfigure b/aconfigure
index a1e87a42..57eb0bce 100755
--- a/aconfigure
+++ b/aconfigure
@@ -650,6 +650,8 @@ ac_pjmedia_audiodev_objs
ac_pa_cflags
ac_external_pa
ac_pjmedia_snd
+ac_pjmedia_resample
+ac_external_srtp
ac_external_gsm
ac_external_speex
ac_shared_libraries
@@ -742,6 +744,8 @@ enable_epoll
enable_shared
with_external_speex
with_external_gsm
+with_external_srtp
+enable_resample
enable_sound
with_external_pa
enable_oss
@@ -1409,6 +1413,7 @@ Optional Features:
Disable floating point where possible
--enable-epoll Use /dev/epoll ioqueue on Linux (experimental)
--enable-shared Build shared libraries
+ --disable-resample Disable resampling implementations
--disable-sound Exclude sound (i.e. use null sound)
--disable-oss Disable OSS audio (default: not disabled)
--disable-video Disable video feature
@@ -1423,8 +1428,7 @@ Optional Features:
--disable-g7221-codec Exclude G.7221 codec in the build
--disable-speex-codec Exclude Speex codecs in the build
--disable-ilbc-codec Exclude iLBC codec in the build
- --enable-libsamplerate Link with libsamplerate when available. Note that
- PJMEDIA_RESAMPLE_IMP must also be configured
+ --enable-libsamplerate Link with libsamplerate when available.
--enable-resample-dll Build libresample as shared library
--disable-sdl Disable SDL (default: not disabled)
--disable-ffmpeg Disable ffmpeg (default: not disabled)
@@ -1455,6 +1459,11 @@ Optional Packages:
make sure that the GSM include/lib files are
accessible to use (hint: use CFLAGS and LDFLAGS env
var to set the include/lib paths)
+ --with-external-srtp Use external SRTP development files, not the one in
+ "third_party" directory. When this option is set,
+ make sure that SRTP is accessible to use (hint: use
+ CFLAGS and LDFLAGS env var to set the include/lib
+ paths)
--with-external-pa Use external PortAudio development files, not the
one in "third_party" directory. When this option is
set, make sure that PortAudio is accessible to use
@@ -5788,6 +5797,56 @@ fi
+ac_external_srtp=0
+
+
+# Check whether --with-external-srtp was given.
+if test "${with_external_srtp+set}" = set; then :
+ withval=$with_external_srtp;
+ if test "x$with_external_srtp" != "xno"; then
+ # Test SRTP installation
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if external SRTP devkit is installed" >&5
+$as_echo_n "checking if external SRTP devkit is installed... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <srtp/srtp.h>
+
+int
+main ()
+{
+srtp_init();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes!!" >&5
+$as_echo "yes!!" >&6; }
+ ac_external_srtp="1"
+
+else
+ as_fn_error $? "Unable to use SRTP. If SRTP development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths" "$LINENO" 5
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+
+
+fi
+
+
+
+ac_pjmedia_resample=libresample
+
+# Check whether --enable-resample was given.
+if test "${enable_resample+set}" = set; then :
+ enableval=$enable_resample; if test "$enable_resample" = "no"; then
+ ac_pjmedia_resample=none
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Checking if resampling is disabled...yes" >&5
+$as_echo "Checking if resampling is disabled...yes" >&6; }
+ fi
+
+fi
+
# Check whether --enable-sound was given.
@@ -6257,6 +6316,7 @@ _ACEOF
fi
+ ac_pjmedia_resample=libsamplerate
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Skipping libsamplerate detection" >&5
$as_echo "Skipping libsamplerate detection" >&6; }
@@ -7454,20 +7514,20 @@ $as_echo "OpenCORE AMR-NB library found, AMR-NB support enabled" >&6; }
ac_fn_c_check_header_mongrel "$LINENO" "vo-amrwbenc/enc_if.h" "ac_cv_header_vo_amrwbenc_enc_if_h" "$ac_includes_default"
-if test "x$ac_cv_header_vo_amrwbenc_enc_if_h" = xyes; then :
+if test "x$ac_cv_header_vo_amrwbenc_enc_if_h" = x""yes; then :
opencore_amrwb_enc_h_present=1
fi
ac_fn_c_check_header_mongrel "$LINENO" "opencore-amrwb/dec_if.h" "ac_cv_header_opencore_amrwb_dec_if_h" "$ac_includes_default"
-if test "x$ac_cv_header_opencore_amrwb_dec_if_h" = xyes; then :
+if test "x$ac_cv_header_opencore_amrwb_dec_if_h" = x""yes; then :
opencore_amrwb_dec_h_present=1
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for D_IF_init in -lopencore-amrwb" >&5
$as_echo_n "checking for D_IF_init in -lopencore-amrwb... " >&6; }
-if ${ac_cv_lib_opencore_amrwb_D_IF_init+:} false; then :
+if test "${ac_cv_lib_opencore_amrwb_D_IF_init+set}" = set; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -7501,13 +7561,13 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_opencore_amrwb_D_IF_init" >&5
$as_echo "$ac_cv_lib_opencore_amrwb_D_IF_init" >&6; }
-if test "x$ac_cv_lib_opencore_amrwb_D_IF_init" = xyes; then :
+if test "x$ac_cv_lib_opencore_amrwb_D_IF_init" = x""yes; then :
opencore_amrwb_dec_present=1 && LIBS="$LIBS -lopencore-amrwb"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for E_IF_init in -lvo-amrwbenc" >&5
$as_echo_n "checking for E_IF_init in -lvo-amrwbenc... " >&6; }
-if ${ac_cv_lib_vo_amrwbenc_E_IF_init+:} false; then :
+if test "${ac_cv_lib_vo_amrwbenc_E_IF_init+set}" = set; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -7541,7 +7601,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_vo_amrwbenc_E_IF_init" >&5
$as_echo "$ac_cv_lib_vo_amrwbenc_E_IF_init" >&6; }
-if test "x$ac_cv_lib_vo_amrwbenc_E_IF_init" = xyes; then :
+if test "x$ac_cv_lib_vo_amrwbenc_E_IF_init" = x""yes; then :
opencore_amrwb_enc_present=1 && LIBS="$LIBS -lvo-amrwbenc"
fi
@@ -7600,14 +7660,14 @@ $as_echo "Using SILK prefix... $with_silk" >&6; }
ac_fn_c_check_header_mongrel "$LINENO" "SKP_Silk_SDK_API.h" "ac_cv_header_SKP_Silk_SDK_API_h" "$ac_includes_default"
-if test "x$ac_cv_header_SKP_Silk_SDK_API_h" = xyes; then :
+if test "x$ac_cv_header_SKP_Silk_SDK_API_h" = x""yes; then :
silk_h_present=1
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SKP_Silk_SDK_get_version in -lSKP_SILK_SDK" >&5
$as_echo_n "checking for SKP_Silk_SDK_get_version in -lSKP_SILK_SDK... " >&6; }
-if ${ac_cv_lib_SKP_SILK_SDK_SKP_Silk_SDK_get_version+:} false; then :
+if test "${ac_cv_lib_SKP_SILK_SDK_SKP_Silk_SDK_get_version+set}" = set; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -7641,7 +7701,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SKP_SILK_SDK_SKP_Silk_SDK_get_version" >&5
$as_echo "$ac_cv_lib_SKP_SILK_SDK_SKP_Silk_SDK_get_version" >&6; }
-if test "x$ac_cv_lib_SKP_SILK_SDK_SKP_Silk_SDK_get_version" = xyes; then :
+if test "x$ac_cv_lib_SKP_SILK_SDK_SKP_Silk_SDK_get_version" = x""yes; then :
silk_present=1 && LIBS="$LIBS -lSKP_SILK_SDK"
fi
diff --git a/aconfigure.ac b/aconfigure.ac
index 8d77ffa3..20467f2c 100644
--- a/aconfigure.ac
+++ b/aconfigure.ac
@@ -528,6 +528,37 @@ AC_ARG_WITH(external-gsm,
)
+dnl # Use external SRTP installation
+AC_SUBST(ac_external_srtp,0)
+AC_ARG_WITH(external-srtp,
+ AC_HELP_STRING([--with-external-srtp],
+ [Use external SRTP development files, not the one in "third_party" directory. When this option is set, make sure that SRTP is accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths)]),
+ [
+ if test "x$with_external_srtp" != "xno"; then
+ # Test SRTP installation
+ AC_MSG_CHECKING([if external SRTP devkit is installed])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <srtp/srtp.h>
+ ]],
+ [srtp_init();])],
+ [AC_MSG_RESULT(yes!!)
+ ac_external_srtp="1"
+ ],
+ [AC_MSG_ERROR([Unable to use SRTP. If SRTP development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])])
+ fi
+ ]
+ )
+
+
+dnl # Resample implementation
+AC_SUBST(ac_pjmedia_resample,libresample)
+AC_ARG_ENABLE(resample,
+ AC_HELP_STRING([--disable-resample],
+ [Disable resampling implementations]),
+ [if test "$enable_resample" = "no"; then
+ [ac_pjmedia_resample=none]
+ AC_MSG_RESULT([Checking if resampling is disabled...yes])
+ fi]
+ )
dnl # Sound device backend selection
AC_SUBST(ac_pjmedia_snd)
@@ -831,8 +862,9 @@ AC_ARG_ENABLE(ilbc-codec,
dnl # Include libsamplerate
AC_ARG_ENABLE(libsamplerate,
AC_HELP_STRING([--enable-libsamplerate],
- [Link with libsamplerate when available. Note that PJMEDIA_RESAMPLE_IMP must also be configured]),
- [ AC_CHECK_LIB(samplerate,src_new) ],
+ [Link with libsamplerate when available.]),
+ [ AC_CHECK_LIB(samplerate,src_new) ]
+ [ac_pjmedia_resample=libsamplerate],
AC_MSG_RESULT([Skipping libsamplerate detection])
)
diff --git a/build.mak.in b/build.mak.in
index 477c1ece..3e5215e2 100644
--- a/build.mak.in
+++ b/build.mak.in
@@ -26,15 +26,28 @@ endif
# Determine which party libraries to use
export APP_THIRD_PARTY_EXT :=
export APP_THIRD_PARTY_LIBS :=
-export APP_THIRD_PARTY_LIB_FILES := $(PJ_DIR)/third_party/lib/libmilenage-$(LIB_SUFFIX) $(PJ_DIR)/third_party/lib/libsrtp-$(LIB_SUFFIX)
+export APP_THIRD_PARTY_LIB_FILES := $(PJ_DIR)/third_party/lib/libmilenage-$(LIB_SUFFIX)
ifeq ($(PJ_SHARED_LIBRARIES),)
-APP_THIRD_PARTY_LIBS += -lmilenage-$(TARGET_NAME) -lsrtp-$(TARGET_NAME)
+APP_THIRD_PARTY_LIBS += -lmilenage-$(TARGET_NAME)
else
-APP_THIRD_PARTY_LIBS += -lmilenage -lsrtp
-APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libmilenage.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libmilenage.$(SHLIB_SUFFIX) \
- $(PJ_DIR)/third_party/lib/libsrtp.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libsrtp.$(SHLIB_SUFFIX)
+APP_THIRD_PARTY_LIBS += -lmilenage
+APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libmilenage.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libmilenage.$(SHLIB_SUFFIX)
endif
+ifeq (@ac_external_srtp@,1)
+# External SRTP library
+APP_THIRD_PARTY_EXT += -lsrtp
+else
+APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libsrtp-$(LIB_SUFFIX)
+ifeq ($(PJ_SHARED_LIBRARIES),)
+APP_THIRD_PARTY_LIBS += -lsrtp-$(TARGET_NAME)
+else
+APP_THIRD_PARTY_LIBS += -lsrtp
+APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libsrtp.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libsrtp.$(SHLIB_SUFFIX)
+endif
+endif
+
+ifeq (@ac_pjmedia_resample@,libresample)
APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libresample-$(LIB_SUFFIX)
ifeq ($(PJ_SHARED_LIBRARIES),)
ifeq (@ac_resample_dll@,1)
@@ -48,6 +61,7 @@ else
APP_THIRD_PARTY_LIBS += -lresample
APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libresample.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libresample.$(SHLIB_SUFFIX)
endif
+endif
ifneq (@ac_no_gsm_codec@,1)
ifeq (@ac_external_gsm@,1)
diff --git a/pjmedia/build/Makefile b/pjmedia/build/Makefile
index e21e9c03..a567e63b 100644
--- a/pjmedia/build/Makefile
+++ b/pjmedia/build/Makefile
@@ -3,10 +3,6 @@ include ../../version.mak
THIRD_PARTY:=$(PJDIR)/third_party
-SRTP_INC=$(CC_INC)$(THIRD_PARTY)/build/srtp \
- $(CC_INC)$(THIRD_PARTY)/srtp/crypto/include \
- $(CC_INC)$(THIRD_PARTY)/srtp/include
-
include $(PJDIR)/build/common.mak
export LIBDIR := ../lib
@@ -48,8 +44,7 @@ export _CFLAGS := $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \
$(CC_INC)../../pjlib-util/include \
$(CC_INC)../../pjmedia/include \
$(CC_INC)../../pjnath/include \
- $(CC_INC)../.. \
- $(SRTP_INC)
+ $(CC_INC)../..
export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
$(HOST_CXXFLAGS) $(CXXFLAGS)
@@ -71,7 +66,7 @@ export PJMEDIA_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
event.o format.o ffmpeg_util.o \
g711.o jbuf.o master_port.o mem_capture.o mem_player.o \
null_port.o plc_common.o port.o splitcomb.o \
- resample_resample.o resample_libsamplerate.o \
+ resample_resample.o resample_libsamplerate.o resample_speex.o \
resample_port.o rtcp.o rtcp_xr.o rtp.o \
sdp.o sdp_cmp.o sdp_neg.o session.o silencedet.o \
sound_legacy.o sound_port.o stereo_port.o stream_common.o \
diff --git a/pjmedia/build/os-auto.mak.in b/pjmedia/build/os-auto.mak.in
index b0502f3b..f451331e 100644
--- a/pjmedia/build/os-auto.mak.in
+++ b/pjmedia/build/os-auto.mak.in
@@ -129,6 +129,42 @@ endif
#
+# SRTP
+#
+ifeq (@ac_external_srtp@,1)
+# External SRTP
+export CFLAGS += -DPJMEDIA_EXTERNAL_SRTP=1
+else
+# Our SRTP in third_party
+export CFLAGS += -I$(THIRD_PARTY)/build/srtp \
+ -I$(THIRD_PARTY)/srtp/crypto/include \
+ -I$(THIRD_PARTY)/srtp/include
+
+endif
+
+#
+# Resample
+#
+AC_PJMEDIA_RESAMPLE=@ac_pjmedia_resample@
+
+ifeq ($(AC_PJMEDIA_RESAMPLE),none)
+# No resample support
+export CFLAGS += -DPJMEDIA_RESAMPLE_IMP=PJMEDIA_RESAMPLE_NONE
+endif
+
+ifeq ($(AC_PJMEDIA_RESAMPLE),libresample)
+export CFLAGS += -DPJMEDIA_RESAMPLE_IMP=PJMEDIA_RESAMPLE_LIBRESAMPLE
+endif
+
+ifeq ($(AC_PJMEDIA_RESAMPLE),libsamplerate)
+export CFLAGS += -DPJMEDIA_RESAMPLE_IMP=PJMEDIA_RESAMPLE_LIBSAMPLERATE
+endif
+
+ifeq ($(AC_PJMEDIA_RESAMPLE),speex)
+export CFLAGS += -DPJMEDIA_RESAMPLE_IMP=PJMEDIA_RESAMPLE_SPEEX
+endif
+
+#
# PortAudio
#
ifneq ($(findstring pa,$(AC_PJMEDIA_SND)),)
diff --git a/pjmedia/build/os-darwinos.mak b/pjmedia/build/os-darwinos.mak
index 7904594e..3548c8ea 100644
--- a/pjmedia/build/os-darwinos.mak
+++ b/pjmedia/build/os-darwinos.mak
@@ -78,6 +78,42 @@ export CODEC_OBJS += g7221.o
export G7221_CFLAGS += -I$(THIRD_PARTY)
endif
+#
+# Resample
+#
+AC_PJMEDIA_RESAMPLE=libresample
+
+ifeq ($(AC_PJMEDIA_RESAMPLE),none)
+# No resample support
+export CFLAGS += -DPJMEDIA_RESAMPLE_IMP=PJMEDIA_RESAMPLE_NONE
+endif
+
+ifeq ($(AC_PJMEDIA_RESAMPLE),libresample)
+export CFLAGS += -DPJMEDIA_RESAMPLE_IMP=PJMEDIA_RESAMPLE_LIBRESAMPLE
+endif
+
+ifeq ($(AC_PJMEDIA_RESAMPLE),libsamplerate)
+export CFLAGS += -DPJMEDIA_RESAMPLE_IMP=PJMEDIA_RESAMPLE_LIBSAMPLERATE
+endif
+
+ifeq ($(AC_PJMEDIA_RESAMPLE),speex)
+export CFLAGS += -DPJMEDIA_RESAMPLE_IMP=PJMEDIA_RESAMPLE_SPEEX
+endif
+
+#
+# SRTP
+#
+#ifeq (@ac_external_srtp@,1)
+ifeq (0,1)
+# External SRTP
+export CFLAGS += -DPJMEDIA_EXTERNAL_SRTP=1
+else
+# Our SRTP in third_party
+export CFLAGS += -I$(THIRD_PARTY)/build/srtp \
+ -I$(THIRD_PARTY)/srtp/crypto/include \
+ -I$(THIRD_PARTY)/srtp/include
+
+endif
#
# PortAudio
diff --git a/pjmedia/build/os-linux.mak b/pjmedia/build/os-linux.mak
index 63910c4a..eb050911 100644
--- a/pjmedia/build/os-linux.mak
+++ b/pjmedia/build/os-linux.mak
@@ -72,6 +72,42 @@ export CODEC_OBJS += g7221.o
export G7221_CFLAGS += -I$(THIRD_PARTY)
endif
+#
+# Resample
+#
+AC_PJMEDIA_RESAMPLE=libresample
+
+ifeq ($(AC_PJMEDIA_RESAMPLE),none)
+# No resample support
+export CFLAGS += -DPJMEDIA_RESAMPLE_IMP=PJMEDIA_RESAMPLE_NONE
+endif
+
+ifeq ($(AC_PJMEDIA_RESAMPLE),libresample)
+export CFLAGS += -DPJMEDIA_RESAMPLE_IMP=PJMEDIA_RESAMPLE_LIBRESAMPLE
+endif
+
+ifeq ($(AC_PJMEDIA_RESAMPLE),libsamplerate)
+export CFLAGS += -DPJMEDIA_RESAMPLE_IMP=PJMEDIA_RESAMPLE_LIBSAMPLERATE
+endif
+
+ifeq ($(AC_PJMEDIA_RESAMPLE),speex)
+export CFLAGS += -DPJMEDIA_RESAMPLE_IMP=PJMEDIA_RESAMPLE_SPEEX
+endif
+
+#
+# SRTP
+#
+#ifeq (@ac_external_srtp@,1)
+ifeq (0,1)
+# External SRTP
+export CFLAGS += -DPJMEDIA_EXTERNAL_SRTP=1
+else
+# Our SRTP in third_party
+export CFLAGS += -I$(THIRD_PARTY)/build/srtp \
+ -I$(THIRD_PARTY)/srtp/crypto/include \
+ -I$(THIRD_PARTY)/srtp/include
+
+endif
#
# PortAudio
diff --git a/pjmedia/build/os-rtems.mak b/pjmedia/build/os-rtems.mak
index bbcfad4e..cf7440f8 100644
--- a/pjmedia/build/os-rtems.mak
+++ b/pjmedia/build/os-rtems.mak
@@ -6,3 +6,4 @@ export CFLAGS += -DPJMEDIA_SOUND_IMPLEMENTATION=PJMEDIA_SOUND_NULL_SOUND
export PJMEDIA_OBJS += nullsound.o
export SOUND_OBJS = $(NULLSOUND_OBJS)
+export CFLAGS += -DPJMEDIA_RESAMPLE_IMP=PJMEDIA_RESAMPLE_LIBRESAMPLE
diff --git a/pjmedia/build/os-win32.mak b/pjmedia/build/os-win32.mak
index 498a9e1a..b85183a7 100644
--- a/pjmedia/build/os-win32.mak
+++ b/pjmedia/build/os-win32.mak
@@ -74,6 +74,42 @@ export CODEC_OBJS += g7221.o
export G7221_CFLAGS += -I$(THIRD_PARTY)
endif
+#
+# Resample
+#
+AC_PJMEDIA_RESAMPLE=libresample
+
+ifeq ($(AC_PJMEDIA_RESAMPLE),none)
+# No resample support
+export CFLAGS += -DPJMEDIA_RESAMPLE_IMP=PJMEDIA_RESAMPLE_NONE
+endif
+
+ifeq ($(AC_PJMEDIA_RESAMPLE),libresample)
+export CFLAGS += -DPJMEDIA_RESAMPLE_IMP=PJMEDIA_RESAMPLE_LIBRESAMPLE
+endif
+
+ifeq ($(AC_PJMEDIA_RESAMPLE),libsamplerate)
+export CFLAGS += -DPJMEDIA_RESAMPLE_IMP=PJMEDIA_RESAMPLE_LIBSAMPLERATE
+endif
+
+ifeq ($(AC_PJMEDIA_RESAMPLE),speex)
+export CFLAGS += -DPJMEDIA_RESAMPLE_IMP=PJMEDIA_RESAMPLE_SPEEX
+endif
+
+#
+# SRTP
+#
+#ifeq (@ac_external_srtp@,1)
+ifeq (0,1)
+# External SRTP
+export CFLAGS += -DPJMEDIA_EXTERNAL_SRTP=1
+else
+# Our SRTP in third_party
+export CFLAGS += -I$(THIRD_PARTY)/build/srtp \
+ -I$(THIRD_PARTY)/srtp/crypto/include \
+ -I$(THIRD_PARTY)/srtp/include
+
+endif
#
# PortAudio
diff --git a/pjmedia/include/pjmedia/config.h b/pjmedia/include/pjmedia/config.h
index 9eec63e8..24fd5a99 100644
--- a/pjmedia/include/pjmedia/config.h
+++ b/pjmedia/include/pjmedia/config.h
@@ -914,6 +914,19 @@
/**
+ * Let the library handle libsrtp initialization and deinitialization.
+ * Application may want to disable this and manually perform libsrtp
+ * initialization and deinitialization when it needs to use libsrtp
+ * before the library is initialized or after the library is shutdown.
+ *
+ * By default it is enabled.
+ */
+#ifndef PJMEDIA_LIBSRTP_AUTO_INIT_DEINIT
+# define PJMEDIA_LIBSRTP_AUTO_INIT_DEINIT 1
+#endif
+
+
+/**
* Enable support to handle codecs with inconsistent clock rate
* between clock rate in SDP/RTP & the clock rate that is actually used.
* This happens for example with G.722 and MPEG audio codecs.
diff --git a/pjmedia/src/pjmedia/transport_srtp.c b/pjmedia/src/pjmedia/transport_srtp.c
index 85b43282..2e76c506 100644
--- a/pjmedia/src/pjmedia/transport_srtp.c
+++ b/pjmedia/src/pjmedia/transport_srtp.c
@@ -30,7 +30,11 @@
#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
-#include <srtp.h>
+#if defined(PJMEDIA_EXTERNAL_SRTP) && (PJMEDIA_EXTERNAL_SRTP != 0)
+# include <srtp/srtp.h>
+#else
+# include <srtp.h>
+#endif
#define THIS_FILE "transport_srtp.c"
@@ -276,6 +280,7 @@ static void pjmedia_srtp_deinit_lib(pjmedia_endpt *endpt);
PJ_DEF(pj_status_t) pjmedia_srtp_init_lib(pjmedia_endpt *endpt)
{
+#if PJMEDIA_LIBSRTP_AUTO_INIT_DEINIT
if (libsrtp_initialized == PJ_FALSE) {
err_status_t err;
@@ -298,6 +303,9 @@ PJ_DEF(pj_status_t) pjmedia_srtp_init_lib(pjmedia_endpt *endpt)
libsrtp_initialized = PJ_TRUE;
}
+#else
+ PJ_UNUSED_ARG(endpt);
+#endif
return PJ_SUCCESS;
}
diff --git a/third_party/build/Makefile b/third_party/build/Makefile
index 36d80612..e1cb0da2 100644
--- a/third_party/build/Makefile
+++ b/third_party/build/Makefile
@@ -1,4 +1,4 @@
-DIRS = resample milenage srtp
+DIRS = milenage
include ../../build.mak
include $(PJDIR)/build/common.mak
diff --git a/third_party/build/os-auto.mak.in b/third_party/build/os-auto.mak.in
index f1de03f8..8be95970 100644
--- a/third_party/build/os-auto.mak.in
+++ b/third_party/build/os-auto.mak.in
@@ -31,3 +31,12 @@ DIRS += portaudio
endif
endif
+ifeq (@ac_external_srtp@,1)
+# External SRTP
+else
+DIRS += srtp
+endif
+
+ifeq (@ac_pjmedia_resample@,libresample)
+DIRS += resample
+endif
diff --git a/third_party/build/os-darwinos.mak b/third_party/build/os-darwinos.mak
index a9c740f7..6a53b712 100644
--- a/third_party/build/os-darwinos.mak
+++ b/third_party/build/os-darwinos.mak
@@ -3,5 +3,7 @@ DIRS += ilbc
DIRS += speex
DIRS += portaudio
DIRS += g7221
+DIRS += srtp
+DIRS += resample
diff --git a/third_party/build/os-linux.mak b/third_party/build/os-linux.mak
index a9c740f7..6a53b712 100644
--- a/third_party/build/os-linux.mak
+++ b/third_party/build/os-linux.mak
@@ -3,5 +3,7 @@ DIRS += ilbc
DIRS += speex
DIRS += portaudio
DIRS += g7221
+DIRS += srtp
+DIRS += resample
diff --git a/third_party/build/os-win32.mak b/third_party/build/os-win32.mak
index a9c740f7..6a53b712 100644
--- a/third_party/build/os-win32.mak
+++ b/third_party/build/os-win32.mak
@@ -3,5 +3,7 @@ DIRS += ilbc
DIRS += speex
DIRS += portaudio
DIRS += g7221
+DIRS += srtp
+DIRS += resample