diff --git a/libs/jrtplib/Makefile.am b/libs/jrtplib/Makefile.am index 287ef418d1..e00a1777e0 100644 --- a/libs/jrtplib/Makefile.am +++ b/libs/jrtplib/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = src tools doc pkgconfig +SUBDIRS = src EXTRA_DIST = LICENSE.MIT ChangeLog README.TXT jrtplib.dsw jrtplib.dsp jrtplib.vcproj \ jrtplib.sln jrtplib_wce.vcproj jrtplib_wce.sln diff --git a/libs/jrtplib/Makefile.in b/libs/jrtplib/Makefile.in index 506efe711a..115aa364c1 100644 --- a/libs/jrtplib/Makefile.in +++ b/libs/jrtplib/Makefile.in @@ -124,6 +124,7 @@ RANLIB = @RANLIB@ RTP_ENDIAN = @RTP_ENDIAN@ RTP_FILIO = @RTP_FILIO@ RTP_HAVE_SOCKADDR_LEN = @RTP_HAVE_SOCKADDR_LEN@ +RTP_JTHREADINCLUDES = @RTP_JTHREADINCLUDES@ RTP_LINKLIBS = @RTP_LINKLIBS@ RTP_SOCKIO = @RTP_SOCKIO@ RTP_SOCKLENTYPE_UINT = @RTP_SOCKLENTYPE_UINT@ @@ -185,7 +186,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -SUBDIRS = src tools doc pkgconfig +SUBDIRS = src EXTRA_DIST = LICENSE.MIT ChangeLog README.TXT jrtplib.dsw jrtplib.dsp jrtplib.vcproj \ jrtplib.sln jrtplib_wce.vcproj jrtplib_wce.sln diff --git a/libs/jrtplib/configure b/libs/jrtplib/configure index a2fc1198fe..b5ccc1cf89 100755 --- a/libs/jrtplib/configure +++ b/libs/jrtplib/configure @@ -463,7 +463,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL RTP_FILIO RTP_SOCKIO RTP_ENDIAN RTP_SOCKLENTYPE_UINT RTP_HAVE_SOCKADDR_LEN RTP_SUPPORT_IPV4MULTICAST RTP_SUPPORT_THREAD RTP_SUPPORT_SDESPRIV RTP_SUPPORT_INLINETEMPLATEPARAM RTP_SUPPORT_PROBATION RTP_SUPPORT_GNUDRAND RTP_SUPPORT_RANDR RTP_SUPPORT_GETLOGINR RTP_SUPPORT_IPV6 RTP_SUPPORT_IPV6MULTICAST RTP_SUPPORT_IFADDRS RTP_LINKLIBS LIBOBJS LTLIBOBJS IS64BITLINUX_TRUE IS64BITLINUX_FALSE' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL IS64BITLINUX_TRUE IS64BITLINUX_FALSE RTP_FILIO RTP_SOCKIO RTP_ENDIAN RTP_SOCKLENTYPE_UINT RTP_JTHREADINCLUDES RTP_HAVE_SOCKADDR_LEN RTP_SUPPORT_IPV4MULTICAST RTP_SUPPORT_THREAD RTP_SUPPORT_SDESPRIV RTP_SUPPORT_INLINETEMPLATEPARAM RTP_SUPPORT_PROBATION RTP_SUPPORT_GNUDRAND RTP_SUPPORT_RANDR RTP_SUPPORT_GETLOGINR RTP_SUPPORT_IPV6 RTP_SUPPORT_IPV6MULTICAST RTP_SUPPORT_IFADDRS RTP_LINKLIBS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1034,6 +1034,7 @@ Optional Features: --disable-libtool-lock avoid locking (might break parallel builds) --disable-sdespriv Disable support for SDES PRIV items --disable-probation Disable support for probation of a new source + --disable-jthread Disable support for JThread --disable-IPv6 Disable support for IPv6 Optional Packages: @@ -1044,6 +1045,7 @@ Optional Packages: both] --with-tags[=TAGS] include additional configurations [automatic] + --with-jthread-includes Directory where JThread include files are located Some influential environment variables: CC C compiler command @@ -3674,7 +3676,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3677 "configure"' > conftest.$ac_ext + echo '#line 3679 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5253,7 +5255,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5256:" \ +echo "$as_me:5258:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6351,11 +6353,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6354: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6356: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6358: \$? = $ac_status" >&5 + echo "$as_me:6360: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -6613,11 +6615,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6616: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6618: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6620: \$? = $ac_status" >&5 + echo "$as_me:6622: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -6675,11 +6677,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6678: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6680: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6682: \$? = $ac_status" >&5 + echo "$as_me:6684: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8923,7 +8925,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:11281: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11283: \$? = $ac_status" >&5 + echo "$as_me:11285: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -11338,11 +11340,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11341: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11343: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11345: \$? = $ac_status" >&5 + echo "$as_me:11347: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12715,7 +12717,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13703: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13705: \$? = $ac_status" >&5 + echo "$as_me:13707: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13760,11 +13762,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13763: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13765: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13767: \$? = $ac_status" >&5 + echo "$as_me:13769: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15890,11 +15892,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15893: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15895: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15897: \$? = $ac_status" >&5 + echo "$as_me:15899: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16152,11 +16154,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16155: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16157: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16159: \$? = $ac_status" >&5 + echo "$as_me:16161: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16214,11 +16216,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16217: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16219: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16221: \$? = $ac_status" >&5 + echo "$as_me:16223: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -18462,7 +18464,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5 +echo $ECHO_N "checking for JThread include files... $ECHO_C" >&6 + +# Check whether --with-jthread-includes or --without-jthread-includes was given. +if test "${with_jthread_includes+set}" = set; then + withval="$with_jthread_includes" + + if test -e "$withval"/jthread.h && test -e "$withval"/jmutex.h ; then + echo "$as_me:$LINENO: result: in \"$withval\"" >&5 +echo "${ECHO_T}in \"$withval\"" >&6 + echo "$as_me:$LINENO: checking JThread version" >&5 +echo $ECHO_N "checking JThread version... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + + #include "$withval/jthread.h" + class MyThread : public JThread + { + public: + void *Thread() { JThread::ThreadStarted(); return 0; } + }; +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + RTP_JTHREADINCLUDES="-I $withval" + RTP_SUPPORT_THREAD="#define RTP_SUPPORT_THREAD" + RTP_LINKLIBS="$RTP_LINKLIBS -ljthread -lpthread" + echo "$as_me:$LINENO: result: >= 1.1.0" >&5 +echo "${ECHO_T}>= 1.1.0" >&6 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + echo "$as_me:$LINENO: result: < 1.1.0" >&5 +echo "${ECHO_T}< 1.1.0" >&6 + { echo "$as_me:$LINENO: WARNING: You need at least JThread version 1.1.0. Support for JThread has been disabled" >&5 +echo "$as_me: WARNING: You need at least JThread version 1.1.0. Support for JThread has been disabled" >&2;} +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + else + echo "$as_me:$LINENO: result: not found" >&5 +echo "${ECHO_T}not found" >&6 + { echo "$as_me:$LINENO: WARNING: The JThread include files were not found in $withval. Support for JThread has been disabled" >&5 +echo "$as_me: WARNING: The JThread include files were not found in $withval. Support for JThread has been disabled" >&2;} + fi + +else + + for i in $searchdirs ; do + if test -e $i/jthread.h && test -e $i/jmutex.h ; then + RTP_JTHREADINCLUDEDIR="$i" + echo "$as_me:$LINENO: result: $i" >&5 +echo "${ECHO_T}$i" >&6 + break + fi + done + if test "BLAAI$RTP_JTHREADINCLUDEDIR" = "BLAAI" ; then + echo "$as_me:$LINENO: result: not found" >&5 +echo "${ECHO_T}not found" >&6 + { echo "$as_me:$LINENO: WARNING: Unable to locate the JThread include files. Please specify the include path with --with-jthread-includes if they exist on your system. JThread support has been disabled" >&5 +echo "$as_me: WARNING: Unable to locate the JThread include files. Please specify the include path with --with-jthread-includes if they exist on your system. JThread support has been disabled" >&2;} + else + echo "$as_me:$LINENO: checking JThread version" >&5 +echo $ECHO_N "checking JThread version... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + + #include "$RTP_JTHREADINCLUDEDIR/jthread.h" + class MyThread : public JThread + { + public: + void *Thread() { JThread::ThreadStarted(); return 0; } + }; +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + RTP_JTHREADINCLUDES="-I $RTP_JTHREADINCLUDEDIR" + RTP_SUPPORT_THREAD="#define RTP_SUPPORT_THREAD" + RTP_LINKLIBS="$RTP_LINKLIBS -ljthread -lpthread" + echo "$as_me:$LINENO: result: >= 1.1.0" >&5 +echo "${ECHO_T}>= 1.1.0" >&6 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + echo "$as_me:$LINENO: result: < 1.1.0" >&5 +echo "${ECHO_T}< 1.1.0" >&6 + { echo "$as_me:$LINENO: WARNING: You need at least JThread version 1.1.0. Support for JThread has been disabled" >&5 +echo "$as_me: WARNING: You need at least JThread version 1.1.0. Support for JThread has been disabled" >&2;} +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +fi; +fi @@ -21048,6 +21203,13 @@ fi +if test `uname -m` = x86_64; then + IS64BITLINUX_TRUE= + IS64BITLINUX_FALSE='#' +else + IS64BITLINUX_TRUE='#' + IS64BITLINUX_FALSE= +fi @@ -21064,7 +21226,11 @@ fi - ac_config_files="$ac_config_files Makefile src/Makefile src/rtpconfig_unix.h doc/Makefile tools/Makefile pkgconfig/Makefile pkgconfig/jrtplib.pc pkgconfig/jrtplib-uninstalled.pc" + + + + + ac_config_files="$ac_config_files Makefile src/Makefile src/rtpconfig_unix.h doc/Makefile tools/Makefile examples/Makefile pkgconfig/Makefile pkgconfig/jrtplib.pc pkgconfig/jrtplib-uninstalled.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -21208,6 +21374,13 @@ echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${IS64BITLINUX_TRUE}" && test -z "${IS64BITLINUX_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"IS64BITLINUX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"IS64BITLINUX\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files @@ -21652,6 +21825,7 @@ do "src/rtpconfig_unix.h" ) CONFIG_FILES="$CONFIG_FILES src/rtpconfig_unix.h" ;; "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "tools/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;; + "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; "pkgconfig/Makefile" ) CONFIG_FILES="$CONFIG_FILES pkgconfig/Makefile" ;; "pkgconfig/jrtplib.pc" ) CONFIG_FILES="$CONFIG_FILES pkgconfig/jrtplib.pc" ;; "pkgconfig/jrtplib-uninstalled.pc" ) CONFIG_FILES="$CONFIG_FILES pkgconfig/jrtplib-uninstalled.pc" ;; @@ -21805,10 +21979,13 @@ s,@F77@,$F77,;t t s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t +s,@IS64BITLINUX_TRUE@,$IS64BITLINUX_TRUE,;t t +s,@IS64BITLINUX_FALSE@,$IS64BITLINUX_FALSE,;t t s,@RTP_FILIO@,$RTP_FILIO,;t t s,@RTP_SOCKIO@,$RTP_SOCKIO,;t t s,@RTP_ENDIAN@,$RTP_ENDIAN,;t t s,@RTP_SOCKLENTYPE_UINT@,$RTP_SOCKLENTYPE_UINT,;t t +s,@RTP_JTHREADINCLUDES@,$RTP_JTHREADINCLUDES,;t t s,@RTP_HAVE_SOCKADDR_LEN@,$RTP_HAVE_SOCKADDR_LEN,;t t s,@RTP_SUPPORT_IPV4MULTICAST@,$RTP_SUPPORT_IPV4MULTICAST,;t t s,@RTP_SUPPORT_THREAD@,$RTP_SUPPORT_THREAD,;t t @@ -22296,13 +22473,3 @@ fi - - -if test `uname -m` = x86_64; then - IS64BITLINUX_TRUE= - IS64BITLINUX_FALSE='#' -else - IS64BITLINUX_TRUE='#' - IS64BITLINUX_FALSE= -fi - diff --git a/libs/jrtplib/configure.in b/libs/jrtplib/configure.in index 95a58095ab..5e2dbe944f 100644 --- a/libs/jrtplib/configure.in +++ b/libs/jrtplib/configure.in @@ -69,8 +69,71 @@ dnl --------------------------------------------------------------------------- dnl Check for the jthread headers dnl --------------------------------------------------------------------------- -RTP_SUPPORT_THREAD="#define RTP_SUPPORT_THREAD" -RTP_LINKLIBS="$RTP_LINKLIBS -lpthread" +AC_ARG_ENABLE(jthread,[ --disable-jthread Disable support for JThread],[ + if test "$enableval" = yes ; then + checkjthread="yes" + else + checkjthread="no" + fi],[ + checkjthread="yes" + ]) + +if test "$checkjthread" = "yes" ; then + searchdirs="/usr/include/jthread /usr/local/include/jthread" + + AC_MSG_CHECKING(for JThread include files) + AC_ARG_WITH(jthread-includes,[ --with-jthread-includes Directory where JThread include files are located], + [ + if test -e "$withval"/jthread.h && test -e "$withval"/jmutex.h ; then + AC_MSG_RESULT(in "$withval") + AC_MSG_CHECKING(JThread version) + AC_COMPILE_IFELSE([ + #include "$withval/jthread.h" + class MyThread : public JThread + { + public: + void *Thread() { JThread::ThreadStarted(); return 0; } + };],[ + RTP_JTHREADINCLUDES="-I $withval" + RTP_SUPPORT_THREAD="#define RTP_SUPPORT_THREAD" + RTP_LINKLIBS="$RTP_LINKLIBS -ljthread -lpthread" + AC_MSG_RESULT(>= 1.1.0) ],[ + AC_MSG_RESULT(< 1.1.0) + AC_MSG_WARN(You need at least JThread version 1.1.0. Support for JThread has been disabled)]) + else + AC_MSG_RESULT(not found) + AC_MSG_WARN(The JThread include files were not found in $withval. Support for JThread has been disabled) + fi + ], + [ + for i in $searchdirs ; do + if test -e $i/jthread.h && test -e $i/jmutex.h ; then + RTP_JTHREADINCLUDEDIR="$i" + AC_MSG_RESULT($i) + break + fi + done + if test "BLAAI$RTP_JTHREADINCLUDEDIR" = "BLAAI" ; then + AC_MSG_RESULT(not found) + AC_MSG_WARN(Unable to locate the JThread include files. Please specify the include path with --with-jthread-includes if they exist on your system. JThread support has been disabled) + else + AC_MSG_CHECKING(JThread version) + AC_COMPILE_IFELSE([ + #include "$RTP_JTHREADINCLUDEDIR/jthread.h" + class MyThread : public JThread + { + public: + void *Thread() { JThread::ThreadStarted(); return 0; } + };],[ + RTP_JTHREADINCLUDES="-I $RTP_JTHREADINCLUDEDIR" + RTP_SUPPORT_THREAD="#define RTP_SUPPORT_THREAD" + RTP_LINKLIBS="$RTP_LINKLIBS -ljthread -lpthread" + AC_MSG_RESULT(>= 1.1.0) ],[ + AC_MSG_RESULT(< 1.1.0) + AC_MSG_WARN(You need at least JThread version 1.1.0. Support for JThread has been disabled)]) + fi + ]) +fi dnl --------------------------------------------------------------------------- dnl Check if sys/filio.h exists (used on solaris) @@ -360,11 +423,13 @@ AC_CHECK_HEADER(ifaddrs.h,[RTP_SUPPORT_IFADDRS="#define RTP_SUPPORT_IFADDRS"]) dnl --------------------------------------------------------------------------- dnl Finish up... dnl --------------------------------------------------------------------------- +AM_CONDITIONAL(IS64BITLINUX, [test `uname -m` = x86_64]) AC_SUBST(RTP_FILIO) AC_SUBST(RTP_SOCKIO) AC_SUBST(RTP_ENDIAN) AC_SUBST(RTP_SOCKLENTYPE_UINT) +AC_SUBST(RTP_JTHREADINCLUDES) AC_SUBST(RTP_HAVE_SOCKADDR_LEN) AC_SUBST(RTP_SUPPORT_IPV4MULTICAST) AC_SUBST(RTP_SUPPORT_THREAD) @@ -383,10 +448,10 @@ AC_OUTPUT(Makefile \ src/rtpconfig_unix.h \ doc/Makefile \ tools/Makefile \ + examples/Makefile \ pkgconfig/Makefile \ pkgconfig/jrtplib.pc \ pkgconfig/jrtplib-uninstalled.pc \ ) -AM_CONDITIONAL(IS64BITLINUX, [test `uname -m` = x86_64]) diff --git a/libs/jrtplib/doc/Makefile.in b/libs/jrtplib/doc/Makefile.in index 2a4f045d8c..52b5f20fd4 100644 --- a/libs/jrtplib/doc/Makefile.in +++ b/libs/jrtplib/doc/Makefile.in @@ -100,6 +100,7 @@ RANLIB = @RANLIB@ RTP_ENDIAN = @RTP_ENDIAN@ RTP_FILIO = @RTP_FILIO@ RTP_HAVE_SOCKADDR_LEN = @RTP_HAVE_SOCKADDR_LEN@ +RTP_JTHREADINCLUDES = @RTP_JTHREADINCLUDES@ RTP_LINKLIBS = @RTP_LINKLIBS@ RTP_SOCKIO = @RTP_SOCKIO@ RTP_SOCKLENTYPE_UINT = @RTP_SOCKLENTYPE_UINT@ diff --git a/libs/jrtplib/examples/Makefile b/libs/jrtplib/examples/Makefile index f1833aee40..875535c2d0 100644 --- a/libs/jrtplib/examples/Makefile +++ b/libs/jrtplib/examples/Makefile @@ -81,14 +81,14 @@ DIST_SOURCES = $(example1_SOURCES) $(example2_SOURCES) \ ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /nfs/temp/jrtplib/missing --run aclocal-1.9 +ACLOCAL = ${SHELL} /usr/src/freeswitch.trunk/libs/jrtplib/missing --run aclocal-1.9 AMDEP_FALSE = # AMDEP_TRUE = -AMTAR = ${SHELL} /nfs/temp/jrtplib/missing --run tar +AMTAR = ${SHELL} /usr/src/freeswitch.trunk/libs/jrtplib/missing --run tar AR = ar -AUTOCONF = ${SHELL} /nfs/temp/jrtplib/missing --run autoconf -AUTOHEADER = ${SHELL} /nfs/temp/jrtplib/missing --run autoheader -AUTOMAKE = ${SHELL} /nfs/temp/jrtplib/missing --run automake-1.9 +AUTOCONF = ${SHELL} /usr/src/freeswitch.trunk/libs/jrtplib/missing --run autoconf +AUTOHEADER = ${SHELL} /usr/src/freeswitch.trunk/libs/jrtplib/missing --run autoheader +AUTOMAKE = ${SHELL} /usr/src/freeswitch.trunk/libs/jrtplib/missing --run automake-1.9 AWK = gawk CC = gcc CCDEPMODE = depmode=gcc3 @@ -98,9 +98,9 @@ CPPFLAGS = CXX = g++ CXXCPP = g++ -E CXXDEPMODE = depmode=gcc3 -CXXFLAGS = -O2 +CXXFLAGS = -g CYGPATH_W = echo -DEFS = -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"jrtplib\" -DVERSION=\"3.3.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 +DEFS = -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"jrtplib\" -DVERSION=\"3.5.2\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 DEPDIR = .deps ECHO = echo ECHO_C = @@ -110,21 +110,19 @@ EGREP = grep -E EXEEXT = F77 = FFLAGS = -GST_CFLAGS = -GST_LIBS = -GST_PLUGINS_BASE_CFLAGS = -GST_PLUGINS_BASE_LIBS = INSTALL_DATA = ${INSTALL} -m 644 INSTALL_PROGRAM = ${INSTALL} INSTALL_SCRIPT = ${INSTALL} INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s +IS64BITLINUX_FALSE = +IS64BITLINUX_TRUE = # LDFLAGS = LIBOBJS = LIBS = LIBTOOL = $(SHELL) $(top_builddir)/libtool LN_S = ln -s LTLIBOBJS = -MAKEINFO = ${SHELL} /nfs/temp/jrtplib/missing --run makeinfo +MAKEINFO = ${SHELL} /usr/src/freeswitch.trunk/libs/jrtplib/missing --run makeinfo OBJEXT = o PACKAGE = jrtplib PACKAGE_BUGREPORT = @@ -133,38 +131,35 @@ PACKAGE_STRING = PACKAGE_TARNAME = PACKAGE_VERSION = PATH_SEPARATOR = : -PKG_CONFIG = /usr/bin/pkg-config RANLIB = ranlib RTP_ENDIAN = // Little endian system RTP_FILIO = // Don't have -RTP_GSTINCLUDES = RTP_HAVE_SOCKADDR_LEN = // No sa_len member in struct sockaddr -RTP_LINKLIBS = -lpthread +RTP_JTHREADINCLUDES = +RTP_LINKLIBS = RTP_SOCKIO = // Don't have RTP_SOCKLENTYPE_UINT = #define RTP_SOCKLENTYPE_UINT RTP_SUPPORT_GETLOGINR = #define RTP_SUPPORT_GETLOGINR RTP_SUPPORT_GNUDRAND = #define RTP_SUPPORT_GNUDRAND -RTP_SUPPORT_GST = // No GStreamer support RTP_SUPPORT_IFADDRS = #define RTP_SUPPORT_IFADDRS -RTP_SUPPORT_INLINETEMPLATEPARAM = #define RTP_SUPPORT_INLINETEMPLATEPARAM +RTP_SUPPORT_INLINETEMPLATEPARAM = RTP_SUPPORT_IPV4MULTICAST = #define RTP_SUPPORT_IPV4MULTICAST RTP_SUPPORT_IPV6 = // No IPv6 support RTP_SUPPORT_IPV6MULTICAST = // No IPv6 multicasting support RTP_SUPPORT_PROBATION = #define RTP_SUPPORT_PROBATION RTP_SUPPORT_RANDR = // Not using rand_r RTP_SUPPORT_SDESPRIV = #define RTP_SUPPORT_SDESPRIV -RTP_SUPPORT_THREAD = #define RTP_SUPPORT_THREAD +RTP_SUPPORT_THREAD = // No support for jthread SET_MAKE = SHELL = /bin/sh STRIP = strip -VERSION = 3.3.0 +VERSION = 3.5.2 ac_ct_AR = ar ac_ct_CC = gcc ac_ct_CXX = g++ ac_ct_F77 = ac_ct_RANLIB = ranlib ac_ct_STRIP = strip -ac_pt_PKG_CONFIG = /usr/bin/pkg-config am__fastdepCC_FALSE = # am__fastdepCC_TRUE = am__fastdepCXX_FALSE = # @@ -189,14 +184,14 @@ host_os = linux-gnu host_vendor = pc includedir = ${prefix}/include infodir = ${prefix}/info -install_sh = /nfs/temp/jrtplib/install-sh +install_sh = /usr/src/freeswitch.trunk/libs/jrtplib/install-sh libdir = ${exec_prefix}/lib libexecdir = ${exec_prefix}/libexec localstatedir = ${prefix}/var mandir = ${prefix}/man mkdir_p = mkdir -p -- oldincludedir = /usr/include -prefix = /usr/local +prefix = /usr/local/freeswitch program_transform_name = s,x,x, sbindir = ${exec_prefix}/sbin sharedstatedir = ${prefix}/com @@ -206,8 +201,8 @@ example1_SOURCES = example1.cpp example2_SOURCES = example2.cpp example3_SOURCES = example3.cpp example4_SOURCES = example4.cpp -INCLUDES = @RTP_JTHREADINCLUDES@ -I ../src/ -LDADD = ../src/.libs/libjrtp.a -lpthread +INCLUDES = -I ../src/ +LDADD = ../src/.libs/libjrtp.a all: all-am .SUFFIXES: diff --git a/libs/jrtplib/examples/Makefile.in b/libs/jrtplib/examples/Makefile.in index c897a5f011..4551eff063 100644 --- a/libs/jrtplib/examples/Makefile.in +++ b/libs/jrtplib/examples/Makefile.in @@ -114,6 +114,8 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IS64BITLINUX_FALSE = @IS64BITLINUX_FALSE@ +IS64BITLINUX_TRUE = @IS64BITLINUX_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ @@ -133,6 +135,7 @@ RANLIB = @RANLIB@ RTP_ENDIAN = @RTP_ENDIAN@ RTP_FILIO = @RTP_FILIO@ RTP_HAVE_SOCKADDR_LEN = @RTP_HAVE_SOCKADDR_LEN@ +RTP_JTHREADINCLUDES = @RTP_JTHREADINCLUDES@ RTP_LINKLIBS = @RTP_LINKLIBS@ RTP_SOCKIO = @RTP_SOCKIO@ RTP_SOCKLENTYPE_UINT = @RTP_SOCKLENTYPE_UINT@ @@ -157,7 +160,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ diff --git a/libs/jrtplib/pkgconfig/Makefile.in b/libs/jrtplib/pkgconfig/Makefile.in index 56835cbdd0..73d4df8c8a 100644 --- a/libs/jrtplib/pkgconfig/Makefile.in +++ b/libs/jrtplib/pkgconfig/Makefile.in @@ -111,6 +111,7 @@ RANLIB = @RANLIB@ RTP_ENDIAN = @RTP_ENDIAN@ RTP_FILIO = @RTP_FILIO@ RTP_HAVE_SOCKADDR_LEN = @RTP_HAVE_SOCKADDR_LEN@ +RTP_JTHREADINCLUDES = @RTP_JTHREADINCLUDES@ RTP_LINKLIBS = @RTP_LINKLIBS@ RTP_SOCKIO = @RTP_SOCKIO@ RTP_SOCKLENTYPE_UINT = @RTP_SOCKLENTYPE_UINT@ diff --git a/libs/jrtplib/src/Makefile.am b/libs/jrtplib/src/Makefile.am index 5341d41855..a40bf0d3f6 100644 --- a/libs/jrtplib/src/Makefile.am +++ b/libs/jrtplib/src/Makefile.am @@ -13,8 +13,7 @@ libjrtp_la_SOURCES = rtpdebug.cpp rtpsession.cpp rtpconfig_win.h \ rtprandom.cpp rtcpscheduler.cpp \ rtcppacketbuilder.cpp rtpsessionsources.cpp \ rtpcollisionlist.cpp rtpipv6address.cpp \ - rtpudpv6transmitter.cpp rtptimeutilities.cpp \ - pthread/jmutex.cpp pthread/jthread.cpp + rtpudpv6transmitter.cpp rtptimeutilities.cpp libjrtp_la_LDFLAGS = -release 3.5.2 @RTP_LINKLIBS@ libjrtpinclude_HEADERS = rtcpapppacket.h rtcpbyepacket.h rtcpcompoundpacket.h \ rtcpcompoundpacketbuilder.h rtcppacket.h rtcppacketbuilder.h \ @@ -29,8 +28,8 @@ libjrtpinclude_HEADERS = rtcpapppacket.h rtcpbyepacket.h rtcpcompoundpacket.h \ rtptypes_win.h rtpudpv4transmitter.h rtpsessionsources.h \ rtpcollisionlist.h rtpipv6address.h rtpipv6destination.h \ rtpudpv6transmitter.h rtptypes.h rtptypes_unix.h \ - jmutex.h jthread.h jrtp4c.h jmutexautolock.h -EXTRA_DIST = rtpconfig_unix.h.in win32/jthread.cpp win32/jmutex.cpp + jrtp4c.h +EXTRA_DIST = rtpconfig_unix.h.in libjrtpincludedir = ${includedir}/jrtplib3 diff --git a/libs/jrtplib/src/Makefile.in b/libs/jrtplib/src/Makefile.in index f55c3099bb..4ff01378a0 100644 --- a/libs/jrtplib/src/Makefile.in +++ b/libs/jrtplib/src/Makefile.in @@ -67,7 +67,7 @@ am_libjrtp_la_OBJECTS = rtpdebug.lo rtpsession.lo rtperrors.lo \ rtcppacket.lo rtcpcompoundpacketbuilder.lo rtprandom.lo \ rtcpscheduler.lo rtcppacketbuilder.lo rtpsessionsources.lo \ rtpcollisionlist.lo rtpipv6address.lo rtpudpv6transmitter.lo \ - rtptimeutilities.lo jmutex.lo jthread.lo + rtptimeutilities.lo libjrtp_la_OBJECTS = $(am_libjrtp_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) depcomp = $(SHELL) $(top_srcdir)/depcomp @@ -149,6 +149,7 @@ RANLIB = @RANLIB@ RTP_ENDIAN = @RTP_ENDIAN@ RTP_FILIO = @RTP_FILIO@ RTP_HAVE_SOCKADDR_LEN = @RTP_HAVE_SOCKADDR_LEN@ +RTP_JTHREADINCLUDES = @RTP_JTHREADINCLUDES@ RTP_LINKLIBS = @RTP_LINKLIBS@ RTP_SOCKIO = @RTP_SOCKIO@ RTP_SOCKLENTYPE_UINT = @RTP_SOCKLENTYPE_UINT@ @@ -225,8 +226,7 @@ libjrtp_la_SOURCES = rtpdebug.cpp rtpsession.cpp rtpconfig_win.h \ rtprandom.cpp rtcpscheduler.cpp \ rtcppacketbuilder.cpp rtpsessionsources.cpp \ rtpcollisionlist.cpp rtpipv6address.cpp \ - rtpudpv6transmitter.cpp rtptimeutilities.cpp \ - pthread/jmutex.cpp pthread/jthread.cpp + rtpudpv6transmitter.cpp rtptimeutilities.cpp libjrtp_la_LDFLAGS = -release 3.5.2 @RTP_LINKLIBS@ libjrtpinclude_HEADERS = rtcpapppacket.h rtcpbyepacket.h rtcpcompoundpacket.h \ @@ -242,9 +242,9 @@ libjrtpinclude_HEADERS = rtcpapppacket.h rtcpbyepacket.h rtcpcompoundpacket.h \ rtptypes_win.h rtpudpv4transmitter.h rtpsessionsources.h \ rtpcollisionlist.h rtpipv6address.h rtpipv6destination.h \ rtpudpv6transmitter.h rtptypes.h rtptypes_unix.h \ - jmutex.h jthread.h jrtp4c.h jmutexautolock.h + jrtp4c.h -EXTRA_DIST = rtpconfig_unix.h.in win32/jthread.cpp win32/jmutex.cpp +EXTRA_DIST = rtpconfig_unix.h.in libjrtpincludedir = ${includedir}/jrtplib3 all: all-am @@ -317,9 +317,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jmutex.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jrtp4c.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jthread.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtcpapppacket.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtcpbyepacket.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtcpcompoundpacket.Plo@am__quote@ @@ -372,20 +370,6 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< -jmutex.lo: pthread/jmutex.cpp -@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT jmutex.lo -MD -MP -MF "$(DEPDIR)/jmutex.Tpo" -c -o jmutex.lo `test -f 'pthread/jmutex.cpp' || echo '$(srcdir)/'`pthread/jmutex.cpp; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/jmutex.Tpo" "$(DEPDIR)/jmutex.Plo"; else rm -f "$(DEPDIR)/jmutex.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='pthread/jmutex.cpp' object='jmutex.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o jmutex.lo `test -f 'pthread/jmutex.cpp' || echo '$(srcdir)/'`pthread/jmutex.cpp - -jthread.lo: pthread/jthread.cpp -@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT jthread.lo -MD -MP -MF "$(DEPDIR)/jthread.Tpo" -c -o jthread.lo `test -f 'pthread/jthread.cpp' || echo '$(srcdir)/'`pthread/jthread.cpp; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/jthread.Tpo" "$(DEPDIR)/jthread.Plo"; else rm -f "$(DEPDIR)/jthread.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='pthread/jthread.cpp' object='jthread.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o jthread.lo `test -f 'pthread/jthread.cpp' || echo '$(srcdir)/'`pthread/jthread.cpp - mostlyclean-libtool: -rm -f *.lo @@ -462,7 +446,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - $(mkdir_p) $(distdir)/win32 @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ diff --git a/libs/jrtplib/src/jrtp4c.cpp b/libs/jrtplib/src/jrtp4c.cpp index d3530ebb1b..dfeb215b35 100644 --- a/libs/jrtplib/src/jrtp4c.cpp +++ b/libs/jrtplib/src/jrtp4c.cpp @@ -22,13 +22,19 @@ extern "C" { struct jrtp4c; class JRTP4C: public RTPSession { - // add virtuals later public: JRTP4C(): RTPSession() { } void OnInvalidRawPacketType(RTPRawPacket *rawpacket, jrtp_socket_t socket); struct jrtp4c *myjrtp4c; }; +typedef enum { + JF_READY = ( 1 << 0), + JF_RUNNING = ( 1 << 1), + JF_READ = (1 << 2), + JF_WRITE = (1 << 3) +} jrtp4cflags; + struct jrtp4c { JRTP4C *session; RTPUDPv4TransmissionParams *transparams; @@ -36,6 +42,7 @@ struct jrtp4c { int payload; invalid_handler on_invalid; void *private_data; + uint32_t flags; }; void JRTP4C::OnInvalidRawPacketType(RTPRawPacket *rawpacket, jrtp_socket_t socket) @@ -125,11 +132,21 @@ struct jrtp4c *jrtp4c_new(char *rx_ip, int rx_port, char *tx_ip, int tx_port, in jrtp4c->session->SetDefaultPayloadType(payload); jrtp4c->payload = payload; jrtp4c->session->myjrtp4c = jrtp4c; + + jrtp4c->flags |= JF_READY; + return jrtp4c; } void jrtp4c_destroy(struct jrtp4c **jrtp4c) { + jrtp4c_killread(*jrtp4c); + + while (((*jrtp4c)->flags & JF_READ) || ((*jrtp4c)->flags & JF_WRITE)) { + usleep(1000); + sched_yield(); + }; + (*jrtp4c)->session->BYEDestroy(RTPTime(10,0),0,0); delete (*jrtp4c)->session; delete (*jrtp4c)->transparams; @@ -145,29 +162,63 @@ void jrtp4c_set_invald_handler(struct jrtp4c *jrtp4c, invalid_handler on_invalid jrtp_socket_t jrtp4c_get_rtp_socket(struct jrtp4c *jrtp4c) { - + if (!jrtp4c->flags & JF_READY) { + return -1; + } return jrtp4c->session->GetRTPSocket(); } void jrtp4c_killread(struct jrtp4c *jrtp4c) { + + jrtp4c->flags &= ~JF_READY; jrtp4c->session->AbortWait(); } int jrtp4c_read(struct jrtp4c *jrtp4c, void *data, int datalen, int *payload_type) { - RTPPacket *pack; - int slen = 0; + RTPPacket *pack = NULL; + int status, slen = 0; bool hasdata = 0; - *payload_type = 0; + *payload_type = -1; + + if (!(jrtp4c->flags & JF_READY)) { + return -1; + } + + jrtp4c->flags |= JF_READ; + + if ((status = jrtp4c->session->Poll()) < 0) { + jrtp4c->flags &= ~JF_READ; + return status; + } + + if (!(jrtp4c->flags & JF_READY)) { + jrtp4c->flags &= ~JF_READ; + return -1; + } jrtp4c->session->BeginDataAccess(); + //jrtp4c->session->WaitForIncomingData(RTPTime(.5), &hasdata); - jrtp4c->session->WaitForIncomingData(RTPTime(.5), &hasdata); + /* + if (!(jrtp4c->flags & JF_READY)) { + jrtp4c->session->EndDataAccess(); + jrtp4c->flags &= ~JF_READ; + return -1; + } + + if (!hasdata) { + jrtp4c->session->EndDataAccess(); + jrtp4c->flags &= ~JF_READ; + return 0; + } + */ if (!jrtp4c->session->GotoFirstSourceWithData()) { jrtp4c->session->EndDataAccess(); + jrtp4c->flags &= ~JF_READ; return 0; } @@ -179,7 +230,6 @@ int jrtp4c_read(struct jrtp4c *jrtp4c, void *data, int datalen, int *payload_typ slen = datalen; } - *payload_type = pack->GetPayloadType(); memcpy(data, pack->GetPayloadData(), slen); @@ -187,29 +237,52 @@ int jrtp4c_read(struct jrtp4c *jrtp4c, void *data, int datalen, int *payload_typ delete pack; } jrtp4c->session->EndDataAccess(); - + jrtp4c->flags &= ~JF_READ; return slen; } int jrtp4c_write(struct jrtp4c *jrtp4c, void *data, int datalen, uint32_t ts) { - return jrtp4c->session->SendPacket(data, datalen, jrtp4c->payload, false, ts); + int ret; + + if (!(jrtp4c->flags & JF_READY)) { + return -1; + } + + jrtp4c->flags |= JF_WRITE; + ret = jrtp4c->session->SendPacket(data, datalen, jrtp4c->payload, false, ts); + jrtp4c->flags &= ~JF_WRITE; + + return ret; } int jrtp4c_write_payload(struct jrtp4c *jrtp4c, void *data, int datalen, int payload, uint32_t ts, uint32_t mseq) { - return jrtp4c->session->SendPacket(data, datalen, payload, false, ts, mseq); + int ret; + + if (!(jrtp4c->flags & JF_READY)) { + return -1; + } + + jrtp4c->flags |= JF_WRITE; + ret = jrtp4c->session->SendPacket(data, datalen, payload, false, ts, mseq); + jrtp4c->flags &= ~JF_WRITE; + + return ret; } uint32_t jrtp4c_start(struct jrtp4c *jrtp4c) { - //jrtp4c->session->BeginDataAccess(); + jrtp4c->flags |= JF_RUNNING; return 0; } uint32_t jrtp4c_get_ssrc(struct jrtp4c *jrtp4c) { + if (!(jrtp4c->flags & JF_READY)) { + return -1; + } return jrtp4c->ssrc; } diff --git a/libs/jrtplib/tools/Makefile.in b/libs/jrtplib/tools/Makefile.in index 439f04bde1..8f9943ca98 100644 --- a/libs/jrtplib/tools/Makefile.in +++ b/libs/jrtplib/tools/Makefile.in @@ -100,6 +100,7 @@ RANLIB = @RANLIB@ RTP_ENDIAN = @RTP_ENDIAN@ RTP_FILIO = @RTP_FILIO@ RTP_HAVE_SOCKADDR_LEN = @RTP_HAVE_SOCKADDR_LEN@ +RTP_JTHREADINCLUDES = @RTP_JTHREADINCLUDES@ RTP_LINKLIBS = @RTP_LINKLIBS@ RTP_SOCKIO = @RTP_SOCKIO@ RTP_SOCKLENTYPE_UINT = @RTP_SOCKLENTYPE_UINT@ diff --git a/src/include/switch_types.h b/src/include/switch_types.h index eb37065f0a..ac1c1f0e75 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -84,7 +84,7 @@ struct switch_directories { typedef struct switch_directories switch_directories; SWITCH_DECLARE_DATA extern switch_directories SWITCH_GLOBAL_dirs; -#define SWITCH_RECCOMMENDED_BUFFER_SIZE 131072 +#define SWITCH_RECCOMMENDED_BUFFER_SIZE 2048 #define SWITCH_MAX_CODECS 30 #define SWITCH_MAX_STATE_HANDLERS 30 #define SWITCH_TRUE 1 diff --git a/src/mod/endpoints/mod_exosip/mod_exosip.c b/src/mod/endpoints/mod_exosip/mod_exosip.c index 1272ee9a5b..4e20fc9fed 100644 --- a/src/mod/endpoints/mod_exosip/mod_exosip.c +++ b/src/mod/endpoints/mod_exosip/mod_exosip.c @@ -42,7 +42,7 @@ static const char modname[] = "mod_exosip"; #define STRLEN 15 -static switch_memory_pool *module_pool; +static switch_memory_pool *module_pool = NULL; @@ -178,8 +178,12 @@ static void sdp_add_rfc2833(struct osip_rfc3264 *cnf, int rate); static struct private_object *get_pvt_by_call_id(int id) { char name[50]; + struct private_object *tech_pvt = NULL; snprintf(name, sizeof(name), "%d", id); - return (struct private_object *) switch_core_hash_find(globals.call_hash, name); + eXosip_lock(); + tech_pvt = (struct private_object *) switch_core_hash_find(globals.call_hash, name); + eXosip_unlock(); + return tech_pvt; } static switch_status exosip_on_execute(switch_core_session *session) @@ -376,16 +380,15 @@ static switch_status exosip_on_hangup(switch_core_session *session) tech_pvt = switch_core_session_get_private(session); assert(tech_pvt != NULL); + deactivate_rtp(tech_pvt); + eXosip_lock(); switch_core_hash_delete(globals.call_hash, tech_pvt->call_id); - - switch_set_flag(tech_pvt, TFLAG_BYE); switch_clear_flag(tech_pvt, TFLAG_IO); - deactivate_rtp(tech_pvt); - i = eXosip_call_terminate(tech_pvt->cid, tech_pvt->did); + eXosip_unlock(); if (switch_test_flag(tech_pvt, TFLAG_USING_CODEC)) { switch_core_codec_destroy(&tech_pvt->read_codec); @@ -412,7 +415,8 @@ static switch_status exosip_on_transmit(switch_core_session *session) static void deactivate_rtp(struct private_object *tech_pvt) { - int loops = 0; + int loops = 0;//, sock = -1; + if (tech_pvt->rtp_session) { switch_mutex_lock(tech_pvt->rtp_lock); @@ -420,7 +424,11 @@ static void deactivate_rtp(struct private_object *tech_pvt) switch_yield(10000); loops++; } - + /* + if ((sock = jrtp4c_get_rtp_socket(tech_pvt->rtp_session)) > -1) { + close(sock); + } + */ jrtp4c_destroy(&tech_pvt->rtp_session); tech_pvt->rtp_session = NULL; switch_mutex_unlock(tech_pvt->rtp_lock); @@ -792,6 +800,10 @@ static switch_status exosip_kill_channel(switch_core_session *session, int sig) switch_clear_flag(tech_pvt, TFLAG_IO); switch_set_flag(tech_pvt, TFLAG_BYE); + if (tech_pvt->rtp_session) { + jrtp4c_killread(tech_pvt->rtp_session); + } + return SWITCH_STATUS_SUCCESS; } @@ -878,17 +890,19 @@ static switch_status exosip_receive_message(switch_core_session *session, switch /* Transmit 183 Progress with SDP */ eXosip_lock(); eXosip_call_build_answer(tech_pvt->tid, 183, &progress); - sdp_message_to_str(tech_pvt->local_sdp, &buf); - osip_message_set_body(progress, buf, strlen(buf)); - osip_message_set_content_type(progress, "application/sdp"); - free(buf); - eXosip_call_send_answer(tech_pvt->tid, 183, progress); + if (progress) { + sdp_message_to_str(tech_pvt->local_sdp, &buf); + osip_message_set_body(progress, buf, strlen(buf)); + osip_message_set_content_type(progress, "application/sdp"); + free(buf); + eXosip_call_send_answer(tech_pvt->tid, 183, progress); + switch_set_flag(tech_pvt, TFLAG_EARLY_MEDIA); + switch_channel_set_flag(channel, CF_EARLY_MEDIA); + } eXosip_unlock(); - switch_set_flag(tech_pvt, TFLAG_EARLY_MEDIA); - switch_channel_set_flag(channel, CF_EARLY_MEDIA); } } - + break; default: break; @@ -1004,6 +1018,9 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul return SWITCH_STATUS_TERM; } + switch_mutex_init(&globals.port_lock, SWITCH_MUTEX_NESTED, module_pool); + switch_core_hash_init(&globals.call_hash, module_pool); + /* connect my internal structure to the blank pointer passed to me */ *interface = &exosip_module_interface; @@ -1163,7 +1180,9 @@ static switch_status exosip_create_call(eXosip_event_t * event) tech_pvt->remote_sdp_audio_port = atoi(remote_med->m_port); snprintf(tech_pvt->call_id, sizeof(tech_pvt->call_id), "%d", event->cid); + eXosip_lock(); switch_core_hash_insert(globals.call_hash, tech_pvt->call_id, tech_pvt); + eXosip_unlock(); if (!dname) { exosip_on_hangup(session); @@ -1530,7 +1549,7 @@ static int config_exosip(int reload) char *cf = "exosip.conf"; globals.bytes_per_frame = DEFAULT_BYTES_PER_FRAME; - switch_core_hash_init(&globals.call_hash, module_pool); + if (!switch_config_open_file(&cfg, cf)) { switch_console_printf(SWITCH_CHANNEL_CONSOLE, "open of %s failed\n", cf); @@ -1590,7 +1609,6 @@ static int config_exosip(int reload) set_global_dialplan("default"); } - switch_mutex_init(&globals.port_lock, SWITCH_MUTEX_NESTED, module_pool); /* Setup the user agent */ eXosip_set_user_agent("FreeSWITCH"); diff --git a/src/mod/endpoints/mod_exosip/mod_exosip_ccrtp.c b/src/mod/endpoints/mod_exosip/mod_exosip_ccrtp.c index c6401c838e..19c1cf65e7 100644 --- a/src/mod/endpoints/mod_exosip/mod_exosip_ccrtp.c +++ b/src/mod/endpoints/mod_exosip/mod_exosip_ccrtp.c @@ -43,7 +43,7 @@ static const char modname[] = "mod_exosip"; #define STRLEN 15 -static switch_memory_pool *module_pool; +static switch_memory_pool *module_pool = NULL; typedef enum { PFLAG_ANSWER = (1 << 0), diff --git a/src/mod/endpoints/mod_exosip/mod_exosip_ucl.c b/src/mod/endpoints/mod_exosip/mod_exosip_ucl.c index b1197bfbdf..900cc3441d 100644 --- a/src/mod/endpoints/mod_exosip/mod_exosip_ucl.c +++ b/src/mod/endpoints/mod_exosip/mod_exosip_ucl.c @@ -58,7 +58,7 @@ static const char modname[] = "mod_exosip"; #define STRLEN 15 -static switch_memory_pool *module_pool; +static switch_memory_pool *module_pool = NULL; typedef enum { PFLAG_ANSWER = (1 << 0), diff --git a/src/mod/endpoints/mod_iax/mod_iax.c b/src/mod/endpoints/mod_iax/mod_iax.c index b01621d7fc..0ca709fbcf 100644 --- a/src/mod/endpoints/mod_iax/mod_iax.c +++ b/src/mod/endpoints/mod_iax/mod_iax.c @@ -44,7 +44,7 @@ static const char modname[] = "mod_iax"; -static switch_memory_pool *module_pool; +static switch_memory_pool *module_pool = NULL; static int running = 1; diff --git a/src/mod/endpoints/mod_opal/mod_opal.c b/src/mod/endpoints/mod_opal/mod_opal.c index 3a4aa205c6..c1f86dc07f 100644 --- a/src/mod/endpoints/mod_opal/mod_opal.c +++ b/src/mod/endpoints/mod_opal/mod_opal.c @@ -34,7 +34,7 @@ static const char modname[] = "mod_woomera"; -static switch_memory_pool *module_pool; +static switch_memory_pool *module_pool = NULL; typedef enum { diff --git a/src/mod/endpoints/mod_portaudio/mod_portaudio.c b/src/mod/endpoints/mod_portaudio/mod_portaudio.c index 24e539ff8c..2adc2e74c4 100644 --- a/src/mod/endpoints/mod_portaudio/mod_portaudio.c +++ b/src/mod/endpoints/mod_portaudio/mod_portaudio.c @@ -41,7 +41,7 @@ static const char modname[] = "mod_portaudio"; -static switch_memory_pool *module_pool; +static switch_memory_pool *module_pool = NULL; //static int running = 1; #define SAMPLE_TYPE paInt16 diff --git a/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c b/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c index 3a1bfe6cd4..0a8de530c3 100644 --- a/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c +++ b/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c @@ -38,7 +38,7 @@ static const char modname[] = "mod_wanpipe"; #define STRLEN 15 -static switch_memory_pool *module_pool; +static switch_memory_pool *module_pool = NULL; typedef enum { PFLAG_ANSWER = (1 << 0), diff --git a/src/mod/endpoints/mod_woomera/mod_woomera.c b/src/mod/endpoints/mod_woomera/mod_woomera.c index bf26a21c2c..0a083c8043 100644 --- a/src/mod/endpoints/mod_woomera/mod_woomera.c +++ b/src/mod/endpoints/mod_woomera/mod_woomera.c @@ -50,7 +50,7 @@ static const char modname[] = "mod_woomera"; -static switch_memory_pool *module_pool; +static switch_memory_pool *module_pool = NULL; #define STRLEN 15 #define FRAME_LEN 480 diff --git a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c index f33a3fc9f2..43f033fae7 100644 --- a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c +++ b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c @@ -33,7 +33,7 @@ static const char modname[] = "mod_event_multicast"; -static switch_memory_pool *module_pool; +static switch_memory_pool *module_pool = NULL; static struct { char *address; diff --git a/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c b/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c index c4fd74bd89..450c469ba5 100644 --- a/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c +++ b/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c @@ -34,7 +34,7 @@ static const char modname[] = "mod_zeroconf"; -static switch_memory_pool *module_pool; +static switch_memory_pool *module_pool = NULL; static struct { sw_discovery discovery; diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c index 8cbdf7959d..f5909c9c2e 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c @@ -2140,6 +2140,11 @@ static void js_thread_launch(char *text) static switch_status launch_async(char *text, char *out, size_t outlen) { + if (switch_strlen_zero(text)) { + switch_copy_string(out, "INVALID", outlen); + return SWITCH_STATUS_SUCCESS; + } + js_thread_launch(text); switch_copy_string(out, "OK", outlen); return SWITCH_STATUS_SUCCESS; diff --git a/src/switch_console.c b/src/switch_console.c index 333a955ec5..157ca8785e 100644 --- a/src/switch_console.c +++ b/src/switch_console.c @@ -33,16 +33,11 @@ #include #define CMD_BUFLEN SWITCH_RECCOMMENDED_BUFFER_SIZE * 10 -static int switch_console_process(char *cmd) +static int switch_console_process(char *cmd, char *retbuf, int retlen) { char *arg = NULL; - char *retbuf = (char *)malloc(CMD_BUFLEN); -#ifdef EMBED_PERL - const char *perlhelp = "perl - execute some perl. (print to STDERR if you want to see it.)\n"; -#else - const char *perlhelp = ""; -#endif + if (!strcmp(cmd, "shutdown") || !strcmp(cmd, "...")) { switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Bye!\n"); return 0; @@ -55,18 +50,10 @@ static int switch_console_process(char *cmd) switch_console_printf(SWITCH_CHANNEL_CONSOLE, "\n" "Valid Commands:\n\n" - "version\n" "help - umm yeah..\n" "%sshutdown - stop the program\n\n", perlhelp); + "version\n" "help - umm yeah..\n" "shutdown - stop the program\n\n"); return 1; } -#ifdef EMBED_PERL - if (!strncmp(cmd, "perl ", 5)) { - cmd += 5; - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Executing perl code [%s]\n", cmd); - switch_core_do_perl(cmd); - return 1; - } -#endif if ((arg = strchr(cmd, '\r')) != 0 || (arg = strchr(cmd, '\n')) != 0 ) { *arg = '\0'; arg = NULL; @@ -74,7 +61,7 @@ static int switch_console_process(char *cmd) if ((arg = strchr(cmd, ' ')) != 0) { *arg++ = '\0'; } - if (switch_api_execute(cmd, arg, retbuf, CMD_BUFLEN) == SWITCH_STATUS_SUCCESS) { + if (switch_api_execute(cmd, arg, retbuf, retlen) == SWITCH_STATUS_SUCCESS) { switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "API CALL [%s(%s)] output:\n%s\n", cmd, arg ? arg : "", retbuf); } else { @@ -144,7 +131,10 @@ SWITCH_DECLARE(void) switch_console_loop(void) char hostname[256]; char cmd[2048]; int running = 1, x = 0, activity = 1; + char *retbuf = (char *)malloc(CMD_BUFLEN); + + assert(retbuf != NULL); gethostname(hostname, sizeof(hostname)); @@ -169,8 +159,10 @@ SWITCH_DECLARE(void) switch_console_loop(void) } } if (cmd[0]) { - running = switch_console_process(cmd); + running = switch_console_process(cmd, retbuf, CMD_BUFLEN); } } + + free(retbuf); } diff --git a/src/switch_core.c b/src/switch_core.c index 79e5fd38db..a66e78706d 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -30,7 +30,7 @@ * */ #include -//#define DEBUG_ALLOC +#define DEBUG_ALLOC struct switch_core_session { unsigned long id; @@ -892,6 +892,8 @@ SWITCH_DECLARE(switch_status) switch_core_session_read_frame(switch_core_session switch_status status = SWITCH_STATUS_FALSE; int need_codec = 0, perfect = 0; + assert(session != NULL); + *frame = NULL; if (session->endpoint_interface->io_routines->read_frame) { if ((status = session->endpoint_interface->io_routines->read_frame(session, @@ -913,6 +915,9 @@ SWITCH_DECLARE(switch_status) switch_core_session_read_frame(switch_core_session return status; } + assert(session != NULL); + assert(*frame != NULL); + /* if you think this code is redundant.... too bad! I like to understand what I'm doing */ if ((session->read_codec && (*frame)->codec && session->read_codec->implementation != (*frame)->codec->implementation)) { @@ -1070,7 +1075,8 @@ SWITCH_DECLARE(switch_status) switch_core_session_write_frame(switch_core_sessio unsigned int flag = 0, need_codec = 0, perfect = 0; switch_io_flag io_flag = SWITCH_IO_FLAG_NOOP; - + assert(session != NULL); + assert(frame != NULL); assert(frame->codec != NULL); /* if you think this code is redundant.... too bad! I like to understand what I'm doing */ @@ -1560,11 +1566,9 @@ SWITCH_DECLARE(switch_status) switch_core_session_add_event_hook_send_dtmf(switc SWITCH_DECLARE(switch_status) switch_core_new_memory_pool(switch_memory_pool **pool) { - if (runtime.memory_pool == NULL) { - return SWITCH_STATUS_MEMERR; - } + assert(runtime.memory_pool != NULL); - if ((apr_pool_create(pool, NULL)) != SWITCH_STATUS_SUCCESS) { + if ((apr_pool_create(pool, runtime.memory_pool)) != SWITCH_STATUS_SUCCESS) { *pool = NULL; return SWITCH_STATUS_MEMERR; } @@ -2001,9 +2005,12 @@ SWITCH_DECLARE(void) switch_core_session_destroy(switch_core_session **session) SWITCH_DECLARE(switch_status) switch_core_hash_init(switch_hash **hash, switch_memory_pool *pool) { + assert(pool != NULL); + if ((*hash = apr_hash_make(pool)) != 0) { return SWITCH_STATUS_SUCCESS; } + return SWITCH_STATUS_GENERR; } @@ -2130,10 +2137,10 @@ SWITCH_DECLARE(void *) switch_core_alloc(switch_memory_pool *pool, size_t memory { void *ptr = NULL; assert(pool != NULL); - assert(memory < 1000000); #ifdef DEBUG_ALLOC switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Allocate %d\n", memory); + //assert(memory < 600000); #endif if ((ptr = apr_palloc(pool, memory)) != 0) { diff --git a/src/switch_event.c b/src/switch_event.c index bf5098d920..58a71ba9a5 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -35,15 +35,16 @@ static switch_event_node *EVENT_NODES[SWITCH_EVENT_ALL + 1] = { NULL }; static switch_mutex_t *BLOCK = NULL; static switch_mutex_t *POOL_LOCK = NULL; static switch_memory_pool *RUNTIME_POOL = NULL; -static switch_memory_pool *APOOL = NULL; -static switch_memory_pool *BPOOL = NULL; +//static switch_memory_pool *APOOL = NULL; +//static switch_memory_pool *BPOOL = NULL; static switch_memory_pool *THRUNTIME_POOL = NULL; static switch_queue_t *EVENT_QUEUE[3] = {0,0,0}; -static int POOL_COUNT_MAX = 100; +static int POOL_COUNT_MAX = 2000; static switch_hash *CUSTOM_HASH = NULL; static int THREAD_RUNNING = 0; +#if 0 static void *locked_alloc(size_t len) { void *mem; @@ -72,7 +73,11 @@ static void *locked_dup(char *str) #define ALLOC(size) locked_alloc(size) #define DUP(str) locked_dup(str) +#endif +#define ALLOC(size) malloc(size) +#define DUP(str) strdup(str) +#define FREE(ptr) if (ptr) free(ptr) /* make sure this is synced with the switch_event_t enum in switch_types.h also never put any new ones before EVENT_ALL @@ -261,16 +266,17 @@ SWITCH_DECLARE(switch_status) switch_event_init(switch_memory_pool *pool) RUNTIME_POOL = pool; - if (switch_core_new_memory_pool(&APOOL) != SWITCH_STATUS_SUCCESS) { + if (switch_core_new_memory_pool(&THRUNTIME_POOL) != SWITCH_STATUS_SUCCESS) { switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Could not allocate memory pool\n"); return SWITCH_STATUS_MEMERR; } + /* if (switch_core_new_memory_pool(&BPOOL) != SWITCH_STATUS_SUCCESS) { switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Could not allocate memory pool\n"); return SWITCH_STATUS_MEMERR; } - - THRUNTIME_POOL = APOOL; + */ + //THRUNTIME_POOL = APOOL; switch_queue_create(&EVENT_QUEUE[0], POOL_COUNT_MAX + 10, THRUNTIME_POOL); switch_queue_create(&EVENT_QUEUE[1], POOL_COUNT_MAX + 10, THRUNTIME_POOL); switch_queue_create(&EVENT_QUEUE[2], POOL_COUNT_MAX + 10, THRUNTIME_POOL); @@ -300,6 +306,7 @@ SWITCH_DECLARE(switch_status) switch_event_create_subclass(switch_event **event, if ((*event = ALLOC(sizeof(switch_event))) == 0) { return SWITCH_STATUS_MEMERR; } + memset(*event, 0, sizeof(switch_event)); (*event)->event_id = event_id; @@ -350,6 +357,8 @@ SWITCH_DECLARE(switch_status) switch_event_add_header(switch_event *event, switc return SWITCH_STATUS_MEMERR; } + memset(header, 0, sizeof(*header)); + header->name = DUP(header_name); header->value = DUP(data); if (((stack = SWITCH_STACK_TOP)) != 0) { @@ -390,6 +399,18 @@ SWITCH_DECLARE(switch_status) switch_event_add_body(switch_event *event, char *f SWITCH_DECLARE(void) switch_event_destroy(switch_event **event) { + switch_event *ep = *event; + switch_event_header *hp, *this; + + for (hp = ep->headers; hp;) { + this = hp; + FREE(hp->name); + FREE(hp->value); + hp = hp->next; + + } + FREE(ep->body); + FREE(ep); *event = NULL; } @@ -409,6 +430,9 @@ SWITCH_DECLARE(switch_status) switch_event_dup(switch_event **event, switch_even if ((header = ALLOC(sizeof(*header))) == 0) { return SWITCH_STATUS_MEMERR; } + + memset(header, 0, sizeof(*header)); + header->name = DUP(hp->name); header->value = DUP(hp->value); diff --git a/src/switch_ivr.c b/src/switch_ivr.c index e6cd2c9193..69fc14f266 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -773,7 +773,7 @@ static void *audio_bridge_thread(switch_thread *thread, void *obj) //switch_yield(1000); } - + data->running = 0; if (switch_channel_test_flag(chan_a, CF_ORIGINATOR)) { if (!switch_channel_test_flag(chan_b, CF_TRANSFER)) { @@ -783,16 +783,18 @@ static void *audio_bridge_thread(switch_thread *thread, void *obj) switch_channel_clear_flag(chan_a, CF_ORIGINATOR); } - data->running = 0; - - if (his_thread->running > 0) { + while (his_thread->running > 0) { his_thread->running = -1; /* wait for the other audio thread */ - while (his_thread->running) { + while (his_thread->running == -1) { switch_yield(1000); } } - switch_sleep(500000); + + data->running = 0; + switch_sleep(200000); + data->running = 0; + return NULL; } @@ -839,7 +841,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_multi_threaded_bridge(switch_core_sessi switch_channel *caller_channel, *peer_channel; time_t start; int stream_id = 0; - switch_frame *read_frame; + switch_frame *read_frame = NULL; @@ -903,7 +905,6 @@ SWITCH_DECLARE(switch_status) switch_ivr_multi_threaded_bridge(switch_core_sessi /* read from the channel while we wait if the audio is up on it */ if (switch_channel_test_flag(caller_channel, CF_ANSWERED) || switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)) { - if (switch_core_session_read_frame(session, &read_frame, 1000, 0) != SWITCH_STATUS_SUCCESS) { break; } diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 2b29f9aa48..7923149508 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -134,7 +134,6 @@ static switch_status switch_loadable_module_load_file(char *filename, switch_mem if (err) { switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Error Loading module %s\n**%s**\n", filename, err); - apr_dso_unload(dso); return SWITCH_STATUS_GENERR; }