diff --git a/build/next-release.txt b/build/next-release.txt index b61c58c7d4..63fd3adc74 100644 --- a/build/next-release.txt +++ b/build/next-release.txt @@ -1 +1 @@ -1.10.10-dev +1.10.11-dev diff --git a/conf/vanilla/freeswitch.xml b/conf/vanilla/freeswitch.xml index dc66fca170..35f9c6bbb9 100644 --- a/conf/vanilla/freeswitch.xml +++ b/conf/vanilla/freeswitch.xml @@ -9,11 +9,11 @@ Before you start to modify this default please visit this wiki page: - http://wiki.freeswitch.org/wiki/Getting_Started_Guide#Some_stuff_to_try_out.21 + https://developer.signalwire.com/freeswitch/FreeSWITCH-Explained/Configuration/Default-Configuration_6587388/#6-configuration-files If all else fails you can read our FAQ located at: - http://wiki.freeswitch.org/wiki/FreeSwitch_FAQ + https://developer.signalwire.com/freeswitch/FreeSWITCH-Explained/Miscellaneous/FAQ/ NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE --> diff --git a/configure.ac b/configure.ac index 04738e93c1..9f852e531a 100644 --- a/configure.ac +++ b/configure.ac @@ -3,10 +3,10 @@ # Must change all of the below together # For a release, set revision for that tagged release as well and uncomment -AC_INIT([freeswitch], [1.10.10-dev], bugs@freeswitch.org) +AC_INIT([freeswitch], [1.10.11-dev], bugs@freeswitch.org) AC_SUBST(SWITCH_VERSION_MAJOR, [1]) AC_SUBST(SWITCH_VERSION_MINOR, [10]) -AC_SUBST(SWITCH_VERSION_MICRO, [10-dev]) +AC_SUBST(SWITCH_VERSION_MICRO, [11-dev]) AC_SUBST(SWITCH_VERSION_REVISION, []) AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, []) @@ -582,7 +582,7 @@ AC_SUBST(SYS_XMLRPC_CFLAGS) AC_SUBST(SYS_XMLRPC_LDFLAGS) AM_CONDITIONAL([SYSTEM_XMLRPCC],[test "${enable_xmlrpcc}" = "yes"]) -for luaversion in luajit lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua; do +for luaversion in luajit lua5.3 lua-5.3 lua53 lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua; do PKG_CHECK_MODULES([LUA],[${luaversion}],[have_lua=yes],[have_lua=no]) if test ${have_lua} = yes; then break @@ -1352,7 +1352,21 @@ PKG_CHECK_MODULES([MPG123], [libmpg123 >= 1.16.0],[ AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_MPG123],[false])]) PKG_CHECK_MODULES([SHOUT], [shout >= 2.2.2],[ - AM_CONDITIONAL([HAVE_SHOUT],[true])],[ + AM_CONDITIONAL([HAVE_SHOUT],[true]) + SHOUT_VERSION="`$PKG_CONFIG --modversion shout`" + SHOUT_MAJOR_VERSION="`echo $SHOUT_VERSION | cut -d. -f1`" + SHOUT_MINOR_VERSION="`echo $SHOUT_VERSION | cut -d. -f2`" + SHOUT_PATCH_VERSION="`echo $SHOUT_VERSION | cut -d. -f3`" + test -n "$SHOUT_PATCH_VERSION" || SHOUT_PATCH_VERSION=0 + AC_MSG_NOTICE([SHOUT version: $SHOUT_VERSION]) + AC_MSG_NOTICE([SHOUT major version: $SHOUT_MAJOR_VERSION]) + AC_MSG_NOTICE([SHOUT minor version: $SHOUT_MINOR_VERSION]) + AC_MSG_NOTICE([SHOUT patch version: $SHOUT_PATCH_VERSION]) + AC_SUBST([SHOUT_VERSION]) + AC_SUBST([SHOUT_MAJOR_VERSION]) + AC_SUBST([SHOUT_MINOR_VERSION]) + AC_SUBST([SHOUT_PATCH_VERSION]) + ],[ AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SHOUT],[false])]) mp3lame=false @@ -1518,26 +1532,32 @@ PKG_CHECK_MODULES([V8FS_STATIC], [v8-6.1_static >= 6.1.298],[ ]) ]) -PKG_CHECK_MODULES([KS], [libks >= 1.8.2],[ +PKG_CHECK_MODULES([KS], [libks2 >= 2.0.0],[ AM_CONDITIONAL([HAVE_KS],[true])],[ - if module_enabled mod_verto; then - AC_MSG_ERROR([You need to either install libks or disable mod_verto in modules.conf]) - else - if module_enabled mod_signalwire; then - AC_MSG_ERROR([You need to either install libks or disable mod_signalwire in modules.conf]) + PKG_CHECK_MODULES([KS], [libks >= 1.8.2],[ + AM_CONDITIONAL([HAVE_KS],[true])],[ + if module_enabled mod_verto; then + AC_MSG_ERROR([You need to either install libks2 or libks or disable mod_verto in modules.conf]) else - AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_KS],[false]) + if module_enabled mod_signalwire; then + AC_MSG_ERROR([You need to either install libks2 or libks or disable mod_signalwire in modules.conf]) + else + AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_KS],[false]) + fi fi - fi + ]) ]) -PKG_CHECK_MODULES([SIGNALWIRE_CLIENT], [signalwire_client >= 1.0.0],[ +PKG_CHECK_MODULES([SIGNALWIRE_CLIENT], [signalwire_client2 >= 2.0.0],[ AM_CONDITIONAL([HAVE_SIGNALWIRE_CLIENT],[true])],[ - if module_enabled mod_signalwire; then - AC_MSG_ERROR([You need to either install signalwire-client-c or disable mod_signalwire in modules.conf]) - else - AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SIGNALWIRE_CLIENT],[false]) - fi + PKG_CHECK_MODULES([SIGNALWIRE_CLIENT], [signalwire_client >= 1.0.0],[ + AM_CONDITIONAL([HAVE_SIGNALWIRE_CLIENT],[true])],[ + if module_enabled mod_signalwire; then + AC_MSG_ERROR([You need to either install signalwire-client-c2 or signalwire-client-c or disable mod_signalwire in modules.conf]) + else + AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SIGNALWIRE_CLIENT],[false]) + fi + ]) ]) PKG_CHECK_MODULES([AMQP], [librabbitmq >= 0.5.2],[ diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index c207036757..a2f0261ab6 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -29,7 +29,7 @@ conf_dir="../conf" lang_dir="../conf/vanilla/lang" fs_description="FreeSWITCH is a scalable open source cross-platform telephony platform designed to route and interconnect popular communication protocols using audio, video, text or any other form of media." mod_build_depends="." mod_depends="." mod_recommends="." mod_suggests="." -supported_debian_distros="wheezy jessie stretch buster bullseye sid" +supported_debian_distros="wheezy jessie stretch buster bullseye bookworm sid" supported_ubuntu_distros="trusty utopic xenial" supported_distros="$supported_debian_distros $supported_ubuntu_distros" avoid_mods=( @@ -71,6 +71,9 @@ avoid_mods_sid=( avoid_mods_jessie=( directories/mod_ldap ) +avoid_mods_bookworm=( + languages/mod_python +) avoid_mods_wheezy=( event_handlers/mod_amqp languages/mod_java @@ -325,7 +328,7 @@ Build-Depends: # configure options libssl1.0-dev | libssl-dev, unixodbc-dev, libpq-dev, libncurses5-dev, libjpeg62-turbo-dev | libjpeg-turbo8-dev | libjpeg62-dev | libjpeg8-dev, - python-dev | python-dev-is-python2, python3-dev, python-all-dev, python-support (>= 0.90) | dh-python, erlang-dev, libtpl-dev (>= 1.5), + python-dev | python-dev-is-python2 | python-dev-is-python3, python3-dev, python-all-dev | python3-all-dev, python-support (>= 0.90) | dh-python, erlang-dev, libtpl-dev (>= 1.5), # documentation doxygen, # for APR (not essential for build) diff --git a/debian/control-modules b/debian/control-modules index b9d7a05933..3179f8eeef 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -12,6 +12,7 @@ Module: applications/mod_av Description: mod_av Adds mod_av. Build-Depends: libavformat-dev, libswscale-dev, libavresample-dev +Build-Depends-Bookworm: libavformat-dev, libswscale-dev, libswresample-dev Module: applications/mod_avmd Description: Advanced voicemail detection @@ -209,7 +210,7 @@ Description: Adds mod_skel Module: applications/mod_signalwire Description: mod_signalwire Adds mod_signalwire. -Build-Depends: libks, signalwire-client-c +Build-Depends: libks2, signalwire-client-c2 Module: applications/mod_sms Description: Astract SMS @@ -485,6 +486,7 @@ Description: Adds mod_verto. Build-Depends: libperl-dev Build-Depends-Buster: libperl-dev, libgdbm-compat-dev Build-Depends-Bullseye: libperl-dev, libgdbm-compat-dev +Build-Depends-Bookworm: libperl-dev, libgdbm-compat-dev ## mod/event_handlers @@ -647,6 +649,7 @@ Module: languages/mod_lua Description: mod_lua Adds mod_lua. Build-Depends: liblua5.2-dev | liblua5.1-dev +Build-Depends-Bookworm: liblua5.3-dev | liblua5.2-dev | liblua5.1-dev Module: languages/mod_managed Description: mod_managed @@ -659,6 +662,7 @@ Description: mod_perl Build-Depends: libperl-dev Build-Depends-Buster: libperl-dev, libgdbm-compat-dev Build-Depends-Bullseye: libperl-dev, libgdbm-compat-dev +Build-Depends-Bookworm: libperl-dev, libgdbm-compat-dev Module: languages/mod_python Description: mod_python @@ -669,6 +673,7 @@ Module: languages/mod_python3 Description: mod_python3 Adds mod_python3. Build-Depends: python3-dev +Build-Depends-Bookworm: python3-dev, python3-setuptools Module: languages/mod_v8 Description: mod_v8 diff --git a/debian/util.sh b/debian/util.sh index 6a5d8f27da..110e6d8763 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -46,6 +46,7 @@ find_distro () { case "$1" in experimental) echo "sid";; unstable) echo "sid";; + experimental) echo "bookworm";; testing) echo "bullseye";; stable) echo "buster";; oldstable) echo "stretch";; @@ -56,6 +57,7 @@ find_distro () { find_suite () { case "$1" in sid) echo "unstable";; + bookworm) echo "experimental";; bullseye) echo "testing";; buster) echo "stable";; stretch) echo "oldstable";; diff --git a/freeswitch.spec b/freeswitch.spec index 1d985cc299..ecf9dacf13 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -497,7 +497,7 @@ the entries aloud via a TTS engine Summary: FreeSWITCH mod_signalwire Group: System/Libraries Requires: %{name} = %{version}-%{release} -BuildRequires: libks signalwire-client-c +BuildRequires: libks2 signalwire-client-c2 %description application-signalwire Provides FreeSWITCH mod_signalwire diff --git a/libs/libyuv/include/libyuv/planar_functions.h b/libs/libyuv/include/libyuv/planar_functions.h index 5299fe2c0e..50fe5f681d 100644 --- a/libs/libyuv/include/libyuv/planar_functions.h +++ b/libs/libyuv/include/libyuv/planar_functions.h @@ -582,7 +582,7 @@ typedef void (*ARGBBlendRow)(const uint8_t* src_argb0, // Get function to Alpha Blend ARGB pixels and store to destination. LIBYUV_API -ARGBBlendRow GetARGBBlend(); +ARGBBlendRow GetARGBBlend(void); // Alpha Blend ARGB images and store to destination. // Source is pre-multiplied by alpha using ARGBAttenuate. diff --git a/libs/libyuv/source/planar_functions.cc b/libs/libyuv/source/planar_functions.cc index 5a9d56d88a..c07f0943d3 100644 --- a/libs/libyuv/source/planar_functions.cc +++ b/libs/libyuv/source/planar_functions.cc @@ -1185,7 +1185,7 @@ int ARGBMirror(const uint8_t* src_argb, // As there are 6 blenders to choose from, the caller should try to use // the same blend function for all pixels if possible. LIBYUV_API -ARGBBlendRow GetARGBBlend() { +ARGBBlendRow GetARGBBlend(void) { void (*ARGBBlendRow)(const uint8_t* src_argb, const uint8_t* src_argb1, uint8_t* dst_argb, int width) = ARGBBlendRow_C; #if defined(HAS_ARGBBLENDROW_SSSE3) diff --git a/libs/miniupnpc/miniupnpc.c b/libs/miniupnpc/miniupnpc.c index 88faea1c37..a72ef892b6 100644 --- a/libs/miniupnpc/miniupnpc.c +++ b/libs/miniupnpc/miniupnpc.c @@ -679,7 +679,6 @@ UPNP_GetValidIGD(struct UPNPDev * devlist, char * descXML; int descXMLsize = 0; struct UPNPDev * dev; - int ndev = 0; int state; /* state 1 : IGD connected. State 2 : IGD. State 3 : anything */ if(!devlist) { @@ -698,7 +697,6 @@ UPNP_GetValidIGD(struct UPNPDev * devlist, lanaddr, lanaddrlen); if(descXML) { - ndev++; memset(data, 0, sizeof(struct IGDdatas)); memset(urls, 0, sizeof(struct UPNPUrls)); parserootdesc(descXML, descXMLsize, data); diff --git a/libs/win32/ffmpeg/ffmpeg.2017.vcxproj b/libs/win32/ffmpeg/ffmpeg.2017.vcxproj index 7eb6ef65ed..b985670dbe 100644 --- a/libs/win32/ffmpeg/ffmpeg.2017.vcxproj +++ b/libs/win32/ffmpeg/ffmpeg.2017.vcxproj @@ -24,7 +24,6 @@ 10.0.17134.0 {BC1FD72E-1CD5-4525-A7F5-17C5740BFDED} - @@ -78,7 +77,7 @@ - BUILDING_avdevice;BUILDING_avfilter;BUILDING_avformat;BUILDING_avcodec;BUILDING_avresample;BUILDING_swresample;BUILDING_swscale;BUILDING_avutil;%(PreprocessorDefinitions) + WC_ERR_INVALID_CHARS=0x00000080;BUILDING_avdevice;BUILDING_avfilter;BUILDING_avformat;BUILDING_avcodec;BUILDING_swresample;BUILDING_swscale;BUILDING_avutil;%(PreprocessorDefinitions) @@ -209,6 +208,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -242,6 +244,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -305,6 +310,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -332,6 +340,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -350,6 +361,18 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -392,6 +415,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -401,6 +427,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -410,6 +442,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -419,18 +457,21 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -458,15 +499,15 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -533,12 +574,18 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -548,6 +595,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -563,6 +613,15 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -596,7 +655,7 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -608,10 +667,13 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -638,6 +700,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -680,6 +745,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -719,6 +790,15 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -755,6 +835,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -764,15 +847,15 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -782,6 +865,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -815,6 +901,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -875,15 +967,15 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -908,9 +1000,6 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -980,6 +1069,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1001,9 +1093,18 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1049,6 +1150,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1097,9 +1201,6 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1124,6 +1225,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1133,6 +1240,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1241,6 +1354,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1271,6 +1390,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1301,6 +1423,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1406,7 +1531,7 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1415,9 +1540,6 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1433,9 +1555,18 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1454,6 +1585,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1466,6 +1600,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1484,6 +1621,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1538,6 +1678,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1559,6 +1702,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1586,6 +1732,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1595,6 +1744,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1640,6 +1792,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1673,6 +1828,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1691,48 +1849,15 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1748,6 +1873,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1763,6 +1891,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1793,18 +1924,36 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1832,6 +1981,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1880,6 +2032,15 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -1964,6 +2125,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2039,6 +2203,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2060,9 +2230,6 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2072,13 +2239,16 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2105,6 +2275,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2126,9 +2302,6 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2168,6 +2341,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2177,21 +2353,24 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2222,6 +2401,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2237,9 +2419,6 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2282,6 +2461,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2318,12 +2503,18 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2444,12 +2635,18 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2528,6 +2725,15 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2636,7 +2842,7 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2726,6 +2932,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2816,9 +3025,6 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2828,6 +3034,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2849,18 +3058,33 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2876,6 +3100,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2897,6 +3127,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2906,12 +3142,21 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2921,12 +3166,30 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2954,6 +3217,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -2996,9 +3265,6 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3008,6 +3274,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3026,6 +3295,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3038,6 +3310,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3077,6 +3352,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3095,7 +3373,7 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3110,10 +3388,52 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3122,6 +3442,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3140,6 +3463,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3155,6 +3481,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3203,7 +3532,13 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3215,6 +3550,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3227,6 +3565,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3245,6 +3589,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3257,6 +3604,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3266,12 +3619,21 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3284,18 +3646,33 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3320,6 +3697,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3332,6 +3712,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3341,6 +3724,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3353,6 +3739,15 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3365,15 +3760,27 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3416,18 +3823,30 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3443,9 +3862,15 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3455,10 +3880,10 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3470,9 +3895,15 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3494,7 +3925,16 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3512,9 +3952,21 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3554,9 +4006,15 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3608,10 +4066,10 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3623,6 +4081,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3632,6 +4093,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3641,6 +4105,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3677,33 +4144,39 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3716,6 +4189,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3734,13 +4210,16 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3755,6 +4234,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3764,12 +4246,18 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3779,19 +4267,31 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3800,7 +4300,7 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3809,40 +4309,55 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3869,9 +4384,15 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3896,6 +4417,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3908,9 +4432,15 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3923,6 +4453,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3935,9 +4468,21 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -3971,15 +4516,18 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4001,6 +4549,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4010,6 +4564,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4067,9 +4624,6 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4085,21 +4639,36 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4157,9 +4726,6 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4211,6 +4777,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4259,6 +4828,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4271,6 +4846,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4319,6 +4897,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4337,15 +4918,24 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4358,6 +4948,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4376,9 +4969,15 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4397,6 +4996,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4415,6 +5017,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4457,6 +5065,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4469,6 +5083,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4520,6 +5137,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4532,6 +5152,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4589,9 +5212,6 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4652,6 +5272,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4871,6 +5494,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4922,6 +5548,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4934,6 +5563,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -4946,6 +5578,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -5027,6 +5662,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -5075,6 +5713,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -5099,9 +5740,6 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -5114,6 +5752,12 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -5174,6 +5818,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -5234,6 +5881,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -5267,15 +5917,24 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -5297,6 +5956,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -5309,21 +5971,27 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -5426,9 +6094,30 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -5447,13 +6136,19 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -5480,6 +6175,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -5525,6 +6223,9 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ @@ -5543,54 +6244,6 @@ $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - Assembling %(Filename)%(Extension) - $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - Assembling %(Filename)%(Extension) - $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - - - Assembling %(Filename)%(Extension) - $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj - - - $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_'))\ - Assembling %(Filename)%(Extension) $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" @@ -5636,6 +6289,21 @@ $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + + Assembling %(Filename)%(Extension) + $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + + + Assembling %(Filename)%(Extension) + $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + + + Assembling %(Filename)%(Extension) + $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + Assembling %(Filename)%(Extension) $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" @@ -5666,7 +6334,7 @@ $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj - + Assembling %(Filename)%(Extension) $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj @@ -5856,7 +6524,7 @@ $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj - + Assembling %(Filename)%(Extension) $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj @@ -6041,6 +6709,11 @@ $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + + Assembling %(Filename)%(Extension) + $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + Assembling %(Filename)%(Extension) $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" @@ -6056,6 +6729,16 @@ $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + + Assembling %(Filename)%(Extension) + $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + + + Assembling %(Filename)%(Extension) + $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + Assembling %(Filename)%(Extension) $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" @@ -6066,12 +6749,27 @@ $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + + Assembling %(Filename)%(Extension) + $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + + + Assembling %(Filename)%(Extension) + $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + Assembling %(Filename)%(Extension) $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj - + + Assembling %(Filename)%(Extension) + $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + + Assembling %(Filename)%(Extension) $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj @@ -6086,7 +6784,7 @@ $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj - + Assembling %(Filename)%(Extension) $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj @@ -6106,17 +6804,32 @@ $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + + Assembling %(Filename)%(Extension) + $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + + + Assembling %(Filename)%(Extension) + $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + Assembling %(Filename)%(Extension) $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + + Assembling %(Filename)%(Extension) + $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + Assembling %(Filename)%(Extension) $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj - + Assembling %(Filename)%(Extension) $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj @@ -6126,12 +6839,12 @@ $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj - + Assembling %(Filename)%(Extension) $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj - + Assembling %(Filename)%(Extension) $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj @@ -6141,7 +6854,12 @@ $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj - + + Assembling %(Filename)%(Extension) + $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + + Assembling %(Filename)%(Extension) $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj @@ -6151,6 +6869,11 @@ $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + + Assembling %(Filename)%(Extension) + $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + Assembling %(Filename)%(Extension) $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" @@ -6206,6 +6929,11 @@ $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + + Assembling %(Filename)%(Extension) + $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + Assembling %(Filename)%(Extension) $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" @@ -6241,6 +6969,21 @@ $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + + Assembling %(Filename)%(Extension) + $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + + + Assembling %(Filename)%(Extension) + $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + + + Assembling %(Filename)%(Extension) + $(YasmCommand) -I %(RelativeDir) -o $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj "%(FullPath)" + $(IntDir)$([System.String]::Copy(%(RelativeDir)).Replace('\','_')).%(FileName).obj + @@ -6256,4 +6999,4 @@ - + \ No newline at end of file diff --git a/libs/xmlrpc-c/include/xmlrpc-c/string_int.h b/libs/xmlrpc-c/include/xmlrpc-c/string_int.h index 04ac8c782b..a0cc58605f 100644 --- a/libs/xmlrpc-c/include/xmlrpc-c/string_int.h +++ b/libs/xmlrpc-c/include/xmlrpc-c/string_int.h @@ -3,7 +3,12 @@ #include + +#ifdef __APPLE__ +#include +#else #include +#endif #include "xmlrpc_config.h" #include "c_util.h" diff --git a/libs/xmlrpc-c/lib/abyss/src/server.c b/libs/xmlrpc-c/lib/abyss/src/server.c index 6337dcfd78..ca05011b83 100644 --- a/libs/xmlrpc-c/lib/abyss/src/server.c +++ b/libs/xmlrpc-c/lib/abyss/src/server.c @@ -1,6 +1,9 @@ /* Copyright information is at end of file */ #define _XOPEN_SOURCE 600 /* Make sure strdup() is in */ +#ifdef __APPLE__ +#define _DARWIN_C_SOURCE +#endif #define _BSD_SOURCE /* Make sure setgroups()is in */ #ifndef _DEFAULT_SOURCE #define _DEFAULT_SOURCE diff --git a/libs/xmlrpc-c/lib/abyss/src/thread_fork.c b/libs/xmlrpc-c/lib/abyss/src/thread_fork.c index d96bf59eb1..7ea382918a 100644 --- a/libs/xmlrpc-c/lib/abyss/src/thread_fork.c +++ b/libs/xmlrpc-c/lib/abyss/src/thread_fork.c @@ -3,7 +3,11 @@ #include #include #include +#ifdef __APPLE__ +#include +#else #include +#endif #include #include "xmlrpc_config.h" diff --git a/libs/xmlrpc-c/lib/libutil/asprintf.c b/libs/xmlrpc-c/lib/libutil/asprintf.c index b52523065a..f078518bb5 100644 --- a/libs/xmlrpc-c/lib/libutil/asprintf.c +++ b/libs/xmlrpc-c/lib/libutil/asprintf.c @@ -1,4 +1,7 @@ #define _XOPEN_SOURCE 600 /* Make sure strdup() is in */ +#ifdef __APPLE__ +#define _DARWIN_C_SOURCE +#endif #ifndef _GNU_SOURCE #define _GNU_SOURCE /* But only when HAVE_ASPRINTF */ #endif diff --git a/src/fs_encode.c b/src/fs_encode.c index 235a5d9f11..527dc3eeff 100644 --- a/src/fs_encode.c +++ b/src/fs_encode.c @@ -46,7 +46,7 @@ #pragma warning (disable:167) #endif -static void fs_encode_cleanup() +static void fs_encode_cleanup(void) { switch_safe_free(SWITCH_GLOBAL_dirs.conf_dir); switch_safe_free(SWITCH_GLOBAL_dirs.mod_dir); diff --git a/src/fs_tts.c b/src/fs_tts.c index 2a963ee68e..6632e86566 100644 --- a/src/fs_tts.c +++ b/src/fs_tts.c @@ -46,7 +46,7 @@ #pragma warning (disable:167) #endif -static void fs_tts_cleanup() +static void fs_tts_cleanup(void) { switch_safe_free(SWITCH_GLOBAL_dirs.conf_dir); switch_safe_free(SWITCH_GLOBAL_dirs.mod_dir); diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index ee927e6db9..352e399d2a 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -325,6 +325,24 @@ SWITCH_DECLARE(switch_status_t) switch_channel_get_scope_variables(switch_channe SWITCH_DECLARE(const char *) switch_channel_get_variable_dup(switch_channel_t *channel, const char *varname, switch_bool_t dup, int idx); #define switch_channel_get_variable(_c, _v) switch_channel_get_variable_dup(_c, _v, SWITCH_TRUE, -1) +/*! + \brief Retrieve a copy of a variable from a given channel. switch_safe_free() call will be required. + \param channel channel to retrieve variable from + \param varname the name of the variable + \return a strdup copy the value of the requested variable without using a memory pool. +*/ +SWITCH_DECLARE(const char *) switch_channel_get_variable_strdup(switch_channel_t *channel, const char *varname); + +/*! + \brief Retrieve a variable from a given channel to a pre-allocated buffer without using a memory pool. + \param channel channel to retrieve variable from + \param varname the name of the variable + \param buf a pre allocated buffer to put the value to + \param buflen size of the buffer + \return SWITCH_STATUS_SUCCESS if the value was copied to the buffer and it is not NULL, SWITCH_STATUS_FALSE otherwise. +*/ +SWITCH_DECLARE(switch_status_t) switch_channel_get_variable_buf(switch_channel_t *channel, const char *varname, char *buf, switch_size_t buflen); + SWITCH_DECLARE(switch_status_t) switch_channel_get_variables(switch_channel_t *channel, switch_event_t **event); SWITCH_DECLARE(switch_status_t) switch_channel_get_variables_prefix(switch_channel_t *channel, const char *prefix, switch_event_t **event); SWITCH_DECLARE(switch_status_t) switch_channel_pass_callee_id(switch_channel_t *channel, switch_channel_t *other_channel); diff --git a/src/include/switch_curl.h b/src/include/switch_curl.h index 5872527865..bad116daf2 100644 --- a/src/include/switch_curl.h +++ b/src/include/switch_curl.h @@ -40,6 +40,9 @@ typedef int switch_CURLINFO; typedef int switch_CURLcode; typedef int switch_CURLoption; +#define HAVE_SWITCH_CURL_MIME +typedef void switch_curl_mime; + SWITCH_DECLARE(switch_CURL *) switch_curl_easy_init(void); SWITCH_DECLARE(switch_CURLcode) switch_curl_easy_perform(switch_CURL *handle); SWITCH_DECLARE(switch_CURLcode) switch_curl_easy_getinfo(switch_CURL *curl, switch_CURLINFO info, ... ); @@ -50,7 +53,9 @@ SWITCH_DECLARE(switch_CURLcode) switch_curl_easy_setopt(CURL *handle, switch_CUR SWITCH_DECLARE(const char *) switch_curl_easy_strerror(switch_CURLcode errornum ); SWITCH_DECLARE(void) switch_curl_init(void); SWITCH_DECLARE(void) switch_curl_destroy(void); -SWITCH_DECLARE(switch_status_t) switch_curl_process_form_post_params(switch_event_t *event, switch_CURL *curl_handle, struct curl_httppost **formpostp); +SWITCH_DECLARE(switch_status_t) switch_curl_process_mime(switch_event_t *event, switch_CURL *curl_handle, switch_curl_mime **mimep); +SWITCH_DECLARE(void) switch_curl_mime_free(switch_curl_mime **mimep); +SWITCH_DECLARE(switch_CURLcode) switch_curl_easy_setopt_mime(switch_CURL *curl_handle, switch_curl_mime *mime); #define switch_curl_easy_setopt curl_easy_setopt SWITCH_END_EXTERN_C diff --git a/src/include/switch_rtp.h b/src/include/switch_rtp.h index ca915cf77a..dfcad5453c 100644 --- a/src/include/switch_rtp.h +++ b/src/include/switch_rtp.h @@ -106,12 +106,13 @@ typedef struct icand_s { } icand_t; #define MAX_CAND 50 +#define MAX_CAND_IDX_COUNT 2 typedef struct ice_s { - icand_t cands[MAX_CAND][2]; - int cand_idx[2]; - int chosen[2]; - int is_chosen[2]; + icand_t cands[MAX_CAND][MAX_CAND_IDX_COUNT]; + int cand_idx[MAX_CAND_IDX_COUNT]; + int chosen[MAX_CAND_IDX_COUNT]; + int is_chosen[MAX_CAND_IDX_COUNT]; char *ufrag; char *pwd; char *options; diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 62f3fcd97e..1d33939f4c 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -498,6 +498,14 @@ SWITCH_DECLARE(switch_size_t) switch_fp_read_dline(FILE *fd, char **buf, switch_ SWITCH_DECLARE(switch_status_t) switch_frame_alloc(switch_frame_t **frame, switch_size_t size); SWITCH_DECLARE(switch_status_t) switch_frame_dup(switch_frame_t *orig, switch_frame_t **clone); SWITCH_DECLARE(switch_status_t) switch_frame_free(switch_frame_t **frame); + +/*! \brief Check if a 32 bit unsigned number is in a range. + * \param str string to check. Should not contain non-digit characters. + * \param from start of range including this number + * \param to end of range including this number + * \return true or false + */ +SWITCH_DECLARE(switch_bool_t) switch_is_uint_in_range(const char *str, unsigned int from, unsigned int to); SWITCH_DECLARE(switch_bool_t) switch_is_number(const char *str); SWITCH_DECLARE(switch_bool_t) switch_is_leading_number(const char *str); SWITCH_DECLARE(char *) switch_find_parameter(const char *str, const char *param, switch_memory_pool_t *pool); diff --git a/src/include/test/switch_fct.h b/src/include/test/switch_fct.h index 8cb07cc20f..b28feabb74 100644 --- a/src/include/test/switch_fct.h +++ b/src/include/test/switch_fct.h @@ -255,7 +255,7 @@ fctstr_safe_cpy(char *dst, char const *src, size_t num) #if defined(WIN32) && _MSC_VER >= 1400 strncpy_s(dst, num, src, _TRUNCATE); #else - strncpy(dst, src, num); + strncpy(dst, src, num - 1); #endif dst[num-1] = '\0'; } @@ -760,6 +760,7 @@ fct_nlist__init2(fct_nlist_t *list, size_t start_sz) list->itm_list = (void**)malloc(sizeof(void*)*start_sz); if ( list->itm_list == NULL ) { + list->used_itm_num = 0; return 0; } } diff --git a/src/mod/applications/mod_av/avcodec.c b/src/mod/applications/mod_av/avcodec.c index a9f6d0927e..16d268273b 100644 --- a/src/mod/applications/mod_av/avcodec.c +++ b/src/mod/applications/mod_av/avcodec.c @@ -26,6 +26,7 @@ * Seven Du * Anthony Minessale * Emmanuel Schmidbauer + * Jakub Karolczyk * * mod_avcodec -- Codec with libav.org and ffmpeg * @@ -34,6 +35,9 @@ #include #include "mod_av.h" #include +#ifdef _MSC_VER +#include /* LIBAVCODEC_VERSION_INT */ +#endif #include #include #include @@ -373,8 +377,13 @@ typedef struct our_h264_nalu_s { typedef struct h264_codec_context_s { switch_buffer_t *nalu_buffer; +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) AVCodec *decoder; AVCodec *encoder; +#else + const AVCodec *decoder; + const AVCodec *encoder; +#endif AVCodecContext *decoder_ctx; int got_pps; /* if pps packet received */ int64_t pts; @@ -393,12 +402,13 @@ typedef struct h264_codec_context_s { switch_codec_settings_t codec_settings; AVCodecContext *encoder_ctx; AVFrame *encoder_avframe; - AVPacket encoder_avpacket; + AVPacket *encoder_avpacket; AVFrame *decoder_avframe; our_h264_nalu_t nalus[MAX_NALUS]; enum AVCodecID av_codec_id; uint16_t last_seq; // last received frame->seq int hw_encoder; + switch_packetizer_t *packetizer; } h264_codec_context_t; #ifndef AV_INPUT_BUFFER_PADDING_SIZE @@ -825,7 +835,11 @@ static void fs_rtp_parse_h263_rfc2190(h264_codec_context_t *context, AVPacket *p const uint8_t *p = buf; const uint8_t *buf_base = buf; uint32_t code = (ntohl(*(uint32_t *)buf) & 0xFFFFFC00) >> 10; +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) int mb_info_size = 0; +#else + switch_size_t mb_info_size = 0; +#endif int mb_info_pos = 0, mb_info_count = 0; const uint8_t *mb_info; @@ -889,7 +903,11 @@ static void fs_rtp_parse_h263_rfc2190(h264_codec_context_t *context, AVPacket *p "Unable to split H263 packet! mb_info_pos=%d mb_info_count=%d pos=%d max=%"SWITCH_SIZE_T_FMT"\n", mb_info_pos, mb_info_count, pos, (switch_size_t)(end - buf_base)); } } else { +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Should Not Happen!!! mb_info_pos=%d mb_info_count=%d mb_info_size=%d\n", mb_info_pos, mb_info_count, mb_info_size); +#else + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Should Not Happen!!! mb_info_pos=%d mb_info_count=%d mb_info_size=%ld\n", mb_info_pos, mb_info_count, mb_info_size); +#endif } } } @@ -1033,7 +1051,7 @@ static switch_status_t consume_h263_bitstream(h264_codec_context_t *context, swi } if (!context->nalus[context->nalu_current_index].len) { - av_packet_unref(&context->encoder_avpacket); + av_packet_unref(context->encoder_avpacket); frame->m = 1; } @@ -1081,81 +1099,27 @@ static switch_status_t consume_h263p_bitstream(h264_codec_context_t *context, sw #endif if (frame->m) { - av_packet_unref(&context->encoder_avpacket); + av_packet_unref(context->encoder_avpacket); return SWITCH_STATUS_SUCCESS; } return SWITCH_STATUS_MORE_DATA; } -static switch_status_t consume_h264_bitstream(h264_codec_context_t *context, switch_frame_t *frame) -{ - AVPacket *pkt = &context->encoder_avpacket; - our_h264_nalu_t *nalu = &context->nalus[context->nalu_current_index]; - uint8_t nalu_hdr = *(uint8_t *)(nalu->start); - uint8_t nalu_type = nalu_hdr & 0x1f; - uint8_t nri = nalu_hdr & 0x60; - int left = nalu->len - (nalu->eat - nalu->start); - uint8_t *p = frame->data; - uint8_t start = nalu->start == nalu->eat ? 0x80 : 0; - int n = nalu->len / SLICE_SIZE; - int slice_size = nalu->len / (n + 1) + 1 + 2; - - if (nalu->len <= SLICE_SIZE) { - memcpy(frame->data, nalu->start, nalu->len); - frame->datalen = nalu->len; - context->nalu_current_index++; - - if (context->nalus[context->nalu_current_index].len) { - frame->m = 0; - return SWITCH_STATUS_MORE_DATA; - } - - if (pkt->size > 0) av_packet_unref(pkt); - - switch_clear_flag(frame, SFF_CNG); - frame->m = 1; - - return SWITCH_STATUS_SUCCESS; - } - - if (left <= (slice_size - 2)) { - p[0] = nri | 28; // FU-A - p[1] = 0x40 | nalu_type; - memcpy(p+2, nalu->eat, left); - nalu->eat += left; - frame->datalen = left + 2; - context->nalu_current_index++; - - if (!context->nalus[context->nalu_current_index].len) { - if (pkt->size > 0) av_packet_unref(pkt); - frame->m = 1; - return SWITCH_STATUS_SUCCESS; - } - - return SWITCH_STATUS_MORE_DATA; - } - - p[0] = nri | 28; // FU-A - p[1] = start | nalu_type; - if (start) nalu->eat++; - memcpy(p+2, nalu->eat, slice_size - 2); - nalu->eat += (slice_size - 2); - frame->datalen = slice_size; - frame->m = 0; - return SWITCH_STATUS_MORE_DATA; -} - static switch_status_t consume_nalu(h264_codec_context_t *context, switch_frame_t *frame) { - AVPacket *pkt = &context->encoder_avpacket; + AVPacket *pkt = context->encoder_avpacket; our_h264_nalu_t *nalu = &context->nalus[context->nalu_current_index]; if (!nalu->len) { frame->datalen = 0; frame->m = 0; - if (pkt->size > 0) av_packet_unref(pkt); + if (pkt->size > 0) { + av_packet_unref(pkt); + } + context->nalu_current_index = 0; + return SWITCH_STATUS_NOTFOUND; } @@ -1167,7 +1131,9 @@ static switch_status_t consume_nalu(h264_codec_context_t *context, switch_frame_ return consume_h263p_bitstream(context, frame); } - return consume_h264_bitstream(context, frame); + switch_assert(0); + + return SWITCH_STATUS_FALSE; } static void set_h264_private_data(h264_codec_context_t *context, avcodec_profile_t *profile) @@ -1342,9 +1308,7 @@ FF_ENABLE_DEPRECATION_WARNINGS set_h264_private_data(context, aprofile); } -GCC_DIAG_OFF(deprecated-declarations) avcodec_string(codec_string, sizeof(codec_string), context->encoder_ctx, 0); -GCC_DIAG_ON(deprecated-declarations) dump_encoder_ctx(context->encoder_ctx); @@ -1436,6 +1400,16 @@ static switch_status_t switch_h264_init(switch_codec_t *codec, switch_codec_flag } } + switch (context->av_codec_id) { + case AV_CODEC_ID_H264: + context->packetizer = switch_packetizer_create(SPT_H264_BITSTREAM, SLICE_SIZE); + break; + default: + break; + } + + context->encoder_avpacket = av_packet_alloc(); + switch_buffer_create_dynamic(&(context->nalu_buffer), H264_NALU_BUFFER_SIZE, H264_NALU_BUFFER_SIZE * 8, 0); codec->private_info = context; @@ -1460,7 +1434,7 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t int ret; int *got_output = &context->got_encoded_output; AVFrame *avframe = NULL; - AVPacket *pkt = &context->encoder_avpacket; + AVPacket **pkt = &context->encoder_avpacket; uint32_t width = 0; uint32_t height = 0; switch_image_t *img = frame->img; @@ -1480,6 +1454,16 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t } if (frame->flags & SFF_SAME_IMAGE) { + if (context->packetizer) { + switch_status_t status = switch_packetizer_read(context->packetizer, frame); + + if (status == SWITCH_STATUS_SUCCESS && (*pkt)->size > 0) { + av_packet_unref(*pkt); + } + + return status; + } + // read from nalu buffer return consume_nalu(context, frame); } @@ -1489,6 +1473,7 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t if (open_encoder(context, width, height) != SWITCH_STATUS_SUCCESS) { goto error; } + avctx = context->encoder_ctx; } @@ -1498,6 +1483,7 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t if (open_encoder(context, width, height) != SWITCH_STATUS_SUCCESS) { goto error; } + avctx = context->encoder_ctx; } @@ -1507,13 +1493,13 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t if (open_encoder(context, width, height) != SWITCH_STATUS_SUCCESS) { goto error; } + avctx = context->encoder_ctx; switch_set_flag(frame, SFF_WAIT_KEY_FRAME); } - av_init_packet(pkt); - pkt->data = NULL; // packet data will be allocated by the encoder - pkt->size = 0; + av_packet_unref(*pkt); + /* packet data will be allocated by the encoder */ avframe = context->encoder_avframe; @@ -1578,14 +1564,42 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t /* encode the image */ memset(context->nalus, 0, sizeof(context->nalus)); context->nalu_current_index = 0; +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) GCC_DIAG_OFF(deprecated-declarations) - ret = avcodec_encode_video2(avctx, pkt, avframe, got_output); + ret = avcodec_encode_video2(avctx, *pkt, avframe, got_output); GCC_DIAG_ON(deprecated-declarations) if (ret < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Encoding Error %d\n", ret); goto error; } +#else + ret = avcodec_send_frame(avctx, avframe); + + if (ret == AVERROR_EOF) { + ret = 0; + } else if (ret == AVERROR(EAGAIN)) { + /* we fully drain all the output in each encode call, so this should not ever happen */ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Error sending frame to encoder - BUG, should never happen\n"); + ret = AVERROR_BUG; + goto error; + } else if (ret < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error sending frame to encoder\n"); + goto error; + } + + while (ret >= 0) { + ret = avcodec_receive_packet(avctx, *pkt); + if (ret == AVERROR(EAGAIN)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "No more video packets at the moment\n"); + } else if (ret == AVERROR_EOF) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "No more video packets at all\n"); + } else if (ret < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Encoding error\n"); + av_packet_unref(*pkt); + goto error; + } +#endif if (context->need_key_frame && avframe->key_frame == 1) { avframe->pict_type = 0; @@ -1595,81 +1609,78 @@ GCC_DIAG_ON(deprecated-declarations) // process: +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) if (*got_output) { - const uint8_t *p = pkt->data; - int i = 0; +#else + if (ret >= 0) { +#endif + switch_status_t status = SWITCH_STATUS_SUCCESS; *got_output = 0; if (context->av_codec_id == AV_CODEC_ID_H263) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG5, "Encoded frame %" SWITCH_INT64_T_FMT " (size=%5d) [0x%02x 0x%02x 0x%02x 0x%02x] got_output: %d slices: %d\n", - context->pts, pkt->size, *((uint8_t *)pkt->data), *((uint8_t *)(pkt->data + 1)), *((uint8_t *)(pkt->data + 2)), - *((uint8_t *)(pkt->data + 3)), *got_output, avctx->slices); + context->pts, (*pkt)->size, *((uint8_t *)(*pkt)->data), *((uint8_t *)((*pkt)->data + 1)), *((uint8_t *)((*pkt)->data + 2)), + *((uint8_t *)((*pkt)->data + 3)), *got_output, avctx->slices); #ifdef H263_MODE_B - fs_rtp_parse_h263_rfc2190(context, pkt); + fs_rtp_parse_h263_rfc2190(context, *pkt); #endif context->nalu_current_index = 0; + return consume_nalu(context, frame); } else if (context->av_codec_id == AV_CODEC_ID_H263P){ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG5, "Encoded frame %" SWITCH_INT64_T_FMT " (size=%5d) [0x%02x 0x%02x 0x%02x 0x%02x] got_output: %d slices: %d\n", - context->pts, pkt->size, *((uint8_t *)pkt->data), *((uint8_t *)(pkt->data + 1)), *((uint8_t *)(pkt->data + 2)), - *((uint8_t *)(pkt->data + 3)), *got_output, avctx->slices); - fs_rtp_parse_h263_rfc4629(context, pkt); + context->pts, (*pkt)->size, *((uint8_t *)(*pkt)->data), *((uint8_t *)((*pkt)->data + 1)), *((uint8_t *)((*pkt)->data + 2)), + *((uint8_t *)((*pkt)->data + 3)), *got_output, avctx->slices); + fs_rtp_parse_h263_rfc4629(context, *pkt); context->nalu_current_index = 0; + return consume_nalu(context, frame); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG5, "Encoded frame %" SWITCH_INT64_T_FMT " (size=%5d) nalu_type=0x%x %d\n", - context->pts, pkt->size, *((uint8_t *)pkt->data +4), *got_output); - } - /* split into nalus */ - memset(context->nalus, 0, sizeof(context->nalus)); - - while ((p = fs_avc_find_startcode(p, pkt->data+pkt->size)) < (pkt->data + pkt->size)) { - if (!context->nalus[i].start) { - while (!(*p++)) ; /* eat the sync bytes, what ever 0 0 1 or 0 0 0 1 */ - context->nalus[i].start = p; - context->nalus[i].eat = p; - - if ((*p & 0x1f) == 7) { // Got Keyframe - // prevent to generate key frame too frequently - context->last_keyframe_request = switch_time_now(); - if (mod_av_globals.debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "KEY FRAME GENERATED\n"); - } - } - } else { - context->nalus[i].len = p - context->nalus[i].start; - while (!(*p++)) ; /* eat the sync bytes, what ever 0 0 1 or 0 0 0 1 */ - i++; - context->nalus[i].start = p; - context->nalus[i].eat = p; - } - if (i >= MAX_NALUS - 2) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "TOO MANY SLICES!\n"); - break; - } + context->pts, (*pkt)->size, *((uint8_t *)(*pkt)->data +4), *got_output); } - context->nalus[i].len = p - context->nalus[i].start; - context->nalu_current_index = 0; - return consume_nalu(context, frame); + status = switch_packetizer_feed(context->packetizer, (*pkt)->data, (*pkt)->size); + if (status != SWITCH_STATUS_SUCCESS) { + if ((*pkt)->size > 0) { + av_packet_unref(*pkt); + } + + return status; + } + + status = switch_packetizer_read(context->packetizer, frame); + if (status == SWITCH_STATUS_SUCCESS && (*pkt)->size > 0) { + av_packet_unref(*pkt); + } + + return status; } +#if (LIBAVCODEC_VERSION_MAJOR >= LIBAVCODEC_V) + break; + } +#endif + error: frame->datalen = 0; + return SWITCH_STATUS_FALSE; } static switch_status_t switch_h264_decode(switch_codec_t *codec, switch_frame_t *frame) { h264_codec_context_t *context = (h264_codec_context_t *)codec->private_info; - AVCodecContext *avctx= context->decoder_ctx; switch_status_t status; +#if (LIBAVCODEC_VERSION_MAJOR >= LIBAVCODEC_V) + int ret = 0; +#endif switch_assert(frame); @@ -1702,27 +1713,57 @@ static switch_status_t switch_h264_decode(switch_codec_t *codec, switch_frame_t if (frame->m) { uint32_t size = switch_buffer_inuse(context->nalu_buffer); - AVPacket pkt = { 0 }; + AVPacket *pkt = NULL; AVFrame *picture; +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) int got_picture = 0; int decoded_len; +#endif if (size > 0) { - av_init_packet(&pkt); + pkt = av_packet_alloc(); switch_buffer_zero_fill(context->nalu_buffer, AV_INPUT_BUFFER_PADDING_SIZE); - switch_buffer_peek_zerocopy(context->nalu_buffer, (const void **)&pkt.data); - pkt.size = size; + switch_buffer_peek_zerocopy(context->nalu_buffer, (const void **)&pkt->data); + pkt->size = size; if (!context->decoder_avframe) context->decoder_avframe = av_frame_alloc(); picture = context->decoder_avframe; switch_assert(picture); +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) GCC_DIAG_OFF(deprecated-declarations) - decoded_len = avcodec_decode_video2(avctx, picture, &got_picture, &pkt); + decoded_len = avcodec_decode_video2(context->decoder_ctx, picture, &got_picture, pkt); GCC_DIAG_ON(deprecated-declarations) +#else + ret = avcodec_send_packet(context->decoder_ctx, pkt); + + if (ret == AVERROR_EOF) { + ret = 0; + } else if (ret == AVERROR(EAGAIN)) { + /* we fully drain all the output in each decode call, so this should not ever happen */ + ret = AVERROR_BUG; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error sending packet to decoder BUG, should never happen\n"); + } else if (ret < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error sending packet to decoder\n"); + } + + while (ret >= 0) { + ret = avcodec_receive_frame(context->decoder_ctx, picture); + if (ret == AVERROR(EAGAIN)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "No more video frames at the moment\n"); + } else if (ret == AVERROR_EOF) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "No more video frames at all\n"); + } else if (ret < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Video decoding error\n"); + } +#endif // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buffer: %d got pic: %d len: %d [%dx%d]\n", size, got_picture, decoded_len, picture->width, picture->height); +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) if (got_picture && decoded_len > 0) { +#else + if (ret >= 0) { +#endif int width = picture->width; int height = picture->height; @@ -1744,7 +1785,15 @@ GCC_DIAG_ON(deprecated-declarations) frame->img = context->img; } +#if (LIBAVCODEC_VERSION_MAJOR >= LIBAVCODEC_V) + if (ret < 0) { + break; + } + } +#endif + av_frame_unref(picture); + av_packet_free(&pkt); } switch_buffer_zero(context->nalu_buffer); @@ -1825,6 +1874,10 @@ static switch_status_t switch_h264_destroy(switch_codec_t *codec) av_free(context->encoder_ctx); } + if (context->packetizer) { + switch_packetizer_close(&context->packetizer); + } + if (context->encoder_avframe) { av_frame_free(&context->encoder_avframe); } @@ -1833,6 +1886,10 @@ static switch_status_t switch_h264_destroy(switch_codec_t *codec) av_frame_free(&context->decoder_avframe); } + if (context->encoder_avpacket) { + av_packet_free(&context->encoder_avpacket); + } + return SWITCH_STATUS_SUCCESS; } @@ -1860,8 +1917,10 @@ static const AVCodec *next_codec_for_id(enum AVCodecID id, const AVCodec *prev, #endif if (prev->id == id && (encoder ? av_codec_is_encoder(prev) : av_codec_is_decoder(prev))) + return prev; } + return NULL; } @@ -2208,7 +2267,7 @@ static void parse_codecs(avcodec_profile_t *aprofile, switch_xml_t codecs) } -static void load_config() +static void load_config(void) { switch_xml_t cfg = NULL, xml = NULL; diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index 1f767d0bde..69475c169f 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -25,6 +25,7 @@ * * Seven Du * Anthony Minessale + * Jakub Karolczyk * * mod_avformat -- File Formats with libav.org * @@ -34,7 +35,13 @@ #include "mod_av.h" GCC_DIAG_OFF(deprecated-declarations) #include +#ifdef _MSC_VER +#include /* LIBAVCODEC_VERSION_INT */ +#endif #include +#ifdef _MSC_VER +#include /* LIBAVFORMAT_VERSION_INT */ +#endif #include #include #include @@ -88,7 +95,9 @@ typedef struct MediaStream { AVStream *st; AVFrame *frame; AVFrame *tmp_frame; - +#if (LIBAVFORMAT_VERSION_MAJOR >= LIBAVFORMAT_V) + AVCodecContext *codec; +#endif // audio int channels; int sample_rate; @@ -137,8 +146,13 @@ struct av_file_context { MediaStream video_st; MediaStream audio_st[2]; AVFormatContext *fc; +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) AVCodec *audio_codec; AVCodec *video_codec; +#else + const AVCodec *audio_codec; + const AVCodec *video_codec; +#endif enum AVColorSpace colorspace; int has_audio; @@ -220,9 +234,57 @@ static inline char *av_ts_make_time_string(char *buf, int64_t ts, AVRational *tb static switch_status_t av_file_close(switch_file_handle_t *handle); SWITCH_MODULE_LOAD_FUNCTION(mod_avformat_load); +static inline AVCodecContext *av_get_codec_context(MediaStream *stream) +{ + AVCodecContext *c = NULL; + +#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_V) +GCC_DIAG_OFF(deprecated-declarations) + if (stream->st) { + c = stream->st->codec; + } +GCC_DIAG_ON(deprecated-declarations) +#else + c = stream->codec; +#endif + + return c; +} + +static inline enum AVCodecID av_get_codec_id(AVStream *av_stream) +{ + if (!av_stream) { + return AV_CODEC_ID_NONE; + } + +#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_V) +GCC_DIAG_OFF(deprecated-declarations) + return av_stream->codec->codec_id; +GCC_DIAG_ON(deprecated-declarations) +#else + return av_stream->codecpar->codec_id; +#endif +} + +static inline enum AVMediaType av_get_codec_type(AVStream *av_stream) +{ + if (!av_stream) { + return AVMEDIA_TYPE_UNKNOWN; + } + +#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_V) +GCC_DIAG_OFF(deprecated-declarations) + return av_stream->codec->codec_type; +GCC_DIAG_ON(deprecated-declarations) +#else + return av_stream->codecpar->codec_type; +#endif +} + static char *const get_error_text(const int error, char *error_buffer, switch_size_t error_buflen) { av_strerror(error, error_buffer, error_buflen); + return error_buffer; } @@ -354,18 +416,24 @@ static int interrupt_cb(void *cp) } -static int mod_avformat_alloc_output_context2(AVFormatContext **avctx, AVOutputFormat *oformat, - const char *format, const char *filename, av_file_context_t *context) +static int mod_avformat_alloc_output_context2(AVFormatContext **avctx, const char *format, const char *filename, av_file_context_t *context) { AVFormatContext *s = avformat_alloc_context(); int ret = 0; +#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_V) + AVOutputFormat *oformat = NULL; +#else + const AVOutputFormat *oformat = NULL; +#endif + s->interrupt_callback.callback = interrupt_cb; s->interrupt_callback.opaque = context; - + *avctx = NULL; - if (!s) + if (!s) { goto nomem; + } if (!oformat) { if (format) { @@ -389,14 +457,17 @@ static int mod_avformat_alloc_output_context2(AVFormatContext **avctx, AVOutputF s->oformat = oformat; if (s->oformat->priv_data_size > 0) { s->priv_data = av_mallocz(s->oformat->priv_data_size); - if (!s->priv_data) + if (!s->priv_data) { goto nomem; + } + if (s->oformat->priv_class) { *(const AVClass**)s->priv_data= s->oformat->priv_class; av_opt_set_defaults(s->priv_data); } - } else + } else { s->priv_data = NULL; + } if (filename) { #if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58,7,100)) @@ -408,12 +479,14 @@ static int mod_avformat_alloc_output_context2(AVFormatContext **avctx, AVOutputF } *avctx = s; + return 0; nomem: av_log(s, AV_LOG_ERROR, "Out of memory\n"); ret = AVERROR(ENOMEM); error: avformat_free_context(s); + return ret; } @@ -429,9 +502,13 @@ static int write_frame(AVFormatContext *fmt_ctx, const AVRational *time_base, AV } /* Add an output stream. */ +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) static switch_status_t add_stream(av_file_context_t *context, MediaStream *mst, AVFormatContext *fc, AVCodec **codec, enum AVCodecID codec_id, switch_mm_t *mm) +#else +static switch_status_t add_stream(av_file_context_t *context, MediaStream *mst, AVFormatContext *fc, const AVCodec **codec, enum AVCodecID codec_id, switch_mm_t *mm) +#endif { - AVCodecContext *c; + AVCodecContext *c = NULL; switch_status_t status = SWITCH_STATUS_FALSE; //int threads = switch_core_cpu_count(); int buffer_bytes = 2097152; /* 2 mb */ @@ -457,9 +534,19 @@ static switch_status_t add_stream(av_file_context_t *context, MediaStream *mst, return status; } mst->st->id = fc->nb_streams - 1; -GCC_DIAG_OFF(deprecated-declarations) - c = mst->st->codec; -GCC_DIAG_ON(deprecated-declarations) + +#if (LIBAVCODEC_VERSION_MAJOR >= LIBAVCODEC_V) + mst->codec = avcodec_alloc_context3(*codec); + + if (!mst->codec) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate codec context\n"); + + return status; + } +#endif + + c = av_get_codec_context(mst); + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "id:%d den:%d num:%d\n", mst->st->id, mst->st->time_base.den, mst->st->time_base.num); //if (threads > 4) { @@ -471,8 +558,12 @@ GCC_DIAG_ON(deprecated-declarations) c->sample_fmt = (*codec)->sample_fmts ? (*codec)->sample_fmts[0] : AV_SAMPLE_FMT_FLTP; c->bit_rate = 128000; c->sample_rate = mst->sample_rate = context->handle->samplerate; +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) c->channels = mst->channels; c->channel_layout = av_get_default_channel_layout(c->channels); +#else + av_channel_layout_default(&c->ch_layout, mst->channels); +#endif if (mm) { if (mm->ab) { @@ -651,23 +742,28 @@ static AVFrame *alloc_picture(enum AVPixelFormat pix_fmt, int width, int height) return picture; } +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) static switch_status_t open_video(AVFormatContext *fc, AVCodec *codec, MediaStream *mst) +#else +static switch_status_t open_video(AVFormatContext *fc, const AVCodec *codec, MediaStream *mst) +#endif { int ret; -GCC_DIAG_OFF(deprecated-declarations) - AVCodecContext *c = mst->st->codec; -GCC_DIAG_ON(deprecated-declarations) + AVCodecContext *c = NULL; switch_status_t status = SWITCH_STATUS_FALSE; //int threads = switch_core_cpu_count(); // if (threads > 4) threads = 4; // c->thread_count = threads; + c = av_get_codec_context(mst); + /* open the codec */ ret = avcodec_open2(c, codec, NULL); if (ret < 0) { char ebuf[255] = ""; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not open video codec: %s\n", get_error_text(ret, ebuf, sizeof(ebuf))); + return status; } @@ -679,17 +775,29 @@ GCC_DIAG_ON(deprecated-declarations) // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "pix_fmt: %d\n", c->pix_fmt); switch_assert(c->pix_fmt == AV_PIX_FMT_YUV420P); // always I420 for NOW +#if (LIBAVCODEC_VERSION_MAJOR >= LIBAVCODEC_V) + if (((ret = avcodec_parameters_from_context(mst->st->codecpar, mst->codec)) < 0)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not copy to codec params ret=%d\n", ret); + + return SWITCH_STATUS_FALSE; + } +#endif + return SWITCH_STATUS_SUCCESS; } +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) static switch_status_t open_audio(AVFormatContext *fc, AVCodec *codec, MediaStream *mst) +#else +static switch_status_t open_audio(AVFormatContext *fc, const AVCodec *codec, MediaStream *mst) +#endif { - AVCodecContext *c; + AVCodecContext *c = NULL; int ret; switch_status_t status = SWITCH_STATUS_FALSE; -GCC_DIAG_OFF(deprecated-declarations) - c = mst->st->codec; -GCC_DIAG_ON(deprecated-declarations) + + c = av_get_codec_context(mst); + ret = avcodec_open2(c, codec, NULL); if (ret == AVERROR_EXPERIMENTAL) { @@ -711,11 +819,19 @@ GCC_DIAG_ON(deprecated-declarations) mst->frame->sample_rate = c->sample_rate; mst->frame->format = AV_SAMPLE_FMT_S16; +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) mst->frame->channel_layout = c->channel_layout; +#else + mst->frame->ch_layout = c->ch_layout; +#endif if (c->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE) { //mst->frame->nb_samples = 10000; - mst->frame->nb_samples = (mst->frame->sample_rate / 50) * c->channels; +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) + mst->frame->nb_samples = (mst->frame->sample_rate / 50) * c->channels; +#else + mst->frame->nb_samples = (mst->frame->sample_rate / 50) * c->ch_layout.nb_channels; +#endif } else { mst->frame->nb_samples = c->frame_size; } @@ -733,19 +849,33 @@ GCC_DIAG_ON(deprecated-declarations) } /* set options */ +#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(59,27,100)) /* FFmpeg 5.0 */ av_opt_set_int(mst->resample_ctx, "in_channel_count", c->channels, 0); +#else /* FFmpeg 5.1 */ + av_opt_set_chlayout(mst->resample_ctx, "in_chlayout", &c->ch_layout, 0); +#endif av_opt_set_int(mst->resample_ctx, "in_sample_rate", c->sample_rate, 0); +#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(59,27,100)) av_opt_set_int(mst->resample_ctx, "in_sample_fmt", AV_SAMPLE_FMT_S16, 0); av_opt_set_int(mst->resample_ctx, "in_channel_layout", c->channel_layout, 0); av_opt_set_int(mst->resample_ctx, "out_channel_count", c->channels, 0); +#else + av_opt_set_sample_fmt(mst->resample_ctx, "in_sample_fmt", AV_SAMPLE_FMT_S16, 0); + av_opt_set_chlayout(mst->resample_ctx, "out_chlayout", &c->ch_layout, 0); +#endif av_opt_set_int(mst->resample_ctx, "out_sample_rate", c->sample_rate, 0); +#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(59,27,100)) av_opt_set_int(mst->resample_ctx, "out_sample_fmt", c->sample_fmt, 0); av_opt_set_int(mst->resample_ctx, "out_channel_layout", c->channel_layout, 0); +#else + av_opt_set_sample_fmt(mst->resample_ctx, "out_sample_fmt", c->sample_fmt, 0); +#endif if (swr_init(mst->resample_ctx) < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to initialize the resampling context\n"); av_free(mst->resample_ctx); mst->resample_ctx = NULL; + return status; } } @@ -753,6 +883,7 @@ GCC_DIAG_ON(deprecated-declarations) ret = av_frame_get_buffer(mst->frame, 0); if (ret < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate audio frame.\n"); + return status; } @@ -762,7 +893,11 @@ GCC_DIAG_ON(deprecated-declarations) mst->tmp_frame->sample_rate = c->sample_rate; mst->tmp_frame->format = c->sample_fmt; +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) mst->tmp_frame->channel_layout = c->channel_layout; +#else + mst->tmp_frame->ch_layout = c->ch_layout; +#endif mst->tmp_frame->nb_samples = mst->frame->nb_samples; ret = av_frame_get_buffer(mst->tmp_frame, 0); @@ -772,6 +907,14 @@ GCC_DIAG_ON(deprecated-declarations) } } +#if (LIBAVCODEC_VERSION_MAJOR >= LIBAVCODEC_V) + if (((ret = avcodec_parameters_from_context(mst->st->codecpar, mst->codec)) < 0)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not copy to codec params ret=%d\n", ret); + + return SWITCH_STATUS_FALSE; + } +#endif + return SWITCH_STATUS_SUCCESS; } @@ -797,8 +940,7 @@ static void flush_video_pkt_queue(switch_queue_t *q) AVPacket *pkt; while (switch_queue_trypop(q, (void **)&pkt) == SWITCH_STATUS_SUCCESS) { - av_packet_unref(pkt); - free(pkt); + av_packet_free(&pkt); } } @@ -811,12 +953,16 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void * int size = 0, skip = 0, skip_freq = 0, skip_count = 0, skip_total = 0, skip_total_count = 0; uint64_t delta_avg = 0, delta_sum = 0, delta_i = 0, delta = 0; int first = 1; + AVCodecContext *c = NULL; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "video thread start\n"); - switch_assert(context->eh.video_queue); + switch_assert(context->eh.video_queue); + for(;;) { - AVPacket pkt = { 0 }; + AVPacket *pkt = NULL; +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) int got_packet; +#endif int ret = -1; top: @@ -829,7 +975,7 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void * switch_img_free(&tmp_img); } if (switch_queue_pop(context->eh.video_queue, &pop) == SWITCH_STATUS_SUCCESS) { - switch_img_free(&img); + switch_img_free(&img); if (!pop) { goto endfor; @@ -877,8 +1023,6 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void * context->eh.in_callback = 1; - av_init_packet(&pkt); - if (context->eh.video_st->frame) { ret = av_frame_make_writable(context->eh.video_st->frame); } @@ -890,7 +1034,7 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void * if (context->eh.record_timer_paused) { context->eh.last_ts = 0; continue; - } + } fill_avframe(context->eh.video_st->frame, img); @@ -937,59 +1081,149 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void * } } + pkt = av_packet_alloc(); + context->eh.last_ts = context->eh.video_st->frame->pts; // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "pts: %" SWITCH_INT64_T_FMT "\n", context->eh.video_st->frame->pts); /* encode the image */ + c = av_get_codec_context(context->eh.video_st); + +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) GCC_DIAG_OFF(deprecated-declarations) - ret = avcodec_encode_video2(context->eh.video_st->st->codec, &pkt, context->eh.video_st->frame, &got_packet); + ret = avcodec_encode_video2(c, pkt, context->eh.video_st->frame, &got_packet); GCC_DIAG_ON(deprecated-declarations) - + if (ret < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Encoding Error %d\n", ret); + c = NULL; + av_packet_free(&pkt); continue; } if (got_packet) { +#else + ret = avcodec_send_frame(c, context->eh.video_st->frame); + + if (ret == AVERROR_EOF) { + ret = 0; + } else if (ret == AVERROR(EAGAIN)) { + /* we fully drain all the output in each encode call, so this should not ever happen */ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Error sending frame to encoder AVERROR_BUG - should never happen\n"); + ret = AVERROR_BUG; + } else if (ret < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Error sending frame to encoder\n"); + } + + while (ret >= 0) { + ret = avcodec_receive_packet(c, pkt); + if (ret == AVERROR(EAGAIN)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "No more video packets at the moment\n"); + break; + } else if (ret == AVERROR_EOF) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "No more video packets at all\n"); + break; + } else if (ret < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Encoding error\n"); + break; + } +#endif + switch_mutex_lock(context->eh.mutex); -GCC_DIAG_OFF(deprecated-declarations) - write_frame(context->eh.fc, &context->eh.video_st->st->codec->time_base, context->eh.video_st->st, &pkt); -GCC_DIAG_ON(deprecated-declarations) + write_frame(context->eh.fc, &c->time_base, context->eh.video_st->st, pkt); switch_mutex_unlock(context->eh.mutex); - av_packet_unref(&pkt); } context->eh.in_callback = 0; + av_packet_free(&pkt); + c = NULL; //switch_mutex_unlock(context->eh.mutex); } endfor: for(;;) { - AVPacket pkt = { 0 }; - int got_packet = 0; + AVPacket *pkt = av_packet_alloc(); int ret = 0; +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) + int got_packet = 0; +#else + int wret = 0; +#endif - av_init_packet(&pkt); + c = av_get_codec_context(context->eh.video_st); -GCC_DIAG_OFF(deprecated-declarations) - ret = avcodec_encode_video2(context->eh.video_st->st->codec, &pkt, NULL, &got_packet); +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) +GCC_DIAG_OFF(deprecated-declarations) + ret = avcodec_encode_video2(c, pkt, NULL, &got_packet); GCC_DIAG_ON(deprecated-declarations) if (ret < 0) { - break; + goto do_break; } else if (got_packet) { - switch_mutex_lock(context->eh.mutex); -GCC_DIAG_OFF(deprecated-declarations) - ret = write_frame(context->eh.fc, &context->eh.video_st->st->codec->time_base, context->eh.video_st->st, &pkt); -GCC_DIAG_ON(deprecated-declarations) - switch_mutex_unlock(context->eh.mutex); - av_packet_unref(&pkt); - if (ret < 0) break; - } else { +#else + ret = avcodec_send_frame(c, NULL); + + if (ret == AVERROR_EOF) { + ret = 0; + } else if (ret == AVERROR(EAGAIN)) { + /* we fully drain all the output in each encode call, so this should not ever happen */ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Error sending frame to encoder on draining AVERROR_BUG - should never happen\n"); + ret = AVERROR_BUG; + goto do_break; + } else if (ret < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Error sending frame to encoder on draining\n"); + c = NULL; + goto do_break; + } + + while (ret >= 0) { + ret = avcodec_receive_packet(c, pkt); + if (ret == AVERROR(EAGAIN)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "No more video packets at the moment on draining\n"); + break; + } else if (ret == AVERROR_EOF) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "No more video packets at all on draining \n"); + break; + } else if (ret < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Encoding error on draining\n"); break; } +#endif + switch_mutex_lock(context->eh.mutex); +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) + ret = write_frame(context->eh.fc, &c->time_base, context->eh.video_st->st, pkt); +#else + wret = write_frame(context->eh.fc, &c->time_base, context->eh.video_st->st, pkt); +#endif + switch_mutex_unlock(context->eh.mutex); +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) + if (ret < 0) { + goto do_break; + } + } else { + goto do_break; +#else + if (wret < 0) { + goto do_break; + } +#endif + } + + av_packet_free(&pkt); + c = NULL; + +#if (LIBAVCODEC_VERSION_MAJOR >= LIBAVCODEC_V) + if (ret < 0 && ret != AVERROR(EAGAIN)) { + break; + } +#endif + + continue; + do_break: + av_packet_free(&pkt); + break; } while(switch_queue_trypop(context->eh.video_queue, &pop) == SWITCH_STATUS_SUCCESS) { @@ -1006,6 +1240,8 @@ GCC_DIAG_ON(deprecated-declarations) static void close_stream(AVFormatContext *fc, MediaStream *mst) { + AVCodecContext *c = NULL; + if (!mst->active) return; if (mst->resample_ctx) swr_free(&mst->resample_ctx); @@ -1013,12 +1249,13 @@ static void close_stream(AVFormatContext *fc, MediaStream *mst) if (mst->frame) av_frame_free(&mst->frame); if (mst->tmp_frame) av_frame_free(&mst->tmp_frame); -GCC_DIAG_OFF(deprecated-declarations) - if (mst->st && mst->st->codec) { - avcodec_close(mst->st->codec); - } -GCC_DIAG_ON(deprecated-declarations) - + c = av_get_codec_context(mst); +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) + avcodec_close(c); +#else + /* avcodec_close() will be called in avcodec_free_context() */ + avcodec_free_context(&c); +#endif mst->active = 0; } @@ -1136,8 +1373,15 @@ static void mod_avformat_destroy_output_context(av_file_context_t *context) static switch_status_t open_input_file(av_file_context_t *context, switch_file_handle_t *handle, const char *filename) { +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) AVCodec *audio_codec = NULL; AVCodec *video_codec = NULL; +#else + const AVCodec *audio_codec = NULL; + const AVCodec *video_codec = NULL; +#endif + enum AVCodecID codec_id; + AVCodecContext *cc = NULL; AVDictionary *opts = NULL; int error; int i, idx = 0; @@ -1147,7 +1391,7 @@ static switch_status_t open_input_file(av_file_context_t *context, switch_file_h /** Open the input file to read from it. */ - if (!context->fc) { + if (!context->fc) { context->fc = avformat_alloc_context(); } @@ -1166,7 +1410,7 @@ static switch_status_t open_input_file(av_file_context_t *context, switch_file_h context->fc = NULL; switch_goto_status(SWITCH_STATUS_FALSE, err); } - + handle->seekable = context->fc->iformat->read_seek2 ? 1 : (context->fc->iformat->read_seek ? 1 : 0); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "file %s is %sseekable\n", filename, handle->seekable ? "" : "not "); @@ -1183,15 +1427,16 @@ static switch_status_t open_input_file(av_file_context_t *context, switch_file_h av_dump_format(context->fc, 0, filename, 0); for (i = 0; i< context->fc->nb_streams; i++) { -GCC_DIAG_OFF(deprecated-declarations) - if (context->fc->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO && context->has_audio < 2 && idx < 2) { + enum AVMediaType codec_type = av_get_codec_type(context->fc->streams[i]); + + if (codec_type == AVMEDIA_TYPE_AUDIO && context->has_audio < 2 && idx < 2) { context->audio_st[idx++].st = context->fc->streams[i]; context->has_audio++; - } else if (context->fc->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO && !context->has_video) { -GCC_DIAG_ON(deprecated-declarations) + } else if (codec_type == AVMEDIA_TYPE_VIDEO && !context->has_video) { context->video_st.st = context->fc->streams[i]; if (switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO)) { context->has_video = 1; +#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_V) handle->duration = av_rescale_q(context->video_st.st->duration != AV_NOPTS_VALUE ? context->video_st.st->duration : context->fc->duration / AV_TIME_BASE * 1000, context->video_st.st->time_base, AV_TIME_BASE_Q); } @@ -1207,42 +1452,95 @@ GCC_DIAG_ON(deprecated-declarations) } context->read_fps = (int)handle->mm.source_fps; +#else + } +#endif } } /** Find a decoder for the audio stream. */ -GCC_DIAG_OFF(deprecated-declarations) - if (context->has_audio && !(audio_codec = avcodec_find_decoder(context->audio_st[0].st->codec->codec_id))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not find input codec %d\n", context->audio_st[0].st->codec->codec_id); + if (context->has_audio && !(audio_codec = avcodec_find_decoder((codec_id = av_get_codec_id(context->audio_st[0].st))))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not find input codec %d\n", codec_id); context->has_audio = 0; } - if (context->has_video && !(video_codec = avcodec_find_decoder(context->video_st.st->codec->codec_id))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find input codec %d\n", context->video_st.st->codec->codec_id); + if (context->has_video && !(video_codec = avcodec_find_decoder((codec_id = av_get_codec_id(context->video_st.st))))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find input codec %d\n", codec_id); context->has_video = 0; } - if (context->has_audio && (error = avcodec_open2(context->audio_st[0].st->codec, audio_codec, NULL)) < 0) { +#if (LIBAVFORMAT_VERSION_MAJOR >= LIBAVFORMAT_V) + if (context->has_audio == 2) { + context->audio_st[1].codec = avcodec_alloc_context3(audio_codec); + context->audio_st[0].codec = avcodec_alloc_context3(audio_codec); + } else if (context->has_audio) { + context->audio_st[0].codec = avcodec_alloc_context3(audio_codec); + } + + if (context->has_video) { + context->video_st.codec = avcodec_alloc_context3(video_codec); + } +#endif + + cc = av_get_codec_context(&context->audio_st[0]); +#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_V) + if (context->has_audio && ((error = avcodec_open2(cc, audio_codec, NULL)) < 0)) { +#else + if (context->has_audio && (((error = avcodec_parameters_to_context(cc, context->audio_st[0].st->codecpar)) < 0) || ((error = avcodec_open2(cc, audio_codec, NULL)) < 0))) { +#endif char ebuf[255] = ""; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not open input audio codec (error '%s')\n", get_error_text(error, ebuf, sizeof(ebuf))); context->has_audio = 0; } - if (context->has_audio == 2 && (error = avcodec_open2(context->audio_st[1].st->codec, audio_codec, NULL)) < 0) { + cc = av_get_codec_context(&context->audio_st[1]); +#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_V) + if (context->has_audio == 2 && ((error = avcodec_open2(cc, audio_codec, NULL)) < 0)) { +#else + if (context->has_audio == 2 && (((error = avcodec_parameters_to_context(cc, context->audio_st[1].st->codecpar)) < 0) || ((error = avcodec_open2(cc, audio_codec, NULL)) < 0))) { +#endif char ebuf[255] = ""; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not open input audio codec channel 2 (error '%s')\n", get_error_text(error, ebuf, sizeof(ebuf))); - if (context->audio_st[0].st->codec) { - avcodec_close(context->audio_st[0].st->codec); + if ((cc = av_get_codec_context(&context->audio_st[0]))) { + avcodec_close(cc); } + context->has_audio = 0; } - if (context->has_video && (error = avcodec_open2(context->video_st.st->codec, video_codec, NULL)) < 0) { + cc = av_get_codec_context(&context->video_st); + +#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_V) + if (context->has_video && (error = avcodec_open2(cc, video_codec, NULL)) < 0) { +#else + if (context->has_video) { + if (((error = avcodec_parameters_to_context(cc, context->video_st.st->codecpar)) < 0) || ((error = avcodec_open2(cc, video_codec, NULL)) < 0)) { +#endif char ebuf[255] = ""; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not open input codec (error '%s')\n", get_error_text(error, ebuf, sizeof(ebuf))); context->has_video = 0; } -GCC_DIAG_ON(deprecated-declarations) + +#if (LIBAVFORMAT_VERSION_MAJOR >= LIBAVFORMAT_V) + handle->duration = av_rescale_q(context->video_st.st->duration != AV_NOPTS_VALUE ? context->video_st.st->duration : context->fc->duration / AV_TIME_BASE * 1000, + context->video_st.st->time_base, AV_TIME_BASE_Q); + + if (context->fc->bit_rate) { + handle->mm.source_kps = context->fc->bit_rate / 1024; + } + + if (context->video_st.st->avg_frame_rate.num) { + handle->mm.source_fps = ceil(av_q2d(context->video_st.st->avg_frame_rate)); + } else { + handle->mm.source_fps = 25; + } + + context->read_fps = (int)handle->mm.source_fps; + + } +#endif context->video_st.active = 1; @@ -1254,16 +1552,14 @@ GCC_DIAG_ON(deprecated-declarations) } if (context->has_audio) { -GCC_DIAG_OFF(deprecated-declarations) AVCodecContext *c[2] = { NULL }; - c[0] = context->audio_st[0].st->codec; + c[0] = av_get_codec_context(&context->audio_st[0]); - if (context->audio_st[1].st && context->audio_st[1].st->codec) { - c[1] = context->audio_st[1].st->codec; + if ((cc = av_get_codec_context(&context->audio_st[1]))) { + c[1] = cc; } -GCC_DIAG_ON(deprecated-declarations) - + context->audio_st[0].frame = av_frame_alloc(); switch_assert(context->audio_st[0].frame); @@ -1278,33 +1574,49 @@ GCC_DIAG_ON(deprecated-declarations) context->audio_st[0].channels = 1; context->audio_st[1].channels = 1; } else { +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVFORMAT_V) handle->channels = c[0]->channels > 2 ? 2 : c[0]->channels; +#else + handle->channels = c[0]->ch_layout.nb_channels > 2 ? 2 : c[0]->ch_layout.nb_channels; +#endif context->audio_st[0].channels = handle->channels; } context->audio_st[0].sample_rate = handle->samplerate; context->audio_st[1].sample_rate = handle->samplerate; -GCC_DIAG_OFF(deprecated-declarations) - if (context->audio_st[0].st->codec->sample_fmt != AV_SAMPLE_FMT_S16 || context->audio_st[0].st->codec->sample_rate != handle->samplerate) { -GCC_DIAG_ON(deprecated-declarations) + if (c[0]->sample_fmt != AV_SAMPLE_FMT_S16 || c[0]->sample_rate != handle->samplerate) { int x; + for (x = 0; x < context->has_audio && x < 2 && c[x]; x++) { struct SwrContext *resample_ctx = swr_alloc(); if (resample_ctx) { int ret; - + +#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(59,27,100)) /* FFmpeg 5.0 */ av_opt_set_int(resample_ctx, "in_channel_count", c[x]->channels, 0); +#else /* FFmpeg 5.1 */ + av_opt_set_chlayout(resample_ctx, "in_chlayout", &c[x]->ch_layout, 0); +#endif av_opt_set_int(resample_ctx, "in_sample_rate", c[x]->sample_rate, 0); +#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(59,27,100)) av_opt_set_int(resample_ctx, "in_sample_fmt", c[x]->sample_fmt, 0); av_opt_set_int(resample_ctx, "in_channel_layout", (c[x]->channel_layout == 0 && c[x]->channels == 2) ? AV_CH_LAYOUT_STEREO : c[x]->channel_layout, 0); av_opt_set_int(resample_ctx, "out_channel_count", handle->channels, 0); +#else + av_opt_set_sample_fmt(resample_ctx, "in_sample_fmt", c[x]->sample_fmt, 0); + av_opt_set_chlayout(resample_ctx, "out_chlayout", &c[x]->ch_layout, 0); +#endif av_opt_set_int(resample_ctx, "out_sample_rate", handle->samplerate,0); +#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(59,27,100)) av_opt_set_int(resample_ctx, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0); av_opt_set_int(resample_ctx, "out_channel_layout", handle->channels == 2 ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO, 0); - +#else + av_opt_set_sample_fmt(resample_ctx, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0); +#endif + if ((ret = swr_init(resample_ctx)) < 0) { char errbuf[1024]; av_strerror(ret, errbuf, 1024); @@ -1323,8 +1635,11 @@ GCC_DIAG_ON(deprecated-declarations) if (!context->has_video) { switch_clear_flag(handle, SWITCH_FILE_FLAG_VIDEO); } else { -GCC_DIAG_OFF(deprecated-declarations) - switch (context->video_st.st->codec->pix_fmt) { + if (!(cc = av_get_codec_context(&context->video_st))) { + goto err; + } + + switch (cc->pix_fmt) { case AV_PIX_FMT_YUVA420P: case AV_PIX_FMT_RGBA: case AV_PIX_FMT_ARGB: @@ -1335,8 +1650,7 @@ GCC_DIAG_OFF(deprecated-declarations) context->handle->mm.fmt = SWITCH_IMG_FMT_I420; break; } -GCC_DIAG_ON(deprecated-declarations) - + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opening file in mode: %s\n", context->handle->mm.fmt == SWITCH_IMG_FMT_ARGB ? "ARGB" : "I420"); } @@ -1368,12 +1682,20 @@ err: static void *SWITCH_THREAD_FUNC file_read_thread_run(switch_thread_t *thread, void *obj) { av_file_context_t *context = (av_file_context_t *) obj; - AVPacket pkt = { 0 }; + AVPacket *pkt = NULL; +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) int got_data = 0; +#else + int dret = -1; +#endif int error; int sync = 0; int eof = 0; - + AVCodecContext *c = NULL; +#if (LIBAVCODEC_VERSION_MAJOR >= LIBAVCODEC_V) + AVFrame *vframe = NULL; +#endif + switch_mutex_lock(context->mutex); context->file_read_thread_started = 1; context->file_read_thread_running = 1; @@ -1390,8 +1712,6 @@ static void *SWITCH_THREAD_FUNC file_read_thread_run(switch_thread_t *thread, vo switch_buffer_zero(context->audio_buffer); switch_mutex_unlock(context->mutex); - - // if (context->has_audio) stream_id = context->audio_st.st->index; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "seeking to %" SWITCH_INT64_T_FMT "\n", context->seek_ts); avformat_seek_file(context->fc, stream_id, 0, context->seek_ts, INT64_MAX, 0); @@ -1402,10 +1722,12 @@ static void *SWITCH_THREAD_FUNC file_read_thread_run(switch_thread_t *thread, vo context->video_st.next_pts = 0; context->video_start_time = 0; -GCC_DIAG_OFF(deprecated-declarations) - avcodec_flush_buffers(context->video_st.st->codec); -GCC_DIAG_ON(deprecated-declarations) - + if (!(c = av_get_codec_context(&context->video_st))) { + break; + } + + avcodec_flush_buffers(c); + while(switch_queue_trypop(context->eh.video_queue, &pop) == SWITCH_STATUS_SUCCESS) { switch_image_t *img; if (!pop) break; @@ -1425,21 +1747,18 @@ GCC_DIAG_ON(deprecated-declarations) continue; } + if (pkt) av_packet_free(&pkt); + pkt = av_packet_alloc(); - - av_init_packet(&pkt); - pkt.data = NULL; - pkt.size = 0; - - if ((error = av_read_frame(context->fc, &pkt)) < 0) { + if ((error = av_read_frame(context->fc, pkt)) < 0) { if (error == AVERROR_EOF) { if (!context->has_video) break; eof = 1; /* just make sure*/ - pkt.data = NULL; - pkt.size = 0; - pkt.stream_index = context->video_st.st->index; + pkt->data = NULL; + pkt->size = 0; + pkt->stream_index = context->video_st.st->index; } else { char ebuf[255] = ""; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not read frame (error '%s')\n", get_error_text(error, ebuf, sizeof(ebuf))); @@ -1448,8 +1767,11 @@ GCC_DIAG_ON(deprecated-declarations) } // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "stream: %d, pkt size %d\n", pkt.stream_index, pkt.size); - if (context->has_video && pkt.stream_index == context->video_st.st->index) { - AVFrame *vframe; + + if (context->has_video && pkt->stream_index == context->video_st.st->index) { +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) + AVFrame *vframe = NULL; +#endif switch_image_t *img; if (context->no_video_decode) { @@ -1457,24 +1779,22 @@ GCC_DIAG_ON(deprecated-declarations) break; } else { switch_status_t status; - AVPacket *new_pkt = malloc(sizeof(AVPacket)); + AVPacket *new_pkt = av_packet_alloc(); if (0) { // debug - uint8_t *p = pkt.data; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "size = %u %x %x %x %x %x %x\n", pkt.size, *p, *(p+1), *(p+2), *(p+3), *(p+4), *(p+5)); + uint8_t *p = pkt->data; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "size = %u %x %x %x %x %x %x\n", pkt->size, *p, *(p+1), *(p+2), *(p+3), *(p+4), *(p+5)); } - av_init_packet(new_pkt); - av_packet_ref(new_pkt, &pkt); + av_packet_ref(new_pkt, pkt); status = switch_queue_push(context->video_pkt_queue, new_pkt); // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "size = %4u flag=%x pts=%" SWITCH_INT64_T_FMT " dts=%" SWITCH_INT64_T_FMT "\n", pkt.size, pkt.flags, pkt.pts, pkt.dts); context->vid_ready = 1; if (status != SWITCH_STATUS_SUCCESS) { - av_packet_unref(new_pkt); - free(new_pkt); + av_packet_free(&new_pkt); } - av_packet_unref(&pkt); + continue; } } @@ -1488,18 +1808,57 @@ again: vframe = av_frame_alloc(); switch_assert(vframe); + if (!(c = av_get_codec_context(&context->video_st))) { + break; + } + +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) GCC_DIAG_OFF(deprecated-declarations) - if ((error = avcodec_decode_video2(context->video_st.st->codec, vframe, &got_data, &pkt)) < 0) { + error = avcodec_decode_video2(c, vframe, &got_data, pkt); GCC_DIAG_ON(deprecated-declarations) +#else + if (eof) { + dret = avcodec_send_packet(c, NULL); + } else { + dret = avcodec_send_packet(c, pkt); + } + + if (dret == AVERROR_EOF) { + dret = 0; + } else if (dret == AVERROR(EAGAIN)) { + /* we fully drain all the output in each decode call, so this should not ever happen */ + dret = AVERROR_BUG; + goto check_errors; + } else if (dret < 0) { + goto check_errors; + } + + while (dret >= 0) { + dret = avcodec_receive_frame(c, vframe); + if (dret == AVERROR(EAGAIN)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "No more video frames at the moment\n"); + } else if (dret == AVERROR_EOF) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "No more video frames at all\n"); + } else if (dret < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Video decoding error\n"); + } +#endif + +#if (LIBAVCODEC_VERSION_MAJOR >= LIBAVCODEC_V) + check_errors: + if (dret < 0 && dret != AVERROR(EAGAIN) && dret != AVERROR_EOF) { +#else + if (error < 0) { +#endif char ebuf[255] = ""; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not decode frame (error '%s')\n", get_error_text(error, ebuf, sizeof(ebuf))); - av_packet_unref(&pkt); av_frame_free(&vframe); continue; } // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "pkt: %d, pts: %lld dts: %lld\n", pkt.size, pkt.pts, pkt.dts); - av_packet_unref(&pkt); + av_packet_unref(pkt); //if (switch_queue_size(context->eh.video_queue) > 300) { // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Dropping frames\n"); @@ -1508,7 +1867,11 @@ GCC_DIAG_ON(deprecated-declarations) //} // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "got_data=%d, error=%d\n", got_data, error); +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) if (got_data && error >= 0) { +#else + if (dret >= 0) { +#endif switch_img_fmt_t fmt = SWITCH_IMG_FMT_I420; if (( vframe->format == AV_PIX_FMT_YUVA420P || @@ -1530,7 +1893,7 @@ GCC_DIAG_ON(deprecated-declarations) if (!context->video_st.sws_ctx) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot init sws context\n"); av_frame_free(&frm); - continue; + goto do_continue; } } @@ -1541,9 +1904,11 @@ GCC_DIAG_ON(deprecated-declarations) vframe->width = frm->width; vframe->height = frm->height; vframe->pts = frm->pts; +#if (LIBAVUTIL_VERSION_MAJOR < LIBAVUTIL_V) GCC_DIAG_OFF(deprecated-declarations) vframe->pkt_pts = frm->pkt_pts; GCC_DIAG_ON(deprecated-declarations) +#endif vframe->pkt_dts = frm->pkt_dts; ret = av_frame_get_buffer(vframe, 32); @@ -1556,7 +1921,7 @@ GCC_DIAG_ON(deprecated-declarations) if (ret <= 0 ) { av_frame_free(&vframe); - continue; + goto do_continue; } } @@ -1572,9 +1937,13 @@ GCC_DIAG_ON(deprecated-declarations) int diff; int sleep = 66000; #endif +#if (LIBAVUTIL_VERSION_MAJOR < LIBAVUTIL_V) GCC_DIAG_OFF(deprecated-declarations) *pts = vframe->pkt_pts; GCC_DIAG_ON(deprecated-declarations) +#else + *pts = vframe->pts; +#endif avframe2img(vframe, img); img->user_priv = pts; @@ -1597,32 +1966,83 @@ GCC_DIAG_ON(deprecated-declarations) } } +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) av_frame_free(&vframe); +#endif if (eof) { +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) if (got_data) { +#else + if (dret != AVERROR_EOF) { +#endif +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) goto again; // to get all delayed video frames in decoder +#else + av_frame_free(&vframe); + goto again; // to get all delayed video frames in decoder +#endif } else { - break; + goto do_break; } } - continue; - } else if (context->has_audio && pkt.stream_index == context->audio_st[0].st->index) { + +#if (LIBAVCODEC_VERSION_MAJOR >= LIBAVCODEC_V) + } + + av_frame_free(&vframe); +#endif + goto do_continue; + } else if (context->has_audio && pkt->stream_index == context->audio_st[0].st->index) { AVFrame in_frame = { { 0 } }; -GCC_DIAG_OFF(deprecated-declarations) - if ((error = avcodec_decode_audio4(context->audio_st[0].st->codec, &in_frame, &got_data, &pkt)) < 0) { -GCC_DIAG_ON(deprecated-declarations) - char ebuf[255] = ""; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not decode frame (error '%s')\n", get_error_text(error, ebuf, sizeof(ebuf))); - av_packet_unref(&pkt); + if (!(c = av_get_codec_context(&context->audio_st[0]))) { continue; } - // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "pkt: %d, decodedddd: %d pts: %lld dts: %lld\n", pkt.size, error, pkt.pts, pkt.dts); - av_packet_unref(&pkt); +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) +GCC_DIAG_OFF(deprecated-declarations) + if ((error = avcodec_decode_audio4(c, &in_frame, &got_data, pkt)) < 0) { +GCC_DIAG_ON(deprecated-declarations) + char ebuf[255] = ""; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not decode frame (error '%s')\n", get_error_text(error, ebuf, sizeof(ebuf))); + continue; + } +#else + dret = avcodec_send_packet(c, pkt); + if (dret == AVERROR_EOF) { + dret = 0; + } else if (dret == AVERROR(EAGAIN)) { + /* we fully drain all the output in each decode call, so this should not ever happen */ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Error sending audio packet to decoder - BUG, should never happen\n"); + dret = AVERROR_BUG; + goto do_continue; + } else if (dret < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Error sending audio packet to decoder\n"); + goto do_continue; + } + + while (dret >= 0) { + dret = avcodec_receive_frame(c, &in_frame); + if (dret == AVERROR(EAGAIN)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "No more audio frames at the moment\n"); + } else if (dret == AVERROR_EOF) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "No more audio frames at all\n"); + } else if (dret < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Video decoding error\n"); + goto do_continue; + } +#endif + + // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "pkt: %d, decodedddd: %d pts: %lld dts: %lld\n", pkt.size, error, pkt.pts, pkt.dts); + av_packet_unref(pkt); + +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) if (got_data) { +#else + if (dret >= 0) { +#endif // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "got data frm->format: %d samples: %d\n", in_frame.format, in_frame.nb_samples); if (context->audio_st[0].resample_ctx) { @@ -1661,12 +2081,26 @@ GCC_DIAG_ON(deprecated-declarations) } } - - } else { - av_packet_unref(&pkt); +#if (LIBAVCODEC_VERSION_MAJOR >= LIBAVCODEC_V) + } } +#else + } else { + av_packet_unref(pkt); + } +#endif + + do_continue: + continue; + do_break: + break; } + av_packet_free(&pkt); +#if (LIBAVCODEC_VERSION_MAJOR >= LIBAVCODEC_V) + av_frame_free(&vframe); +#endif + if (context->has_video) switch_queue_push(context->eh.video_queue, NULL); context->file_read_thread_running = 0; @@ -1679,7 +2113,13 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa av_file_context_t *context = NULL; char *ext; const char *tmp = NULL; +#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_V) AVOutputFormat *fmt; +#else + const AVOutputFormat *fmt; + enum AVCodecID video_codec = AV_CODEC_ID_NONE; + enum AVCodecID audio_codec = AV_CODEC_ID_NONE; +#endif const char *format = NULL; int ret; char file[1024]; @@ -1797,18 +2237,28 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa return SWITCH_STATUS_SUCCESS; } - mod_avformat_alloc_output_context2(&context->fc, NULL, format, (char *)file, context); + mod_avformat_alloc_output_context2(&context->fc, format, (char *)file, context); if (!context->fc) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not deduce output format from file extension\n"); switch_goto_status(SWITCH_STATUS_GENERR, end); } +#if (LIBAVFORMAT_VERSION_MAJOR >= LIBAVFORMAT_V) + fmt = context->fc->oformat; + video_codec = fmt->video_codec; + audio_codec = fmt->audio_codec; +#endif + fmt = context->fc->oformat; if (handle->params && (tmp = switch_event_get_header(handle->params, "av_audio_codec"))) { if ((context->audio_codec = avcodec_find_encoder_by_name(tmp))) { +#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_V) fmt->audio_codec = context->audio_codec->id; +#else + audio_codec = context->audio_codec->id; +#endif switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "specified audio codec %s %s [%s]\n", tmp, context->audio_codec->name, context->audio_codec->long_name); @@ -1829,7 +2279,11 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa if (handle->params && (tmp = switch_event_get_header(handle->params, "av_video_codec"))) { if ((context->video_codec = avcodec_find_encoder_by_name(tmp))) { +#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_V) fmt->video_codec = context->video_codec->id; +#else + video_codec = context->video_codec->id; +#endif switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "specified video codec %s %s [%s]\n", tmp, context->video_codec->name, context->video_codec->long_name); } @@ -1866,16 +2320,28 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa handle->mm.vb = switch_calc_bitrate(handle->mm.vw, handle->mm.vh, 1, handle->mm.fps); } +#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_V) if (switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO) && fmt->video_codec != AV_CODEC_ID_NONE) { +#else + if (switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO) && video_codec != AV_CODEC_ID_NONE) { +#endif const AVCodecDescriptor *desc; if ((handle->stream_name && (!strcasecmp(handle->stream_name, "rtmp") || !strcasecmp(handle->stream_name, "rtmps") || !strcasecmp(handle->stream_name, "youtube")))) { - +#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_V) if (fmt->video_codec != AV_CODEC_ID_H264 ) { fmt->video_codec = AV_CODEC_ID_H264; // force H264 +#else + if (video_codec != AV_CODEC_ID_H264 ) { + video_codec = AV_CODEC_ID_H264; // force H264 +#endif } +#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_V) fmt->audio_codec = AV_CODEC_ID_AAC; +#else + audio_codec = AV_CODEC_ID_AAC; +#endif handle->samplerate = 44100; handle->mm.samplerate = 44100; handle->mm.ab = 128; @@ -1911,12 +2377,21 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa } } +#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_V) desc = avcodec_descriptor_get(fmt->video_codec); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "use video codec: [%d] %s (%s)\n", fmt->video_codec, desc->name, desc->long_name); +#else + desc = avcodec_descriptor_get(video_codec); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "use video codec: [%d] %s (%s)\n", video_codec, desc->name, desc->long_name); +#endif } +#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_V) if (fmt->audio_codec != AV_CODEC_ID_NONE) { +#else + if (audio_codec != AV_CODEC_ID_NONE) { +#endif const char *issplit = 0; context->audio_st[0].channels = handle->channels; @@ -1929,8 +2404,13 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa if (lr || rl) { context->audio_st[0].channels = 1; context->audio_st[1].channels = 1; +#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_V) add_stream(context, &context->audio_st[0], context->fc, &context->audio_codec, fmt->audio_codec, &handle->mm); add_stream(context, &context->audio_st[1], context->fc, &context->audio_codec, fmt->audio_codec, &handle->mm); +#else + add_stream(context, &context->audio_st[0], context->fc, &context->audio_codec, audio_codec, &handle->mm); + add_stream(context, &context->audio_st[1], context->fc, &context->audio_codec, audio_codec, &handle->mm); +#endif } if (lr) { @@ -1941,7 +2421,11 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa } if (!context->audio_st[0].active) { +#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_V) add_stream(context, &context->audio_st[0], context->fc, &context->audio_codec, fmt->audio_codec, &handle->mm); +#else + add_stream(context, &context->audio_st[0], context->fc, &context->audio_codec, audio_codec, &handle->mm); +#endif } if (open_audio(context->fc, context->audio_codec, &context->audio_st[0]) != SWITCH_STATUS_SUCCESS) { @@ -2014,11 +2498,16 @@ static switch_status_t av_file_write(switch_file_handle_t *handle, void *data, s uint32_t bytes; int inuse; int sample_start = 0; + AVCodecContext *c = NULL; if (!switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { return SWITCH_STATUS_FALSE; } + if (!context->has_audio) { + return SWITCH_STATUS_SUCCESS; + } + if (!context->vid_ready) { if (switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO)) { switch_buffer_zero(context->audio_buffer); @@ -2051,9 +2540,7 @@ static switch_status_t av_file_write(switch_file_handle_t *handle, void *data, s switch_buffer_write(context->audio_buffer, data, datalen); } -GCC_DIAG_OFF(deprecated-declarations) bytes = context->audio_st[0].frame->nb_samples * 2 * context->handle->channels; //context->audio_st[0].st->codec->channels; -GCC_DIAG_ON(deprecated-declarations) //{ // int inuse = switch_buffer_inuse(context->audio_buffer); @@ -2097,13 +2584,18 @@ GCC_DIAG_ON(deprecated-declarations) } while (switch_buffer_inuse(context->audio_buffer) >= bytes) { - AVPacket pkt[2] = { {0} }; + AVPacket *pkt[2]; +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) int got_packet[2] = {0}; + int result[2] = {0}; +#else + int dret = -1; +#endif int j = 0, ret = -1, audio_stream_count = 1; AVFrame *use_frame = NULL; - av_init_packet(&pkt[0]); - av_init_packet(&pkt[1]); + pkt[0] = av_packet_alloc(); + pkt[1] = av_packet_alloc(); if (context->audio_st[1].active) { switch_size_t len = 0; @@ -2139,17 +2631,17 @@ GCC_DIAG_ON(deprecated-declarations) if (context->audio_st[j].resample_ctx) { int out_samples = swr_get_out_samples(context->audio_st[j].resample_ctx, context->audio_st[j].frame->nb_samples); - av_frame_make_writable(context->audio_st[j].tmp_frame); + av_frame_make_writable(context->audio_st[j].tmp_frame); /* convert to destination format */ ret = swr_convert(context->audio_st[j].resample_ctx, - context->audio_st[j].tmp_frame->data, out_samples, - (const uint8_t **)context->audio_st[j].frame->data, context->audio_st[j].frame->nb_samples); + context->audio_st[j].tmp_frame->data, out_samples, + (const uint8_t **)context->audio_st[j].frame->data, context->audio_st[j].frame->nb_samples); if (ret < 0) { char ebuf[255] = ""; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error while converting %d samples, error text: %s\n", - context->audio_st[j].frame->nb_samples, get_error_text(ret, ebuf, sizeof(ebuf))); + context->audio_st[j].frame->nb_samples, get_error_text(ret, ebuf, sizeof(ebuf))); continue; } @@ -2160,24 +2652,90 @@ GCC_DIAG_ON(deprecated-declarations) // context->audio_st[j].next_pts = use_frame->pts + use_frame->nb_samples; -GCC_DIAG_OFF(deprecated-declarations) - ret = avcodec_encode_audio2(context->audio_st[j].st->codec, &pkt[j], use_frame, &got_packet[j]); -GCC_DIAG_ON(deprecated-declarations) + if (!(c = av_get_codec_context(&context->audio_st[j]))) { + continue; + } +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) +GCC_DIAG_OFF(deprecated-declarations) + result[j] = avcodec_encode_audio2(c, pkt[j], use_frame, &got_packet[j]); +GCC_DIAG_ON(deprecated-declarations) +#else + dret = avcodec_send_frame(c, use_frame); + + if (dret == AVERROR_EOF) { + dret = 0; + } else if (dret == AVERROR(EAGAIN)) { + /* we fully drain all the output in each decode call, so this should not ever happen */ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Encoding error for channel %d on sending frame to encode - BUG, should never happen\n", j); + dret = AVERROR_BUG; + } else if (dret < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Encoding error for channel %d on sending frame to encode\n", j); + } + + while (dret >= 0) { + dret = avcodec_receive_packet(c, pkt[j]); + if (dret == AVERROR(EAGAIN)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "No more audio packets at the moment for channel %d\n", j); + break; + } else if (dret == AVERROR_EOF) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "No more audio packets at all for channel %d\n", j); + break; + } else if (dret < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Encoding error for channel %d\n", j); + break; + } + + if (context->mutex) switch_mutex_lock(context->mutex); + + ret = write_frame(context->fc, &c->time_base, context->audio_st[j].st, pkt[j]); + + if (context->mutex) switch_mutex_unlock(context->mutex); + + if (ret < 0) { + context->errs++; + if ((context->errs % 10) == 0) { + char ebuf[255] = ""; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error while writing audio frame: %d %s\n", ret, get_error_text(ret, ebuf, sizeof(ebuf))); + if ((ret == -5 || ret == -104) && handle->stream_name) { + context->errs = 1001; + } + } + //switch_goto_status(SWITCH_STATUS_FALSE, end); + } else { + context->errs = 0; + } + + if (context->errs > 1000) { + av_packet_free(&pkt[0]); + av_packet_free(&pkt[1]); + switch_goto_status(SWITCH_STATUS_FALSE, end); + } + } +#endif context->audio_st[j].next_pts += use_frame->nb_samples; - } - - if (ret < 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error encoding audio frame: %d\n", ret); + } + +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) + if (result[0] < 0 || result[1] < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error encoding audio frame: %d %d \n", result[0], result[1]); + av_packet_free(&pkt[0]); + av_packet_free(&pkt[1]); continue; } - + for (j = 0; j < audio_stream_count; j++) { if (got_packet[j]) { if (context->mutex) switch_mutex_lock(context->mutex); -GCC_DIAG_OFF(deprecated-declarations) - ret = write_frame(context->fc, &context->audio_st[j].st->codec->time_base, context->audio_st[j].st, &pkt[j]); -GCC_DIAG_ON(deprecated-declarations) + + if (!(c = av_get_codec_context(&context->audio_st[j]))) { + if (context->mutex) switch_mutex_unlock(context->mutex); + continue; + } + + ret = write_frame(context->fc, &c->time_base, context->audio_st[j].st, pkt[j]); + if (context->mutex) switch_mutex_unlock(context->mutex); if (ret < 0) { @@ -2197,6 +2755,10 @@ GCC_DIAG_ON(deprecated-declarations) } } } +#endif + + av_packet_free(&pkt[0]); + av_packet_free(&pkt[1]); } end: @@ -2469,10 +3031,10 @@ static switch_status_t no_video_decode_packets(switch_file_handle_t *handle, swi if (context->last_read_pkt) { status = switch_packetizer_read(context->packetizer, frame); if (status == SWITCH_STATUS_SUCCESS) { - av_packet_unref(context->last_read_pkt); - free(context->last_read_pkt); + av_packet_free(&context->last_read_pkt); context->last_read_pkt = NULL; } + return status; } @@ -2480,6 +3042,7 @@ static switch_status_t no_video_decode_packets(switch_file_handle_t *handle, swi if (status != SWITCH_STATUS_SUCCESS || !pkt) { switch_cond_next(); + return SWITCH_STATUS_BREAK; } @@ -2491,12 +3054,10 @@ static switch_status_t no_video_decode_packets(switch_file_handle_t *handle, swi // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "pts=%" SWITCH_INT64_T_FMT " status = %d\n", pts, status); if (status == SWITCH_STATUS_SUCCESS) { - av_packet_unref(context->last_read_pkt); - free(context->last_read_pkt); + av_packet_free(&context->last_read_pkt); context->last_read_pkt = NULL; } - if (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_MORE_DATA) { if (!context->video_start_time) { context->video_start_time = switch_time_now() - pts; @@ -2531,6 +3092,8 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f double fl_to = 0.02; int do_fl = 0; int smaller_ts = context->read_fps; + AVCodecContext *c = NULL; + AVCodecParserContext *cp = NULL; if (!context->has_video) return SWITCH_STATUS_FALSE; @@ -2638,18 +3201,17 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f } #endif -GCC_DIAG_OFF(deprecated-declarations) - if (st->codec->time_base.num) { - ticks = st->parser ? st->parser->repeat_pict + 1 : st->codec->ticks_per_frame; + if ((c = av_get_codec_context(mst)) && c->time_base.num) { + cp = av_stream_get_parser(st); + ticks = cp ? cp->repeat_pict + 1 : c->ticks_per_frame; // mst->next_pts += ((int64_t)AV_TIME_BASE * st->codec->time_base.num * ticks) / st->codec->time_base.den; } if (!context->video_start_time) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "start: %" SWITCH_INT64_T_FMT " ticks: %d ticks_per_frame: %d st num:%d st den:%d codec num:%d codec den:%d start: %" SWITCH_TIME_T_FMT ", duration:%" SWITCH_INT64_T_FMT " nb_frames:%" SWITCH_INT64_T_FMT " q2d:%f\n", - context->video_start_time, ticks, st->codec->ticks_per_frame, st->time_base.num, st->time_base.den, st->codec->time_base.num, st->codec->time_base.den, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "start: %" SWITCH_INT64_T_FMT " ticks: %d ticks_per_frame: %d st num:%d st den:%d codec num:%d codec den:%d start: %" SWITCH_TIME_T_FMT ", duration:%" SWITCH_INT64_T_FMT " nb_frames:%" SWITCH_INT64_T_FMT " q2d:%f\n", + context->video_start_time, ticks, c ? c->ticks_per_frame : -1, st->time_base.num, st->time_base.den, c ? c->time_base.num : -1, c ? c->time_base.den : -1, st->start_time, st->duration == AV_NOPTS_VALUE ? context->fc->duration / AV_TIME_BASE * 1000 : st->duration, st->nb_frames, av_q2d(st->time_base)); } -GCC_DIAG_ON(deprecated-declarations) again: @@ -2750,6 +3312,7 @@ static switch_status_t av_file_write_video(switch_file_handle_t *handle, switch_ switch_status_t status = SWITCH_STATUS_SUCCESS; av_file_context_t *context = (av_file_context_t *)handle->private_info; switch_image_t *img = NULL; + AVCodecContext *c = NULL; if (!switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO)) { return SWITCH_STATUS_FALSE; @@ -2766,12 +3329,13 @@ static switch_status_t av_file_write_video(switch_file_handle_t *handle, switch_ if (add_stream(context, &context->video_st, context->fc, &context->video_codec, context->fc->oformat->video_codec, &handle->mm) == SWITCH_STATUS_SUCCESS && open_video(context->fc, context->video_codec, &context->video_st) == SWITCH_STATUS_SUCCESS) { - char codec_str[256]; + char codec_str[256] = ""; int ret; -GCC_DIAG_OFF(deprecated-declarations) - avcodec_string(codec_str, sizeof(codec_str), context->video_st.st->codec, 1); -GCC_DIAG_ON(deprecated-declarations) + if ((c = av_get_codec_context(&context->video_st))) { + avcodec_string(codec_str, sizeof(codec_str), c, 1); + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "use video codec implementation %s\n", codec_str); context->has_video = 1; @@ -2804,8 +3368,11 @@ GCC_DIAG_ON(deprecated-declarations) switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); switch_core_timer_init(&context->video_timer, "soft", 1, 1, context->pool); context->eh.video_timer = &context->video_timer; - context->audio_st[0].frame->pts = 0; - context->audio_st[0].next_pts = 0; + if (context->has_audio) { + context->audio_st[0].frame->pts = 0; + context->audio_st[0].next_pts = 0; + } + switch_thread_create(&context->eh.video_thread, thd_attr, video_thread_run, context, handle->memory_pool); } @@ -2861,7 +3428,7 @@ static char *supported_formats[SWITCH_MAX_CODECS] = { 0 }; static const char modname[] = "mod_av"; -static switch_status_t load_config() +static switch_status_t load_config(void) { char *cf = "avformat.conf"; switch_xml_t cfg, xml, param, settings; diff --git a/src/mod/applications/mod_av/mod_av.c b/src/mod/applications/mod_av/mod_av.c index 5d93d9adc7..02a481fd2e 100644 --- a/src/mod/applications/mod_av/mod_av.c +++ b/src/mod/applications/mod_av/mod_av.c @@ -25,6 +25,7 @@ * * Seven Du * Anthony Minessale + * Jakub Karolczyk * * mod_av -- FS Video Codec / File Format using libav.org * @@ -33,7 +34,13 @@ #include #include "mod_av.h" #include +#ifdef _MSC_VER +#include /* LIBAVCODEC_VERSION_INT */ +#endif #include +#ifdef _MSC_VER +#include /* LIBAVFORMAT_VERSION_INT */ +#endif SWITCH_MODULE_LOAD_FUNCTION(mod_avformat_load); SWITCH_MODULE_LOAD_FUNCTION(mod_avcodec_load); @@ -49,6 +56,7 @@ typedef struct av_mutex_helper_s { switch_memory_pool_t *pool; } av_mutex_helper_t; +#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) int mod_av_lockmgr_cb(void **m, enum AVLockOp op) { av_mutex_helper_t *context = NULL; @@ -93,6 +101,7 @@ int mod_av_lockmgr_cb(void **m, enum AVLockOp op) } return 0; } +#endif #ifndef AV_LOG_TRACE #define AV_LOG_TRACE 96 diff --git a/src/mod/applications/mod_av/mod_av.h b/src/mod/applications/mod_av/mod_av.h index b240f98aa7..a89e6cb8f7 100644 --- a/src/mod/applications/mod_av/mod_av.h +++ b/src/mod/applications/mod_av/mod_av.h @@ -30,6 +30,7 @@ * Marcel Barbulescu * Raymond Chandler * Emmanuel Schmidbauer + * Jakub Karolczyk * * * mod_av.h -- LibAV mod @@ -39,6 +40,10 @@ #ifndef MOD_AV_H #define MOD_AV_H +#define LIBAVCODEC_V 59 +#define LIBAVFORMAT_V 59 +#define LIBAVUTIL_V 57 + struct mod_av_globals { int debug; }; diff --git a/src/mod/applications/mod_cidlookup/mod_cidlookup.c b/src/mod/applications/mod_cidlookup/mod_cidlookup.c index 55d7aa0d90..5531222197 100644 --- a/src/mod/applications/mod_cidlookup/mod_cidlookup.c +++ b/src/mod/applications/mod_cidlookup/mod_cidlookup.c @@ -347,7 +347,7 @@ static size_t file_callback(void *ptr, size_t size, size_t nmemb, void *data) return realsize; } -static long do_lookup_url(switch_memory_pool_t *pool, switch_event_t *event, char **response, const char *query, struct curl_httppost *post, +static long do_lookup_url(switch_memory_pool_t *pool, switch_event_t *event, char **response, const char *query, switch_curl_mime *post, switch_curl_slist_t *headers, int timeout) { switch_time_t start_time = switch_micro_time_now(); @@ -373,7 +373,7 @@ static long do_lookup_url(switch_memory_pool_t *pool, switch_event_t *event, cha switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0); } if (post) { - switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPPOST, post); + switch_curl_easy_setopt_mime(curl_handle, post); } else { switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPGET, 1); } diff --git a/src/mod/applications/mod_conference/conference_api.c b/src/mod/applications/mod_conference/conference_api.c index 38a04284c7..cd580d30a1 100644 --- a/src/mod/applications/mod_conference/conference_api.c +++ b/src/mod/applications/mod_conference/conference_api.c @@ -4087,7 +4087,6 @@ switch_status_t conference_api_sub_set(conference_obj_t *conference, switch_status_t conference_api_sub_xml_list(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) { - int count = 0; switch_hash_index_t *hi; void *val; switch_xml_t x_conference, x_conferences; @@ -4106,7 +4105,6 @@ switch_status_t conference_api_sub_xml_list(conference_obj_t *conference, switch x_conference = switch_xml_add_child_d(x_conferences, "conference", off++); switch_assert(conference); - count++; conference_xlist(conference, x_conference, off); } @@ -4114,7 +4112,7 @@ switch_status_t conference_api_sub_xml_list(conference_obj_t *conference, switch } else { x_conference = switch_xml_add_child_d(x_conferences, "conference", off++); switch_assert(conference); - count++; + conference_xlist(conference, x_conference, off); } diff --git a/src/mod/applications/mod_conference/conference_cdr.c b/src/mod/applications/mod_conference/conference_cdr.c index b6eb630540..9f2ccba63c 100644 --- a/src/mod/applications/mod_conference/conference_cdr.c +++ b/src/mod/applications/mod_conference/conference_cdr.c @@ -662,6 +662,9 @@ void conference_cdr_render(conference_obj_t *conference) x_tag = switch_xml_add_child_d(x_flags, "end_conference", flag_off++); switch_xml_set_txt_d(x_tag, conference_cdr_test_mflag(np, MFLAG_ENDCONF) ? "true" : "false"); + x_tag = switch_xml_add_child_d(x_flags, "mandatory_member_end_conference", flag_off++); + switch_xml_set_txt_d(x_tag, conference_cdr_test_mflag(np, MFLAG_MANDATORY_MEMBER_ENDCONF) ? "true" : "false"); + x_tag = switch_xml_add_child_d(x_flags, "was_kicked", flag_off++); switch_xml_set_txt_d(x_tag, conference_cdr_test_mflag(np, MFLAG_KICKED) ? "true" : "false"); @@ -737,7 +740,7 @@ void conference_cdr_render(conference_obj_t *conference) #endif int wrote; wrote = write(fd, xml_text, (unsigned) strlen(xml_text)); - wrote++; + (void)wrote; close(fd); } else { char ebuf[512] = { 0 }; diff --git a/src/mod/applications/mod_conference/conference_loop.c b/src/mod/applications/mod_conference/conference_loop.c index f6c2856892..8f112f5453 100644 --- a/src/mod/applications/mod_conference/conference_loop.c +++ b/src/mod/applications/mod_conference/conference_loop.c @@ -75,7 +75,7 @@ struct _mapping control_mappings[] = { {"deaf off", conference_loop_deaf_off} }; -int conference_loop_mapping_len() +int conference_loop_mapping_len(void) { return (sizeof(control_mappings)/sizeof(control_mappings[0])); } diff --git a/src/mod/applications/mod_conference/conference_member.c b/src/mod/applications/mod_conference/conference_member.c index 6112a2890c..c258e59783 100644 --- a/src/mod/applications/mod_conference/conference_member.c +++ b/src/mod/applications/mod_conference/conference_member.c @@ -766,7 +766,12 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m conference->count++; } + if (conference_utils_member_test_flag(member, MFLAG_ENDCONF)) { + conference->endconference_time = 0; + } + + if (conference_utils_member_test_flag(member, MFLAG_MANDATORY_MEMBER_ENDCONF)) { if (conference->end_count++) { conference->endconference_time = 0; } @@ -1314,9 +1319,14 @@ switch_status_t conference_member_del(conference_obj_t *conference, conference_m conference_video_check_flush(member, SWITCH_FALSE); + /* End conference when any member with "endconf" flag disconnects */ if (conference_utils_member_test_flag(member, MFLAG_ENDCONF)) { + conference_utils_set_flag_locked(conference, CFLAG_DESTRUCT); + } + + /* End conference only if all mandatory members have disconnected */ + if (conference_utils_member_test_flag(member, MFLAG_MANDATORY_MEMBER_ENDCONF)) { if (!--conference->end_count) { - //conference_utils_set_flag_locked(conference, CFLAG_DESTRUCT); conference->endconference_time = switch_epoch_time_now(NULL); } } diff --git a/src/mod/applications/mod_conference/conference_utils.c b/src/mod/applications/mod_conference/conference_utils.c index c8dd0fd4e9..a441594ddc 100644 --- a/src/mod/applications/mod_conference/conference_utils.c +++ b/src/mod/applications/mod_conference/conference_utils.c @@ -132,6 +132,8 @@ void conference_utils_set_mflags(const char *flags, member_flag_t *f) f[MFLAG_NOMOH] = 1; } else if (!strcasecmp(argv[i], "endconf")) { f[MFLAG_ENDCONF] = 1; + } else if (!strcasecmp(argv[i], "mandatory_member_endconf")) { + f[MFLAG_MANDATORY_MEMBER_ENDCONF] = 1; } else if (!strcasecmp(argv[i], "mintwo")) { f[MFLAG_MINTWO] = 1; } else if (!strcasecmp(argv[i], "talk-data-events")) { diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 619cd8c4a6..bf03d2a5bc 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1347,6 +1347,9 @@ void conference_xlist(conference_obj_t *conference, switch_xml_t x_conference, i x_tag = switch_xml_add_child_d(x_flags, "end_conference", count++); switch_xml_set_txt_d(x_tag, conference_utils_member_test_flag(member, MFLAG_ENDCONF) ? "true" : "false"); + x_tag = switch_xml_add_child_d(x_flags, "mandatory_member_end_conference", count++); + switch_xml_set_txt_d(x_tag, conference_utils_member_test_flag(member, MFLAG_MANDATORY_MEMBER_ENDCONF) ? "true" : "false"); + x_tag = switch_xml_add_child_d(x_flags, "is_ghost", count++); switch_xml_set_txt_d(x_tag, conference_utils_member_test_flag(member, MFLAG_GHOST) ? "true" : "false"); @@ -1456,6 +1459,7 @@ void conference_jlist(conference_obj_t *conference, cJSON *json_conferences) ADDBOOL(json_conference_member_flags, "has_floor", member->id == member->conference->floor_holder); ADDBOOL(json_conference_member_flags, "is_moderator", conference_utils_member_test_flag(member, MFLAG_MOD)); ADDBOOL(json_conference_member_flags, "end_conference", conference_utils_member_test_flag(member, MFLAG_ENDCONF)); + ADDBOOL(json_conference_member_flags, "mandatory_member_end_conference", conference_utils_member_test_flag(member, MFLAG_MANDATORY_MEMBER_ENDCONF)); ADDBOOL(json_conference_member_flags, "pass_digits", conference_utils_member_test_flag(member, MFLAG_DIST_DTMF)); } switch_mutex_unlock(conference->member_mutex); diff --git a/src/mod/applications/mod_conference/mod_conference.h b/src/mod/applications/mod_conference/mod_conference.h index 3c28634264..e45a921c21 100644 --- a/src/mod/applications/mod_conference/mod_conference.h +++ b/src/mod/applications/mod_conference/mod_conference.h @@ -178,6 +178,7 @@ typedef enum { MFLAG_NO_MINIMIZE_ENCODING, MFLAG_FLUSH_BUFFER, MFLAG_ENDCONF, + MFLAG_MANDATORY_MEMBER_ENDCONF, MFLAG_HAS_AUDIO, MFLAG_TALKING, MFLAG_RESTART, @@ -1123,7 +1124,7 @@ void conference_video_canvas_del_fnode_layer(conference_obj_t *conference, confe void conference_video_canvas_set_fnode_layer(mcu_canvas_t *canvas, conference_file_node_t *fnode, int idx); void conference_list(conference_obj_t *conference, switch_stream_handle_t *stream, char *delim); const char *conference_utils_combine_flag_var(switch_core_session_t *session, const char *var_name); -int conference_loop_mapping_len(); +int conference_loop_mapping_len(void); void conference_api_set_agc(conference_member_t *member, const char *data); switch_status_t conference_outcall(conference_obj_t *conference, diff --git a/src/mod/applications/mod_curl/mod_curl.c b/src/mod/applications/mod_curl/mod_curl.c index 02079d6767..c780e6947e 100644 --- a/src/mod/applications/mod_curl/mod_curl.c +++ b/src/mod/applications/mod_curl/mod_curl.c @@ -104,8 +104,13 @@ struct http_sendfile_data_obj { char *extrapost_elements; switch_CURL *curl_handle; char *cacert; +#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800) + curl_mime *mime; + curl_mimepart *part; +#else struct curl_httppost *formpost; struct curl_httppost *lastptr; +#endif uint8_t flags; /* This is for where to send output of the curl_sendfile commands */ switch_stream_handle_t *stream; char *sendfile_response; @@ -456,8 +461,19 @@ static void http_sendfile_initialize_curl(http_sendfile_data_t *http_data) curl_easy_setopt(http_data->curl_handle, CURLOPT_WRITEFUNCTION, http_sendfile_response_callback); curl_easy_setopt(http_data->curl_handle, CURLOPT_WRITEDATA, (void *) http_data); + /* Initial http_data->mime */ +#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800) + http_data->mime = curl_mime_init(http_data->curl_handle); +#endif + /* Add the file to upload as a POST form field */ +#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800) + http_data->part = curl_mime_addpart(http_data->mime); + curl_mime_name(http_data->part, http_data->filename_element_name); + curl_mime_filedata(http_data->part, http_data->filename_element); +#else curl_formadd(&http_data->formpost, &http_data->lastptr, CURLFORM_COPYNAME, http_data->filename_element_name, CURLFORM_FILE, http_data->filename_element, CURLFORM_END); +#endif if(!zstr(http_data->extrapost_elements)) { @@ -476,16 +492,32 @@ static void http_sendfile_initialize_curl(http_sendfile_data_t *http_data) if(argc2 == 2) { switch_url_decode(argv2[0]); switch_url_decode(argv2[1]); +#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800) + http_data->part = curl_mime_addpart(http_data->mime); + curl_mime_name(http_data->part, argv2[0]); + curl_mime_data(http_data->part, argv2[1], CURL_ZERO_TERMINATED); +#else curl_formadd(&http_data->formpost, &http_data->lastptr, CURLFORM_COPYNAME, argv2[0], CURLFORM_COPYCONTENTS, argv2[1], CURLFORM_END); +#endif } } } /* Fill in the submit field too, even if this isn't really needed */ +#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800) + http_data->part = curl_mime_addpart(http_data->mime); + curl_mime_name(http_data->part, "submit"); + curl_mime_data(http_data->part, "or_die", CURL_ZERO_TERMINATED); +#else curl_formadd(&http_data->formpost, &http_data->lastptr, CURLFORM_COPYNAME, "submit", CURLFORM_COPYCONTENTS, "or_die", CURLFORM_END); +#endif /* what URL that receives this POST */ +#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800) + curl_easy_setopt(http_data->curl_handle, CURLOPT_MIMEPOST, http_data->mime); +#else curl_easy_setopt(http_data->curl_handle, CURLOPT_HTTPPOST, http_data->formpost); +#endif // This part actually fires off the curl, captures the HTTP response code, and then frees up the handle. curl_easy_perform(http_data->curl_handle); @@ -494,7 +526,11 @@ static void http_sendfile_initialize_curl(http_sendfile_data_t *http_data) curl_easy_cleanup(http_data->curl_handle); // Clean up the form data from POST +#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800) + curl_mime_free(http_data->mime); +#else curl_formfree(http_data->formpost); +#endif } static switch_status_t http_sendfile_test_file_open(http_sendfile_data_t *http_data, switch_event_t *event) diff --git a/src/mod/applications/mod_db/mod_db.c b/src/mod/applications/mod_db/mod_db.c index 0e3e227de7..5f14792f2c 100644 --- a/src/mod/applications/mod_db/mod_db.c +++ b/src/mod/applications/mod_db/mod_db.c @@ -280,7 +280,7 @@ static switch_xml_config_item_t config_settings[] = { SWITCH_CONFIG_ITEM_END() }; -static switch_status_t do_config() +static switch_status_t do_config(void) { switch_cache_db_handle_t *dbh = NULL; switch_status_t status = SWITCH_STATUS_SUCCESS; diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index e91ec53d47..f52b1184e5 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -161,7 +161,6 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) char *string = NULL; switch_channel_t *channel; switch_core_session_t *use_session = act->session; - int x = 0; char *flags = ""; if (act->target == DIGIT_TARGET_PEER || act->target == DIGIT_TARGET_BOTH) { @@ -171,7 +170,6 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) } top: - x++; string = switch_core_session_strdup(use_session, act->string); exec = 0; diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index 4b32d87c6d..1254a6f93c 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -1419,7 +1419,7 @@ static switch_status_t httapi_sync(client_t *client) switch_status_t status = SWITCH_STATUS_FALSE; int get_style_method = 0; char *method = NULL; - struct curl_httppost *formpost=NULL; + switch_curl_mime *formpost = NULL; switch_event_t *save_params = NULL; const char *put_file; FILE *fd = NULL; @@ -1476,7 +1476,7 @@ static switch_status_t httapi_sync(client_t *client) } if (!put_file) { - switch_curl_process_form_post_params(client->params, curl_handle, &formpost); + switch_curl_process_mime(client->params, curl_handle, &formpost); } if (formpost) { @@ -1588,7 +1588,7 @@ static switch_status_t httapi_sync(client_t *client) curl_easy_setopt(curl_handle, CURLOPT_READFUNCTION, put_file_read); } else if (formpost) { - curl_easy_setopt(curl_handle, CURLOPT_HTTPPOST, formpost); + switch_curl_easy_setopt_mime(curl_handle, formpost); } else { switch_curl_easy_setopt(curl_handle, CURLOPT_POST, !get_style_method); } @@ -1670,9 +1670,7 @@ static switch_status_t httapi_sync(client_t *client) switch_curl_easy_cleanup(curl_handle); switch_curl_slist_free_all(headers); - if (formpost) { - curl_formfree(formpost); - } + switch_curl_mime_free(&formpost); if (client->err) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error encountered! [%s]\ndata: [%s]\n", client->profile->url, data); diff --git a/src/mod/applications/mod_http_cache/azure.c b/src/mod/applications/mod_http_cache/azure.c index f1e4cf8925..a16d2e9f94 100644 --- a/src/mod/applications/mod_http_cache/azure.c +++ b/src/mod/applications/mod_http_cache/azure.c @@ -279,7 +279,11 @@ switch_status_t azure_blob_finalise_put(http_profile_t *profile, const char *url goto done; } +#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x070c01) + switch_curl_easy_setopt(curl_handle, CURLOPT_UPLOAD, 1); +#else switch_curl_easy_setopt(curl_handle, CURLOPT_PUT, 1); +#endif switch_curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1); switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers); switch_curl_easy_setopt(curl_handle, CURLOPT_URL, full_url); diff --git a/src/mod/applications/mod_http_cache/mod_http_cache.c b/src/mod/applications/mod_http_cache/mod_http_cache.c index 9d19099e56..365ba27425 100644 --- a/src/mod/applications/mod_http_cache/mod_http_cache.c +++ b/src/mod/applications/mod_http_cache/mod_http_cache.c @@ -393,7 +393,9 @@ static switch_status_t http_put(url_cache_t *cache, http_profile_t *profile, swi goto done; } switch_curl_easy_setopt(curl_handle, CURLOPT_UPLOAD, 1); +#if !defined(LIBCURL_VERSION_NUM) || (LIBCURL_VERSION_NUM < 0x070c01) switch_curl_easy_setopt(curl_handle, CURLOPT_PUT, 1); +#endif switch_curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1); switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers); switch_curl_easy_setopt(curl_handle, CURLOPT_URL, full_url); diff --git a/src/mod/applications/mod_signalwire/mod_signalwire.c b/src/mod/applications/mod_signalwire/mod_signalwire.c index 9846e7e1d2..108f99b2c5 100644 --- a/src/mod/applications/mod_signalwire/mod_signalwire.c +++ b/src/mod/applications/mod_signalwire/mod_signalwire.c @@ -704,7 +704,7 @@ done: return status; } -static switch_status_t load_config() +static switch_status_t load_config(void) { char *cf = "signalwire.conf"; switch_xml_t cfg, xml; @@ -1390,7 +1390,7 @@ static void mod_signalwire_state_register(void) } } -static void mod_signalwire_state_ready() +static void mod_signalwire_state_ready(void) { if (globals.profile_update) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Signalwire SIP profile update initiated\n"); diff --git a/src/mod/codecs/mod_ilbc/mod_ilbc.c b/src/mod/codecs/mod_ilbc/mod_ilbc.c index 14d67d372e..2588cdf46b 100644 --- a/src/mod/codecs/mod_ilbc/mod_ilbc.c +++ b/src/mod/codecs/mod_ilbc/mod_ilbc.c @@ -48,7 +48,7 @@ static switch_status_t switch_ilbc_fmtp_parse(const char *fmtp, switch_codec_fmt memset(codec_fmtp, '\0', sizeof(struct switch_codec_fmtp)); - if (fmtp && (mode = strstr(fmtp, "mode=")) && (mode + 5)) { + if (fmtp && (mode = strstr(fmtp, "mode=")) && *(mode + 5)) { codec_ms = atoi(mode + 5); } if (!codec_ms) { diff --git a/src/mod/codecs/mod_opus/mod_opus.c b/src/mod/codecs/mod_opus/mod_opus.c index ce9aff52a3..a38389d031 100644 --- a/src/mod/codecs/mod_opus/mod_opus.c +++ b/src/mod/codecs/mod_opus/mod_opus.c @@ -1170,24 +1170,30 @@ static switch_status_t switch_opus_keep_fec_enabled(switch_codec_t *codec) } } -static switch_bool_t switch_opus_vad(struct opus_context *context, void *encoded_data, uint32_t encoded_data_len) { - const uint8_t *payload = (const uint8_t *) encoded_data; +static switch_bool_t switch_opus_vad(struct opus_context *context, void *encoded_data, uint32_t encoded_data_len) +{ + const uint8_t *payload = (const uint8_t *)encoded_data; opus_packet_info_t opus_packet_info; - switch_bool_t debug = (globals.debug || context->debug > 1); + switch_bool_t debug = (globals.debug || context->debug > 1); + if (!switch_opus_packet_parse(payload, encoded_data_len, &opus_packet_info, debug)) { if (debug) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "OPUS PACKET PARSING ERROR len:%d bytes:%02x %02x\n", - (int)encoded_data_len, payload[0], payload[1]); + (int)encoded_data_len, payload[0], payload[1]); } + return SWITCH_TRUE; } + if (debug) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "OPUS EXTRACT PAYLOAD VAD len:%d vad_ms:%d bytes:%02x %02x\n", - (int)encoded_data_len, opus_packet_info.vad_ms, payload[0], payload[1]); + (int)encoded_data_len, opus_packet_info.vad_ms, payload[0], payload[1]); } + if (opus_packet_info.vad_ms == 0) { return SWITCH_FALSE; } + return SWITCH_TRUE; } @@ -1284,9 +1290,10 @@ static switch_status_t switch_opus_control(switch_codec_t *codec, break; case SCC_AUDIO_VAD: { - void* encoded_data = (void *)cmd_data; - uint16_t* encoded_data_len = (uint16_t *)cmd_arg; - switch_bool_t *ret = (switch_bool_t *) *ret_data; + void *encoded_data = (void *)cmd_data; + uint16_t *encoded_data_len = (uint16_t *)cmd_arg; + switch_bool_t *ret = (switch_bool_t *)*ret_data; + *ret = switch_opus_vad(context, encoded_data, *encoded_data_len); } break; diff --git a/src/mod/codecs/mod_opus/opus_parse.c b/src/mod/codecs/mod_opus/opus_parse.c index b94f491ca0..48f596836a 100644 --- a/src/mod/codecs/mod_opus/opus_parse.c +++ b/src/mod/codecs/mod_opus/opus_parse.c @@ -33,64 +33,72 @@ #include "opus_parse.h" /* Tables for LBRR_sympbol decoding */ -static const opus_int16 silk_LBRR_flags_2_PDFCum[3] = {53, 106, 256}; /* 256 - silk_LBRR_flags_2_iCDF[i] ; silk_LBRR_flags_2_iCDF[ 3 ] = { 203, 150, 0 }; */ -static const opus_int16 silk_LBRR_flags_3_PDFCum[7] = {41, 61, 90, 131, 146, 174, 256}; /* 256 - silk_LBRR_flags_3_iCDF[i] ; silk_LBRR_flags_3_iCDF[ 7 ] = { 215, 195, 166, 125, 110, 82, 0 }; */ +static const opus_int16 silk_LBRR_flags_2_PDFCum[3] = { 53, 106, 256 }; /* 256 - silk_LBRR_flags_2_iCDF[i] ; silk_LBRR_flags_2_iCDF[ 3 ] = { 203, 150, 0 }; */ +static const opus_int16 silk_LBRR_flags_3_PDFCum[7] = { 41, 61, 90, 131, 146, 174, 256 }; /* 256 - silk_LBRR_flags_3_iCDF[i] ; silk_LBRR_flags_3_iCDF[ 7 ] = { 215, 195, 166, 125, 110, 82, 0 }; */ -/* get the number of VAD flags - i.e. number of 20 ms frame - from the config */ -/* in a silk-only or hybrid opus frame mono or stereo*/ -/* 5 MSB TOC byte (see table 2 of IETF RFC6716 clause 3.1) */ -/* if 10 ms frame (config=0, 4, 8, 12, 14) : return 1 */ -/* if CELT_only frame no VAD flag =>return 0 */ +/* Get the number of VAD flags - i.e. number of 20 ms frame - from the config + * in a silk-only or hybrid opus frame mono or stereo + * 5 MSB TOC byte (see table 2 of IETF RFC6716 clause 3.1) + * if 10 ms frame (config=0, 4, 8, 12, 14) : return 1 + * if CELT_only frame no VAD flag =>return 0 */ static opus_int16 switch_opus_get_nb_flags_in_silk_frame(int16_t config) { opus_int16 silk_frame_nb_flags; + if (config > 15) { /* CELT_only frame no VAD flag nor LBRR flag */ silk_frame_nb_flags = 0; } else { - silk_frame_nb_flags = 1; /*default*/ + silk_frame_nb_flags = 1; /* default */ + if (config < 12) { - /* silk-only NB, MB or WB */ - /* The least two significant bits give the number of VAD flags inside the silk frame 1, 2 or 3 */ + /* silk-only NB, MB or WB + * The least two significant bits give the number of VAD flags inside the silk frame 1, 2 or 3 */ silk_frame_nb_flags = config & 0x3; + if (silk_frame_nb_flags == 0) { /* 0 => 10ms frame : one VAD flag */ silk_frame_nb_flags++; } } } + return silk_frame_nb_flags; } -/* get the time in ms corresponding to one VAD flag from the config */ -/* in a silk-only or hybrid opus frame mono or stereo*/ -/* 5 MSB TOC byte (see table 2 of IETF RFC6716 clause 3.1) */ -/* if CELT_only frame (config >15) no VAD flag =>return FALSE */ -/* if 10 ms frame (config=0, 4, 8, 12, 14) : return 10 */ -/* otherwise return 20 */ +/* Get the time in ms corresponding to one VAD flag from the config + * in a silk-only or hybrid opus frame mono or stereo + * 5 MSB TOC byte (see table 2 of IETF RFC6716 clause 3.1) + * if CELT_only frame (config >15) no VAD flag =>return FALSE + * if 10 ms frame (config=0, 4, 8, 12, 14) : return 10 + * otherwise return 20 */ static opus_int16 switch_opus_get_silk_frame_ms_per_flag(int16_t config, opus_int16 silk_frame_nb_flags) { opus_int16 silk_size_frame_ms_per_flag; + if (config > 15) { /* CELT_only frame no VAD flag nor LBRR flag */ /* switch_opus_get_silk_frame_ms_per_flag: code not written for CELT-only mode */ - return FALSE; + + return 0; } + silk_size_frame_ms_per_flag = 20; /* default*/ if (silk_frame_nb_flags == 1) { /* could be 10 or 20 ms */ - if ((config &0x01) == 0) { - silk_size_frame_ms_per_flag = 10; + if ((config & 0x01) == 0) { + silk_size_frame_ms_per_flag = 10; } } + return silk_size_frame_ms_per_flag; } -/* code written only for mono, silk-only or hybrid mode */ -/* for CELT-only frame no vad flags for LBRR flag the routine must not be called */ -/* for stereo : the mid frame VAD_flags and the LBRR_flag could be obtained */ -/* yet, to get the LBRR_flags of the mid frame the routine should be modified */ -/* to skip the side VAD flags and the side LBRR flag and to get the mid LBRR_symbol */ -static bool_t switch_opus_get_VAD_LBRR_flags(const uint8_t *buf, opus_int16 silk_frame_nb_flags, - opus_int16 *VAD_flags, opus_int16 *LBRR_flags, opus_int16 *nb_VAD1, opus_int16 *nb_FEC) +/* Code written only for mono, silk-only or hybrid mode + * for CELT-only frame no vad flags for LBRR flag the routine must not be called + * for stereo : the mid frame VAD_flags and the LBRR_flag could be obtained + * yet, to get the LBRR_flags of the mid frame the routine should be modified + * to skip the side VAD flags and the side LBRR flag and to get the mid LBRR_symbol */ +static void switch_opus_get_VAD_LBRR_flags(const uint8_t *buf, opus_int16 silk_frame_nb_flags, + opus_int16 *VAD_flags, opus_int16 *LBRR_flags, opus_int16 *nb_VAD1, opus_int16 *nb_FEC) { const opus_int16 *ptr_pdf_cum; opus_int nb_pdf_symbol; @@ -104,39 +112,41 @@ static bool_t switch_opus_get_VAD_LBRR_flags(const uint8_t *buf, opus_int16 silk nb_vad = 0; nb_fec = 0; - /* get VAD_FLAGS & LBRR_FLAG */ - /* silk_frame_nb_flags = 1 (10 or 20 ms), the two MSB of the first byte are the VAD flag and the LBRR flag */ - /* silk_frame_nb_flags = 2 (40 ms), the three MSB of the first byte are the two VAD flags and the LBRR flag */ - /* silk_frame_nb_flags = 3 (60 ms), the four MSB of the first byte are the three VAD flags and the LBRR flag */ - /* compute the number of MSB to analyse */ + /* Get VAD_FLAGS & LBRR_FLAG + * silk_frame_nb_flags = 1 (10 or 20 ms), the two MSB of the first byte are the VAD flag and the LBRR flag + * silk_frame_nb_flags = 2 (40 ms), the three MSB of the first byte are the two VAD flags and the LBRR flag + * silk_frame_nb_flags = 3 (60 ms), the four MSB of the first byte are the three VAD flags and the LBRR flag + * compute the number of MSB to analyze */ nb_bit = silk_frame_nb_flags + 1; - /* number of right shifts to appply to the first byte to only have the bits of LBRR flag and of the VAD flags */ + + /* number of right shifts to apply to the first byte to only have the bits of LBRR flag and of the VAD flags */ compl_nb_bit = 8 - nb_bit; mask = (1 << nb_bit) - 1; - /* the bits of the silk_frame_nb_flags VAD flags and the LBRR flag are the MSB of the first byte */ - /* silk_frame_nb_flags = 1 (10 or 20 ms), VAD_flags(0) | LBRR_flag */ - /* silk_frame_nb_flags = 2 (40 ms), VAD_flags(0) | VAD_flags(1) | LBRR_flag */ - /* silk_frame_nb_flags = 3 (60 ms), VAD_flags(0) | VAD_flags(1) | VAD_flags(2) |LBRR_flag */ + /* The bits of the silk_frame_nb_flags VAD flags and the LBRR flag are the MSB of the first byte + * silk_frame_nb_flags = 1 (10 or 20 ms), VAD_flags(0) | LBRR_flag + * silk_frame_nb_flags = 2 (40 ms), VAD_flags(0) | VAD_flags(1) | LBRR_flag + * silk_frame_nb_flags = 3 (60 ms), VAD_flags(0) | VAD_flags(1) | VAD_flags(2) |LBRR_flag */ val = (buf[0] >> compl_nb_bit) & mask; LBRR_flag = val & 0x1; /* LBRR_FLAG LSB */ /* get VAD_flags */ ptr_flags = VAD_flags + silk_frame_nb_flags; - for (i=0; i < silk_frame_nb_flags; i++) { + for (i = 0; i < silk_frame_nb_flags; i++) { LBRR_flags[i] = 0; /* init */ val >>= 1; *(--ptr_flags) = val & 0x1; } + if (LBRR_flag != 0) { /* there is at least one LBRR frame */ if (silk_frame_nb_flags == 1) { LBRR_flags[0] = 1; nb_fec = 1; } else { /* get LBRR_symbol then LBRR_flags */ - /* LBRR symbol is encoded with range encoder : range on 8 bits */ - /* silk_frame_nb_flags = 2 ; 3 possible values for LBRR_flags(1) | LBRR_flags(0))= 01, 10, 11 */ - /* silk_frame_nb_flags = 3 ; 7 possible values for LBRR_flags(2) | LBRR_flags(1) | LBRR_flags(0))= 001, 010, 011, 100, 101, 110, 111 */ + /* LBRR symbol is encoded with range encoder : range on 8 bits + * silk_frame_nb_flags = 2 ; 3 possible values for LBRR_flags(1) | LBRR_flags(0))= 01, 10, 11 + * silk_frame_nb_flags = 3 ; 7 possible values for LBRR_flags(2) | LBRR_flags(1) | LBRR_flags(0))= 001, 010, 011, 100, 101, 110, 111 */ mask2 = (1 << compl_nb_bit) - 1; /* get next 8 bits: (8-nb_bit) LSB of the first byte and nb_bit MSB of the second byte */ val = (((buf[0]) & mask2) << nb_bit) | ((buf[1] >> compl_nb_bit) & mask); @@ -148,6 +158,7 @@ static bool_t switch_opus_get_VAD_LBRR_flags(const uint8_t *buf, opus_int16 silk nb_pdf_symbol = 7; ptr_pdf_cum = silk_LBRR_flags_3_PDFCum; } + LBRR_symbol = 0; for (i = 1; i <= nb_pdf_symbol; i++) { if (val < *ptr_pdf_cum++) { @@ -155,6 +166,7 @@ static bool_t switch_opus_get_VAD_LBRR_flags(const uint8_t *buf, opus_int16 silk break; } } + for (i = 0; i < silk_frame_nb_flags; i++) { LBRR_flags[i] = LBRR_symbol & 0x01; LBRR_symbol >>= 1; @@ -162,20 +174,22 @@ static bool_t switch_opus_get_VAD_LBRR_flags(const uint8_t *buf, opus_int16 silk } } } + for (i = 0; i < silk_frame_nb_flags; i++) { nb_vad += VAD_flags[i]; } *nb_VAD1 = nb_vad; *nb_FEC = nb_fec; - return TRUE; + + return; } /* Parse the packet to retrieve informations about its content * RFC6716: Definition of the Opus Audio Codec - * return: FALSE if there was a problem found parsing the packet, the info returned should be ignored. + * return: SWITCH_FALSE if there was a problem found parsing the packet, the info returned should be ignored. * */ -bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes, opus_packet_info_t *packet_info, bool_t debug) +switch_bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes, opus_packet_info_t *packet_info, switch_bool_t debug) { int f; int32_t samplerate; @@ -188,6 +202,7 @@ bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes opus_int16 silk_frame_nb_flags, silk_size_frame_ms_per_flag; opus_int16 silk_frame_nb_fec, silk_frame_nb_vad1; opus_int sample_per_frame; + packet_info->config = 0; packet_info->fec = 0; packet_info->fec_ms = 0; @@ -198,19 +213,22 @@ bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes packet_info->channels = 1; /* as stereo is set to FALSE */ packet_info->ms_per_frame = 0; packet_info->ptime_ts = 0; + if (payload == NULL || payload_length_bytes <= 0) { if (debug) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: payload null."); } - return FALSE; + + return SWITCH_FALSE; } /* In CELT_ONLY mode, packets should not have FEC. */ if (payload[0] & 0x80) { /* opus_packet_parse: CELT_ONLY mode, we do not support this mode. */ - return FALSE; + return SWITCH_FALSE; } else { int mode = (payload[0] >> 3); + if (mode <= 3) { samplerate = 8000; } else if (mode <= 7) { @@ -223,16 +241,18 @@ bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes samplerate = 48000; } else { /* opus_packet_parse: CELT_ONLY mode, we do not support this mode. */ - return FALSE; + return SWITCH_FALSE; } if (debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: mode[%d]s[%d]c[%d] [%d]Hz\n", mode, (payload[0]>>2)&0x1 ,(payload[0])&0x3, samplerate); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: mode[%d]s[%d]c[%d] [%d]Hz\n", mode, (payload[0] >> 2) & 0x1, (payload[0]) & 0x3, samplerate); } } + if (payload[0] & 0x04) { packet_info->stereo = TRUE; packet_info->channels = 2; } + packet_info->config = payload[0] >> 3; sample_per_frame = opus_packet_get_samples_per_frame(payload, samplerate); packet_info->ms_per_frame = sample_per_frame * 1000 / samplerate; @@ -240,7 +260,8 @@ bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes if (debug) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: invalid packet."); } - return FALSE; + + return SWITCH_FALSE; } packet_info->frames = opus_packet_parse(payload, payload_length_bytes, NULL, frame_data, frame_sizes, NULL); @@ -249,54 +270,57 @@ bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes if (debug) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: opus_packet_parse found no frame.\n"); } - return FALSE; + + return SWITCH_FALSE; } + packet_info->ptime_ts = packet_info->frames * sample_per_frame; if (frame_sizes[0] <= 1) { if (debug) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: opus_packet_parse frame size too small.\n"); } - return FALSE; + + return SWITCH_FALSE; } - /* +---------------+-----------+-----------+-------------------+ */ - /* | Configuration | Mode | Bandwidth | Frame Sizes | */ - /* | Number(s) | | | | */ - /* +---------------+-----------+-----------+-------------------+ */ - /* | 0...3 | SILK-only | NB | 10, 20, 40, 60 ms | */ - /* | 4...7 | SILK-only | MB | 10, 20, 40, 60 ms | */ - /* | 8...11 | SILK-only | WB | 10, 20, 40, 60 ms | */ - /* | 12...13 | Hybrid | SWB | 10, 20 ms | */ - /* | 14...15 | Hybrid | FB | 10, 20 ms | */ - /* | 16...19 | CELT-only | NB | 2.5, 5, 10, 20 ms | */ - /* | 20...23 | CELT-only | WB | 2.5, 5, 10, 20 ms | */ - /* | 24...27 | CELT-only | SWB | 2.5, 5, 10, 20 ms | */ - /* | 28...31 | CELT-only | FB | 2.5, 5, 10, 20 ms | */ - /* +---------------+-----------+-----------+-------------------+ */ + /* +---------------+-----------+-----------+-------------------+ + | Configuration | Mode | Bandwidth | Frame Sizes | + | Number(s) | | | | + +---------------+-----------+-----------+-------------------+ + | 0...3 | SILK-only | NB | 10, 20, 40, 60 ms | + | 4...7 | SILK-only | MB | 10, 20, 40, 60 ms | + | 8...11 | SILK-only | WB | 10, 20, 40, 60 ms | + | 12...13 | Hybrid | SWB | 10, 20 ms | + | 14...15 | Hybrid | FB | 10, 20 ms | + | 16...19 | CELT-only | NB | 2.5, 5, 10, 20 ms | + | 20...23 | CELT-only | WB | 2.5, 5, 10, 20 ms | + | 24...27 | CELT-only | SWB | 2.5, 5, 10, 20 ms | + | 28...31 | CELT-only | FB | 2.5, 5, 10, 20 ms | + +---------------+-----------+-----------+-------------------+ */ if (!packet_info->stereo) { - /* the routines opus_get_nb_flags_in_silk_frame and opus_get_silk_frame_ms_per_flag are also valid for stereo frames */ - /* yet the routine opus_get_VAD_LBRR_flags is currently only for mono frame*/ + /* The routines opus_get_nb_flags_in_silk_frame and opus_get_silk_frame_ms_per_flag are also valid for stereo frames + * yet the routine opus_get_VAD_LBRR_flags is currently only for mono frame */ silk_frame_nb_flags = switch_opus_get_nb_flags_in_silk_frame(packet_info->config); /* =1 for 10 or 20 ms frame; = 2 for 40 ms; = 3 for 60 ms */ if (!silk_frame_nb_flags) { /* We should not go there as CELT_ONLY is already tested above */ - return FALSE; + return SWITCH_FALSE; } packet_info->frames_silk = silk_frame_nb_flags; silk_size_frame_ms_per_flag = switch_opus_get_silk_frame_ms_per_flag(packet_info->config, silk_frame_nb_flags); /* 10 or 20 ms frame*/ if (!silk_size_frame_ms_per_flag) { /* we should not go there as CELT_ONLY is already tested above */ - return FALSE; + return SWITCH_FALSE; } ptr_LBBR_FLAGS = packet_LBBR_FLAGS; ptr_VAD_FLAGS = packet_VAD_FLAGS; for (f = 0; f < packet_info->frames; f++) { - switch_opus_get_VAD_LBRR_flags(frame_data[f], silk_frame_nb_flags, ptr_VAD_FLAGS, ptr_LBBR_FLAGS, - &silk_frame_nb_vad1, &silk_frame_nb_fec); + switch_opus_get_VAD_LBRR_flags(frame_data[f], silk_frame_nb_flags, ptr_VAD_FLAGS, ptr_LBBR_FLAGS, + &silk_frame_nb_vad1, &silk_frame_nb_fec); packet_info->vad += silk_frame_nb_vad1; packet_info->fec += silk_frame_nb_fec; packet_info->vad_ms += silk_frame_nb_vad1 * silk_size_frame_ms_per_flag; @@ -305,6 +329,7 @@ bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes ptr_VAD_FLAGS += silk_frame_nb_flags; ptr_LBBR_FLAGS += silk_frame_nb_flags; } + /* store the VAD & LBRR flags of all 20 ms silk-frames of the packet; LSB the first frame, MSB: the last */ vad_flags_per_silk_frame = 0; fec_flags_per_silk_frame = 0; @@ -313,28 +338,34 @@ bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes if (debug) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: more than %d 20-ms frames in the packet ; only first 15 silk-frames data will be stored (pb silkFastAccelerate)\n", silk_frame_packet); } + silk_frame_packet = 15; } + ptr_LBBR_FLAGS = packet_LBBR_FLAGS; ptr_VAD_FLAGS = packet_VAD_FLAGS; shift_silk = 0; - for (i=0; i < silk_frame_packet; i++) { + for (i = 0; i < silk_frame_packet; i++) { vad_flags_per_silk_frame += (*ptr_VAD_FLAGS) << shift_silk; fec_flags_per_silk_frame += (*ptr_LBBR_FLAGS) << shift_silk; shift_silk++; ptr_LBBR_FLAGS++; ptr_VAD_FLAGS++; } + packet_info->vad_flags_per_silk_frame = vad_flags_per_silk_frame; packet_info->fec_flags_per_silk_frame = fec_flags_per_silk_frame; - return TRUE; + + return SWITCH_TRUE; } if (packet_info->config != 1 && packet_info->config != 5 && packet_info->config != 9) { if (debug) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: the current parser implementation does not support muliple SILK frames for VAD or FEC detection.\n"); } - return FALSE; + + return SWITCH_FALSE; } + /* * Parse the VAD and LBRR flags in each Opus frame * */ @@ -342,16 +373,20 @@ bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes if (frame_data[f][0] & 0x80) { packet_info->vad++; } + if (frame_data[f][0] & 0x40) { packet_info->fec++; } + if (debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: LP layer opus_frame[%d] VAD[%d] FEC[%d]\n", f+1, (frame_data[f][0]&0x80)>>7, (frame_data[f][0]&0x40)>>6); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: LP layer opus_frame[%d] VAD[%d] FEC[%d]\n", f + 1, (frame_data[f][0] & 0x80) >> 7, (frame_data[f][0] & 0x40) >> 6); } } + packet_info->vad_ms = packet_info->vad * packet_info->ms_per_frame; packet_info->fec_ms = packet_info->fec * packet_info->ms_per_frame; - return TRUE; + + return SWITCH_TRUE; } /* For Emacs: diff --git a/src/mod/codecs/mod_opus/opus_parse.h b/src/mod/codecs/mod_opus/opus_parse.h index 8dd61500cd..7f1d144754 100644 --- a/src/mod/codecs/mod_opus/opus_parse.h +++ b/src/mod/codecs/mod_opus/opus_parse.h @@ -38,21 +38,24 @@ typedef struct opus_packet_info { int16_t fec; int16_t fec_ms; bool_t stereo; - int16_t frames; /* number of opus frames in the packet */ + /* number of opus frames in the packet */ + int16_t frames; int16_t config; int16_t channels; int16_t ms_per_frame; int32_t ptime_ts; bool_t valid; - int16_t frames_silk; /* number of silk_frames in an opus frame */ + /* number of silk_frames in an opus frame */ + int16_t frames_silk; /* VAD flag of all 20 ms silk-frames of the packet; LSB the first frame, MSB: the last */ int16_t vad_flags_per_silk_frame; /* LBRR (FEC) flag of all 20 ms silk-frames of the packet; LSB the first frame, MSB: the last */ int16_t fec_flags_per_silk_frame; } opus_packet_info_t; -bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes, opus_packet_info_t *packet_info, bool_t debug); -#endif +switch_bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes, opus_packet_info_t *packet_info, switch_bool_t debug); + +#endif /* SWITCH_OPUS_PARSE_H */ /* For Emacs: * Local Variables: diff --git a/src/mod/databases/mod_mariadb/mod_mariadb.c b/src/mod/databases/mod_mariadb/mod_mariadb.c index 7926ec0c3f..09b67468bb 100644 --- a/src/mod/databases/mod_mariadb/mod_mariadb.c +++ b/src/mod/databases/mod_mariadb/mod_mariadb.c @@ -411,7 +411,7 @@ switch_status_t mariadb_finish_results_real(const char* file, const char* func, if ((status = mysql_next_result(&handle->con))) { if (status > 0) { err_str = mariadb_handle_get_error(handle); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "An error occurred trying to get next for query (%s): %s\n", handle->sql, err_str); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "An error occurred trying to get next for query (%s): %s\n", handle->sql, switch_str_nil(err_str)); switch_safe_free(err_str); break; @@ -627,13 +627,27 @@ switch_status_t mariadb_send_query(mariadb_handle_t *handle, const char* sql) { char *err_str; int ret; + unsigned retries = 60; /* 60 tries, will take 30 to 60 seconds at worst */ switch_safe_free(handle->sql); handle->sql = strdup(sql); + again: handle->stored_results = 0; ret = mysql_real_query(&handle->con, sql, (unsigned long)strlen(sql)); if (ret) { err_str = mariadb_handle_get_error(handle); + if (strstr(err_str, "Deadlock found when trying to get lock; try restarting transaction")) { + if (--retries > 0) { + switch_safe_free(err_str); + /* We are waiting for 500 ms and random time is not more than 500 ms. + This is necessary so that the delay on the primary and secondary servers does not coincide and deadlock does not occur again. */ + switch_yield(500 + (rand() & 511)); + goto again; + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "DeadLock. The retries are over.\n"); + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to send query (%s) to database: %s\n", sql, err_str); switch_safe_free(err_str); mariadb_finish_results(handle); diff --git a/src/mod/endpoints/mod_rtmp/handshake.h b/src/mod/endpoints/mod_rtmp/handshake.h index 19c77810b0..bfbea48289 100644 --- a/src/mod/endpoints/mod_rtmp/handshake.h +++ b/src/mod/endpoints/mod_rtmp/handshake.h @@ -42,6 +42,7 @@ #if OPENSSL_VERSION_NUMBER < 0x0090800 || !defined(SHA256_DIGEST_LENGTH) #error Your OpenSSL is too old, need 0.9.8 or newer with SHA256 #endif +#if OPENSSL_VERSION_NUMBER < 0x30000000L #if OPENSSL_VERSION_NUMBER < 0x10100000L #define HMAC_setup(ctx, key, len) HMAC_CTX_init(&ctx); HMAC_Init_ex(&ctx, key, len, EVP_sha256(), 0) #define HMAC_crunch(ctx, buf, len) HMAC_Update(&ctx, buf, len) @@ -51,6 +52,7 @@ #define HMAC_crunch(ctx, buf, len)HMAC_Update(ctx, buf, len) #define HMAC_finish(ctx, dig, dlen) HMAC_Final(ctx, dig, &dlen); HMAC_CTX_free(ctx) #endif +#endif #define FP10 #define RTMP_SIG_SIZE 1536 @@ -155,9 +157,13 @@ static unsigned int GetDigestOffset1(uint8_t *handshake, unsigned int len) static getoff *digoff[] = {GetDigestOffset1, GetDigestOffset2}; // static getoff *dhoff[] = {GetDHOffset1, GetDHOffset2}; -static void HMACsha256(const uint8_t *message, size_t messageLen, const uint8_t *key, size_t keylen, uint8_t *digest) +static void HMACsha256(const uint8_t *message, size_t messageLen, const uint8_t *key, int keylen, uint8_t *digest) { unsigned int digestLen; + +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + HMAC(EVP_sha256(), key, keylen, (uint8_t *)message, messageLen, digest, &digestLen); +#else #if OPENSSL_VERSION_NUMBER < 0x10100000L HMAC_CTX ctx; #else @@ -167,11 +173,12 @@ static void HMACsha256(const uint8_t *message, size_t messageLen, const uint8_t HMAC_setup(ctx, key, (int)keylen); HMAC_crunch(ctx, message, messageLen); HMAC_finish(ctx, digest, digestLen); +#endif assert(digestLen == 32); } -static void CalculateDigest(unsigned int digestPos, uint8_t *handshakeMessage, const uint8_t *key, size_t keyLen, uint8_t *digest) +static void CalculateDigest(unsigned int digestPos, uint8_t *handshakeMessage, const uint8_t *key, int keyLen, uint8_t *digest) { const int messageLen = RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH; uint8_t message[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH]; @@ -184,7 +191,7 @@ static void CalculateDigest(unsigned int digestPos, uint8_t *handshakeMessage, c HMACsha256(message, messageLen, key, keyLen, digest); } -static int VerifyDigest(unsigned int digestPos, uint8_t *handshakeMessage, const uint8_t *key, size_t keyLen) +static int VerifyDigest(unsigned int digestPos, uint8_t *handshakeMessage, const uint8_t *key, int keyLen) { uint8_t calcDigest[SHA256_DIGEST_LENGTH]; diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index c6cfc716c7..64464e4ef6 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -2136,7 +2136,7 @@ void launch_skinny_profile_thread(skinny_profile_t *profile) { /*****************************************************************************/ /* MODULE FUNCTIONS */ /*****************************************************************************/ -switch_endpoint_interface_t *skinny_get_endpoint_interface() +switch_endpoint_interface_t *skinny_get_endpoint_interface(void) { return skinny_endpoint_interface; } diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index 69096ab64e..aff2ee92c0 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -355,7 +355,7 @@ switch_status_t channel_kill_channel(switch_core_session_t *session, int sig); /*****************************************************************************/ /* MODULE FUNCTIONS */ /*****************************************************************************/ -switch_endpoint_interface_t *skinny_get_endpoint_interface(); +switch_endpoint_interface_t *skinny_get_endpoint_interface(void); /*****************************************************************************/ /* TEXT FUNCTIONS */ diff --git a/src/mod/endpoints/mod_skinny/skinny_api.c b/src/mod/endpoints/mod_skinny/skinny_api.c index f79f36c014..4657a5a9d3 100644 --- a/src/mod/endpoints/mod_skinny/skinny_api.c +++ b/src/mod/endpoints/mod_skinny/skinny_api.c @@ -697,7 +697,7 @@ switch_status_t skinny_api_register(switch_loadable_module_interface_t **module_ return SWITCH_STATUS_SUCCESS; } -switch_status_t skinny_api_unregister() +switch_status_t skinny_api_unregister(void) { switch_console_set_complete("del skinny"); diff --git a/src/mod/endpoints/mod_skinny/skinny_api.h b/src/mod/endpoints/mod_skinny/skinny_api.h index e246957f0d..833d0c15da 100644 --- a/src/mod/endpoints/mod_skinny/skinny_api.h +++ b/src/mod/endpoints/mod_skinny/skinny_api.h @@ -34,7 +34,7 @@ #define _SKINNY_API_H switch_status_t skinny_api_register(switch_loadable_module_interface_t **module_interface); -switch_status_t skinny_api_unregister(); +switch_status_t skinny_api_unregister(void); #endif /* _SKINNY_API_H */ diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.h b/src/mod/endpoints/mod_skinny/skinny_protocol.h index 0ae1772521..574f2a907e 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.h +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.h @@ -92,14 +92,14 @@ char* skinny_codec2string(skinny_codecs skinnycodec); /*****************************************************************************/ #define skinny_create_message(message,msgtype,field) \ - message = calloc(1, 12 + sizeof(message->data.field)); \ + message = calloc(1, sizeof(skinny_message_t)); \ message->type = msgtype; \ message->length = 4 + sizeof(message->data.field) #define skinny_create_empty_message(message,msgtype) \ - message = calloc(1, 12); \ - message->type = msgtype; \ - message->length = 4 + message = calloc(1, sizeof(skinny_empty_message_t)); \ + ((skinny_empty_message_t *)message)->type = msgtype; \ + ((skinny_empty_message_t *)message)->length = 4 /* KeepAliveMessage */ @@ -937,6 +937,12 @@ union skinny_data { #pragma pack(push, r1, 1) #endif +struct PACKED skinny_empty_message { + uint32_t length; + uint32_t version; + uint32_t type; +}; + /* * header is length+version * body is type+data @@ -954,6 +960,7 @@ struct PACKED skinny_message { #endif typedef struct skinny_message skinny_message_t; +typedef struct skinny_empty_message skinny_empty_message_t; diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 2fdf0063a9..f58bb40ac0 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -54,7 +54,7 @@ switch_endpoint_interface_t *sofia_endpoint_interface; #define STRLEN 15 -void mod_sofia_shutdown_cleanup(); +void mod_sofia_shutdown_cleanup(void); static switch_status_t sofia_on_init(switch_core_session_t *session); static switch_status_t sofia_on_exchange_media(switch_core_session_t *session); @@ -3255,8 +3255,6 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl switch_hash_index_t *hi; void *val; const void *vvar; - int c = 0; - int ac = 0; const char *header = ""; if (argc > 0) { @@ -3466,7 +3464,6 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl if (sofia_test_pflag(profile, PFLAG_RUNNING)) { if (strcmp(vvar, profile->name)) { - ac++; stream->write_function(stream, "\n%s\n%s\n%s\n%s\n\n", vvar, "alias", profile->name, "ALIASED"); } else { @@ -3492,8 +3489,6 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl profile->inuse); } - c++; - for (gp = profile->gateways; gp; gp = gp->next) { switch_assert(gp->state < REG_STATE_LAST); stream->write_function(stream, "\n%s\n%s\n%s\n%s\n\n", @@ -6833,7 +6828,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) return status; } -void mod_sofia_shutdown_cleanup() { +void mod_sofia_shutdown_cleanup(void) { int sanity = 0; int i; switch_status_t st; diff --git a/src/mod/endpoints/mod_sofia/sip-dig.c b/src/mod/endpoints/mod_sofia/sip-dig.c index c9a6f5b463..10a0a26763 100644 --- a/src/mod/endpoints/mod_sofia/sip-dig.c +++ b/src/mod/endpoints/mod_sofia/sip-dig.c @@ -82,9 +82,6 @@ *
-6
*
Query IP6 addresses (AAAA records). *
- *
-v
- *
Be verbatim. - *
*
*
*
@@ -201,7 +198,7 @@ switch_bool_t verify_ip(sres_record_t **answers, const char *ip, switch_bool_t i switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream) { - int o_sctp = 1, o_tls_sctp = 1, o_verbatim = 1; + int o_sctp = 1, o_tls_sctp = 1; int family = 0, multiple = 0; char const *string; url_t *uri = NULL; @@ -247,9 +244,7 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor } while (argv[i] && argv[i][0] == '-') { - if (strcmp(argv[i], "-v") == 0) { - o_verbatim++; - } else if (strcmp(argv[i], "-6") == 0) { + if (strcmp(argv[i], "-6") == 0) { dig->ip6 = ++family; } else if (strcmp(argv[i], "-4") == 0) { dig->ip4 = ++family; diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index b8576ae7f5..579cea83e2 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1621,7 +1621,6 @@ void *SWITCH_THREAD_FUNC sofia_presence_event_thread_run(switch_thread_t *thread switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Event Thread Started\n"); while (mod_sofia_globals.running == 1) { - int count = 0; if (switch_queue_pop(mod_sofia_globals.presence_queue, &pop) == SWITCH_STATUS_SUCCESS) { switch_event_t *event = (switch_event_t *) pop; @@ -1656,7 +1655,6 @@ void *SWITCH_THREAD_FUNC sofia_presence_event_thread_run(switch_thread_t *thread } switch_event_destroy(&event); - count++; } } diff --git a/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c b/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c index 60a7b61a3a..7b2d7964c9 100644 --- a/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c +++ b/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c @@ -90,7 +90,7 @@ static const char *test_wait_for_chan_var(switch_channel_t *channel, const char return var; } -static switch_bool_t has_ipv6() +static switch_bool_t has_ipv6(void) { switch_stream_handle_t stream = { 0 }; SWITCH_STANDARD_STREAM(stream); @@ -110,7 +110,7 @@ static switch_bool_t has_ipv6() return SWITCH_TRUE; } -static void register_gw() +static void register_gw(void) { switch_stream_handle_t stream = { 0 }; SWITCH_STANDARD_STREAM(stream); @@ -118,7 +118,7 @@ static void register_gw() switch_safe_free(stream.data); } -static void unregister_gw() +static void unregister_gw(void) { switch_stream_handle_t stream = { 0 }; SWITCH_STANDARD_STREAM(stream); diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 8920de7e02..ac042fe626 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -823,7 +823,6 @@ static void set_perm(const char *str, switch_event_t **event, switch_bool_t add) { char delim = ','; char *cur, *next; - int count = 0; char *edup; if (!zstr(str)) { @@ -844,7 +843,7 @@ static void set_perm(const char *str, switch_event_t **event, switch_bool_t add) delim = ' '; } - for (cur = edup; cur; count++) { + for (cur = edup; cur;) { if ((next = strchr(cur, delim))) { *next++ = '\0'; } @@ -3866,6 +3865,15 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t cJSON *i, *indialog = cJSON_GetObjectItem(msg, "inDialog"); const char *body = cJSON_GetObjectCstr(msg, "body"); switch_bool_t is_dialog = indialog && (indialog->type == cJSON_True || (indialog->type == cJSON_String && switch_true(indialog->valuestring))); + const char *context = NULL; + + switch_mutex_lock(jsock->flag_mutex); + + if (!(context = switch_event_get_header(jsock->vars, "user_context"))) { + context = switch_either(jsock->context, jsock->profile->context); + } + + switch_mutex_unlock(jsock->flag_mutex); if (!zstr(to)) { if (strchr(to, '+')) { @@ -3902,6 +3910,8 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call_id", call_id); } + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "context", context); + switch_event_add_body(event, "%s", body); if (strcasecmp(proto, VERTO_CHAT_PROTO)) { @@ -5579,8 +5589,6 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl { verto_profile_t *profile = NULL; jsock_t *jsock; - int cp = 0; - int cc = 0; const char *header = ""; int i; @@ -5594,14 +5602,12 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl stream->write_function(stream, "\n%s\n%s\n%s\n%s\n\n", profile->name, "profile", tmpurl, (profile->running) ? "RUNNING" : "DOWN"); switch_safe_free(tmpurl); } - cp++; switch_mutex_lock(profile->mutex); for(jsock = profile->jsock_head; jsock; jsock = jsock->next) { char *tmpname = switch_mprintf("%s@%s", jsock->id, jsock->domain); stream->write_function(stream, "\n%s\n%s\n%s\n%s\n%s (%s)\n\n", profile->name, tmpname, "client", jsock->name, (!zstr(jsock->uid)) ? "CONN_REG" : "CONN_NO_REG", (jsock->ptype & PTYPE_CLIENT_SSL) ? "WSS": "WS"); - cc++; switch_safe_free(tmpname); } switch_mutex_unlock(profile->mutex); @@ -5611,7 +5617,7 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl return SWITCH_STATUS_SUCCESS; } -static cJSON *json_status() +static cJSON *json_status(void) { cJSON *obj, *profiles, *jprofile, *users, *user; verto_profile_t *profile = NULL; @@ -6740,14 +6746,14 @@ static void mod_verto_ks_logger(const char *file, const char *func, int line, in va_end(ap); } -static void verto_event_free_subclass() +static void verto_event_free_subclass(void) { switch_event_free_subclass(MY_EVENT_LOGIN); switch_event_free_subclass(MY_EVENT_CLIENT_DISCONNECT); switch_event_free_subclass(MY_EVENT_CLIENT_CONNECT); } -static void verto_destroy_globals_hash_tables() +static void verto_destroy_globals_hash_tables(void) { if (verto_globals.method_hash) { switch_core_hash_destroy(&verto_globals.method_hash); diff --git a/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c b/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c index 20259251de..3ec8b060df 100644 --- a/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c +++ b/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c @@ -272,7 +272,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) } -static void do_rotate_all() +static void do_rotate_all(void) { switch_hash_index_t *hi; void *val; @@ -294,7 +294,7 @@ static void do_rotate_all() } -static void do_teardown() +static void do_teardown(void) { switch_hash_index_t *hi; void *val; diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 70331a95e2..520bd92ac7 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -866,7 +866,7 @@ SWITCH_STANDARD_API(event_sink_function) char *loglevel = switch_event_get_header(stream->param_event, "loglevel"); switch_memory_pool_t *pool; char *next, *cur; - uint32_t count = 0, key_count = 0; + uint32_t key_count = 0; uint8_t custom = 0; char *edup; @@ -925,7 +925,7 @@ SWITCH_STANDARD_API(event_sink_function) delim = ' '; } - for (cur = edup; cur; count++) { + for (cur = edup; cur;) { switch_event_types_t type; if ((next = strchr(cur, delim))) { @@ -1846,7 +1846,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even if (allowed_events) { char delim = ','; char *cur, *next; - int count = 0, custom = 0, key_count = 0; + int custom = 0; switch_set_flag(listener, LFLAG_AUTH_EVENTS); @@ -1862,7 +1862,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even delim = ' '; } - for (cur = edup; cur; count++) { + for (cur = edup; cur;) { switch_event_types_t type; if ((next = strchr(cur, delim))) { @@ -1872,7 +1872,6 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even if (custom) { switch_core_hash_insert(listener->allowed_event_hash, cur, MARKER); } else if (switch_name_event(cur, &type) == SWITCH_STATUS_SUCCESS) { - key_count++; if (type == SWITCH_EVENT_ALL) { uint32_t x = 0; switch_set_flag(listener, LFLAG_ALL_EVENTS_AUTHED); @@ -1904,7 +1903,6 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even if (allowed_api) { char delim = ','; char *cur, *next; - int count = 0; switch_snprintf(api_reply, sizeof(api_reply), "Allowed-API: %s\n", allowed_api); @@ -1916,7 +1914,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even delim = ' '; } - for (cur = edup; cur; count++) { + for (cur = edup; cur;) { if ((next = strchr(cur, delim))) { *next++ = '\0'; } @@ -2540,14 +2538,14 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even } else if (!strncasecmp(cmd, "nixevent", 8)) { char *next, *cur; - uint32_t count = 0, key_count = 0; + uint32_t key_count = 0; uint8_t custom = 0; strip_cr(cmd); cur = cmd + 8; if ((cur = strchr(cur, ' '))) { - for (cur++; cur; count++) { + for (cur++; cur;) { switch_event_types_t type; if ((next = strchr(cur, ' '))) { diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_commands.c b/src/mod/event_handlers/mod_kazoo/kazoo_commands.c index 6d956376a8..16f00ad1a0 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_commands.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_commands.c @@ -366,7 +366,9 @@ SWITCH_STANDARD_API(kz_http_put) goto done; } switch_curl_easy_setopt(curl_handle, CURLOPT_UPLOAD, 1); +#if !defined(LIBCURL_VERSION_NUM) || (LIBCURL_VERSION_NUM < 0x070c01) switch_curl_easy_setopt(curl_handle, CURLOPT_PUT, 1); +#endif switch_curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1); switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers); switch_curl_easy_setopt(curl_handle, CURLOPT_URL, url); diff --git a/src/mod/formats/mod_shout/Makefile.am b/src/mod/formats/mod_shout/Makefile.am index ace4ce4af4..6318d312a0 100644 --- a/src/mod/formats/mod_shout/Makefile.am +++ b/src/mod/formats/mod_shout/Makefile.am @@ -7,8 +7,8 @@ if HAVE_MP3LAME mod_LTLIBRARIES = mod_shout.la mod_shout_la_SOURCES = mod_shout.c -mod_shout_la_CFLAGS = $(AM_CFLAGS) -mod_shout_la_CPPFLAGS = $(CURL_CFLAGS) $(AM_CPPFLAGS) $(SHOUT_CFLAGS) $(MP3LAME_CFLAGS) $(MPG123_CFLAGS) +mod_shout_la_CFLAGS = $(AM_CFLAGS) -DSHOUT_VERSION=$(SHOUT_VERSION) -DSHOUT_MAJOR_VERSION=$(SHOUT_MAJOR_VERSION) -DSHOUT_MINOR_VERSION=$(SHOUT_MINOR_VERSION) -DSHOUT_PATCH_VERSION=$(SHOUT_PATCH_VERSION) +mod_shout_la_CPPFLAGS = $(CURL_CFLAGS) $(AM_CPPFLAGS) $(SHOUT_CFLAGS) $(MP3LAME_CFLAGS) $(MPG123_CFLAGS) -DSHOUT_VERSION=$(SHOUT_VERSION) -DSHOUT_MAJOR_VERSION=$(SHOUT_MAJOR_VERSION) -DSHOUT_MINOR_VERSION=$(SHOUT_MINOR_VERSION) -DSHOUT_PATCH_VERSION=$(SHOUT_PATCH_VERSION) mod_shout_la_LIBADD = $(switch_builddir)/libfreeswitch.la mod_shout_la_LDFLAGS = $(CURL_LIBS) -avoid-version -module -no-undefined -shared $(SHOUT_LIBS) $(MP3LAME_LIBS) $(MPG123_LIBS) diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index 14cba068d3..be05ba5c32 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -51,6 +51,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_shout_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_shout_shutdown); SWITCH_MODULE_DEFINITION(mod_shout, mod_shout_load, mod_shout_shutdown, NULL); +#define CHECK_SHOUT_MIN_VERSION(major, minor, patch) \ + (SHOUT_MAJOR_VERSION > major || \ + (SHOUT_MAJOR_VERSION == major && SHOUT_MINOR_VERSION > minor) || \ + (SHOUT_MAJOR_VERSION == major && SHOUT_MINOR_VERSION == minor && SHOUT_PATCH_VERSION >= patch)) + static char *supported_formats[SWITCH_MAX_CODECS] = { 0 }; static struct { @@ -463,7 +468,11 @@ static size_t stream_callback(void *ptr, size_t size, size_t nmemb, void *data) return 0; } +#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x072000) +static int progress_callback(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) +#else static int progress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) +#endif { shout_context_t *context = (shout_context_t *) clientp; return context->err; @@ -496,8 +505,13 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void switch_mutex_unlock(context->audio_mutex); curl_handle = switch_curl_easy_init(); switch_curl_easy_setopt(curl_handle, CURLOPT_URL, context->stream_url); +#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x072000) + curl_easy_setopt(curl_handle, CURLOPT_XFERINFOFUNCTION, progress_callback); + curl_easy_setopt(curl_handle, CURLOPT_XFERINFODATA, (void *)context); +#else curl_easy_setopt(curl_handle, CURLOPT_PROGRESSFUNCTION, progress_callback); curl_easy_setopt(curl_handle, CURLOPT_PROGRESSDATA, (void *)context); +#endif switch_curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); switch_curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 10); switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, stream_callback); @@ -862,12 +876,20 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char goto error; } +#if (CHECK_SHOUT_MIN_VERSION(2, 4, 6)) + if (shout_set_meta(context->shout, SHOUT_META_URL, "http://www.freeswitch.org") != SHOUTERR_SUCCESS) { +#else if (shout_set_url(context->shout, "http://www.freeswitch.org") != SHOUTERR_SUCCESS) { +#endif switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout)); goto error; } +#if (CHECK_SHOUT_MIN_VERSION(2, 4, 6)) + if (shout_set_meta(context->shout, SHOUT_META_DESCRIPTION, "FreeSWITCH mod_shout Broadcasting Module") != SHOUTERR_SUCCESS) { +#else if (shout_set_description(context->shout, "FreeSWITCH mod_shout Broadcasting Module") != SHOUTERR_SUCCESS) { +#endif switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting description: %s\n", shout_get_error(context->shout)); goto error; } @@ -877,7 +899,11 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char goto error; } +#if (CHECK_SHOUT_MIN_VERSION(2, 4, 6)) + if (shout_set_content_format(context->shout, SHOUT_FORMAT_MP3, SHOUT_USAGE_AUDIO, NULL) != SHOUTERR_SUCCESS) { +#else if (shout_set_format(context->shout, SHOUT_FORMAT_MP3) != SHOUTERR_SUCCESS) { +#endif switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting format: %s\n", shout_get_error(context->shout)); goto error; } @@ -1127,21 +1153,33 @@ static switch_status_t shout_file_set_string(switch_file_handle_t *handle, switc switch (col) { case SWITCH_AUDIO_COL_STR_TITLE: +#if (CHECK_SHOUT_MIN_VERSION(2, 4, 6)) + if (shout_set_meta(context->shout, SHOUT_META_NAME, string) == SHOUTERR_SUCCESS) { +#else if (shout_set_name(context->shout, string) == SHOUTERR_SUCCESS) { +#endif status = SWITCH_STATUS_SUCCESS; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout)); } break; case SWITCH_AUDIO_COL_STR_COMMENT: +#if (CHECK_SHOUT_MIN_VERSION(2, 4, 6)) + if (shout_set_meta(context->shout, SHOUT_META_URL, string) == SHOUTERR_SUCCESS) { +#else if (shout_set_url(context->shout, string) == SHOUTERR_SUCCESS) { +#endif status = SWITCH_STATUS_SUCCESS; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout)); } break; case SWITCH_AUDIO_COL_STR_ARTIST: +#if (CHECK_SHOUT_MIN_VERSION(2, 4, 6)) + if (shout_set_meta(context->shout, SHOUT_META_DESCRIPTION, string) == SHOUTERR_SUCCESS) { +#else if (shout_set_description(context->shout, string) == SHOUTERR_SUCCESS) { +#endif status = SWITCH_STATUS_SUCCESS; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout)); diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 89614987b5..742e4f979e 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -21077,6 +21077,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_frame_free___(void * } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_is_uint_in_range___(char * jarg1, unsigned int jarg2, unsigned int jarg3) { + int jresult ; + char *arg1 = (char *) 0 ; + unsigned int arg2 ; + unsigned int arg3 ; + switch_bool_t result; + + arg1 = (char *)jarg1; + arg2 = (unsigned int)jarg2; + arg3 = (unsigned int)jarg3; + result = (switch_bool_t)switch_is_uint_in_range((char const *)arg1,arg2,arg3); + jresult = (int)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_is_number___(char * jarg1) { int jresult ; char *arg1 = (char *) 0 ; @@ -33245,6 +33261,50 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_microsecon } +SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_max_ptime_set___(void * jarg1, int jarg2) { + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; + int arg2 ; + + arg1 = (switch_codec_fmtp *)jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->max_ptime = arg2; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_max_ptime_get___(void * jarg1) { + int jresult ; + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; + int result; + + arg1 = (switch_codec_fmtp *)jarg1; + result = (int) ((arg1)->max_ptime); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_min_ptime_set___(void * jarg1, int jarg2) { + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; + int arg2 ; + + arg1 = (switch_codec_fmtp *)jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->min_ptime = arg2; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_min_ptime_get___(void * jarg1) { + int jresult ; + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; + int result; + + arg1 = (switch_codec_fmtp *)jarg1; + result = (int) ((arg1)->min_ptime); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_stereo_set___(void * jarg1, int jarg2) { switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; int arg2 ; @@ -33267,6 +33327,28 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_stereo_get } +SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_sprop_stereo_set___(void * jarg1, int jarg2) { + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; + int arg2 ; + + arg1 = (switch_codec_fmtp *)jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->sprop_stereo = arg2; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_sprop_stereo_get___(void * jarg1) { + int jresult ; + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; + int result; + + arg1 = (switch_codec_fmtp *)jarg1; + result = (int) ((arg1)->sprop_stereo); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_private_info_set___(void * jarg1, void * jarg2) { switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; void *arg2 = (void *) 0 ; @@ -36802,6 +36884,44 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_get_variab } +SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_get_variable_strdup___(void * jarg1, char * jarg2) { + char * jresult ; + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + char *arg2 = (char *) 0 ; + char *result = 0 ; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (char *)jarg2; + result = (char *)switch_channel_get_variable_strdup(arg1,(char const *)arg2); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_get_variable_buf___(void * jarg1, char * jarg2, char * jarg3, void * jarg4) { + int jresult ; + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + switch_size_t arg4 ; + switch_size_t *argp4 ; + switch_status_t result; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + argp4 = (switch_size_t *)jarg4; + if (!argp4) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0); + return 0; + } + arg4 = *argp4; + result = (switch_status_t)switch_channel_get_variable_buf(arg1,(char const *)arg2,arg3,arg4); + jresult = (int)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_get_variables___(void * jarg1, void * jarg2) { int jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; @@ -45145,6 +45265,16 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_MAX_CAND_get___() { } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_MAX_CAND_IDX_COUNT_get___() { + int jresult ; + int result; + + result = (int)(2); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_ice_t_cands_set___(void * jarg1, void * jarg2) { ice_s *arg1 = (ice_s *) 0 ; icand_t (*arg2)[2] ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 6483ed103b..02848257bf 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -10932,6 +10932,11 @@ else return ret; } + public static switch_bool_t switch_is_uint_in_range(string str, uint from, uint to) { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_is_uint_in_range(str, from, to); + return ret; + } + public static switch_bool_t switch_is_number(string str) { switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_is_number(str); return ret; @@ -11884,6 +11889,17 @@ else return ret; } + public static string switch_channel_get_variable_strdup(SWIGTYPE_p_switch_channel channel, string varname) { + string ret = freeswitchPINVOKE.switch_channel_get_variable_strdup(SWIGTYPE_p_switch_channel.getCPtr(channel), varname); + return ret; + } + + public static switch_status_t switch_channel_get_variable_buf(SWIGTYPE_p_switch_channel channel, string varname, string buf, SWIGTYPE_p_switch_size_t buflen) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_get_variable_buf(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, buf, SWIGTYPE_p_switch_size_t.getCPtr(buflen)); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + public static switch_status_t switch_channel_get_variables(SWIGTYPE_p_switch_channel channel, SWIGTYPE_p_p_switch_event arg1) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_get_variables(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_p_switch_event.getCPtr(arg1)); return ret; @@ -15223,6 +15239,7 @@ else public static readonly string SWITCH_RTP_CRYPTO_KEY_80 = freeswitchPINVOKE.SWITCH_RTP_CRYPTO_KEY_80_get(); public static readonly int SWITCH_RTP_BUNDLE_INTERNAL_PT = freeswitchPINVOKE.SWITCH_RTP_BUNDLE_INTERNAL_PT_get(); public static readonly int MAX_CAND = freeswitchPINVOKE.MAX_CAND_get(); + public static readonly int MAX_CAND_IDX_COUNT = freeswitchPINVOKE.MAX_CAND_IDX_COUNT_get(); public static readonly int SWITCH_XML_BUFSIZE = freeswitchPINVOKE.SWITCH_XML_BUFSIZE_get(); } @@ -20575,6 +20592,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_frame_free___")] public static extern int switch_frame_free(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_is_uint_in_range___")] + public static extern int switch_is_uint_in_range(string jarg1, uint jarg2, uint jarg3); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_is_number___")] public static extern int switch_is_number(string jarg1); @@ -23614,12 +23634,30 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_microseconds_per_packet_get___")] public static extern int switch_codec_fmtp_microseconds_per_packet_get(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_max_ptime_set___")] + public static extern void switch_codec_fmtp_max_ptime_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_max_ptime_get___")] + public static extern int switch_codec_fmtp_max_ptime_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_min_ptime_set___")] + public static extern void switch_codec_fmtp_min_ptime_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_min_ptime_get___")] + public static extern int switch_codec_fmtp_min_ptime_get(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_stereo_set___")] public static extern void switch_codec_fmtp_stereo_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_stereo_get___")] public static extern int switch_codec_fmtp_stereo_get(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_sprop_stereo_set___")] + public static extern void switch_codec_fmtp_sprop_stereo_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_sprop_stereo_get___")] + public static extern int switch_codec_fmtp_sprop_stereo_get(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_private_info_set___")] public static extern void switch_codec_fmtp_private_info_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); @@ -24487,6 +24525,12 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_get_variable_dup___")] public static extern string switch_channel_get_variable_dup(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, int jarg3, int jarg4); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_get_variable_strdup___")] + public static extern string switch_channel_get_variable_strdup(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_get_variable_buf___")] + public static extern int switch_channel_get_variable_buf(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_get_variables___")] public static extern int switch_channel_get_variables(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); @@ -26281,6 +26325,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_MAX_CAND_get___")] public static extern int MAX_CAND_get(); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_MAX_CAND_IDX_COUNT_get___")] + public static extern int MAX_CAND_IDX_COUNT_get(); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_ice_t_cands_set___")] public static extern void ice_t_cands_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); @@ -31066,7 +31113,8 @@ public enum switch_call_cause_t { SWITCH_CAUSE_BAD_IDENTITY_INFO = 821, SWITCH_CAUSE_UNSUPPORTED_CERTIFICATE = 822, SWITCH_CAUSE_INVALID_IDENTITY = 823, - SWITCH_CAUSE_STALE_DATE = 824 + SWITCH_CAUSE_STALE_DATE = 824, + SWITCH_CAUSE_REJECT_ALL = 825 } } @@ -32781,6 +32829,7 @@ public enum switch_codec_control_command_t { SCC_VIDEO_RESET, SCC_AUDIO_PACKET_LOSS, SCC_AUDIO_ADJUST_BITRATE, + SCC_AUDIO_VAD, SCC_DEBUG, SCC_CODEC_SPECIFIC } @@ -32905,6 +32954,26 @@ public class switch_codec_fmtp : global::System.IDisposable { } } + public int max_ptime { + set { + freeswitchPINVOKE.switch_codec_fmtp_max_ptime_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_codec_fmtp_max_ptime_get(swigCPtr); + return ret; + } + } + + public int min_ptime { + set { + freeswitchPINVOKE.switch_codec_fmtp_min_ptime_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_codec_fmtp_min_ptime_get(swigCPtr); + return ret; + } + } + public int stereo { set { freeswitchPINVOKE.switch_codec_fmtp_stereo_set(swigCPtr, value); @@ -32915,6 +32984,16 @@ public class switch_codec_fmtp : global::System.IDisposable { } } + public int sprop_stereo { + set { + freeswitchPINVOKE.switch_codec_fmtp_sprop_stereo_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_codec_fmtp_sprop_stereo_get(swigCPtr); + return ret; + } + } + public SWIGTYPE_p_void private_info { set { freeswitchPINVOKE.switch_codec_fmtp_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value)); diff --git a/src/mod/languages/mod_python3/mod_python3.c b/src/mod/languages/mod_python3/mod_python3.c index ca05f18710..263c2de1d4 100644 --- a/src/mod/languages/mod_python3/mod_python3.c +++ b/src/mod/languages/mod_python3/mod_python3.c @@ -86,6 +86,9 @@ static void print_python_error(const char * script) { PyObject *pyType = NULL, *pyValue = NULL, *pyTraceback = NULL, *pyString = NULL; PyObject *pyModule=NULL, *pyFunction = NULL, *pyResult = NULL; +#if PY_VERSION_HEX >= 0x030B0000 + PyCodeObject *pcode = NULL; +#endif char * buffer = (char*) malloc( 20 * 1024 * sizeof(char)); /* Variables for the traceback */ PyTracebackObject * pyTB = NULL/*, *pyTB2 = NULL*/; @@ -153,10 +156,23 @@ static void print_python_error(const char * script) /* Traceback */ do { - sprintf((char*)sTemp, "\n\tFile: \"%s\", line %i, in %s", +#if PY_VERSION_HEX >= 0x030B0000 + if (pyTB->tb_frame != NULL) { + pcode = PyFrame_GetCode(pyTB->tb_frame); + } else { + pcode = NULL; + } + + snprintf((char*)sTemp, sizeof(sTemp), "\n\tFile: \"%s\", line %i, in %s", + (pcode)?PyString_AsString(pcode->co_filename):"", + pyTB->tb_lineno, + (pcode)?PyString_AsString(pcode->co_name):"" ); +#else + snprintf((char*)sTemp, sizeof(sTemp), "\n\tFile: \"%s\", line %i, in %s", PyString_AsString(pyTB->tb_frame->f_code->co_filename), pyTB->tb_lineno, PyString_AsString(pyTB->tb_frame->f_code->co_name) ); +#endif strcat(buffer, (char*)sTemp); pyTB=pyTB->tb_next; diff --git a/src/mod/loggers/mod_logfile/mod_logfile.c b/src/mod/loggers/mod_logfile/mod_logfile.c index 877403c5b6..e79e23129a 100644 --- a/src/mod/loggers/mod_logfile/mod_logfile.c +++ b/src/mod/loggers/mod_logfile/mod_logfile.c @@ -98,6 +98,8 @@ static switch_status_t mod_logfile_openlogfile(logfile_profile_t *profile, switc stat = switch_file_open(&afd, profile->logfile, flags, SWITCH_FPROT_OS_DEFAULT, module_pool); if (stat != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "logfile %s open error, status=%d\n", profile->logfile, stat); + return SWITCH_STATUS_FALSE; } @@ -459,7 +461,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_logfile_load) if ((profiles = switch_xml_child(cfg, "profiles"))) { for (xprofile = switch_xml_child(profiles, "profile"); xprofile; xprofile = xprofile->next) { if (load_profile(xprofile) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error loading profile."); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error loading profile.\n"); } } } diff --git a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c index 4e3bd81f78..8a6efbf544 100644 --- a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c +++ b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c @@ -88,7 +88,7 @@ static size_t httpCallBack(char *buffer, size_t size, size_t nitems, void *outst return size * nitems; } -static switch_status_t set_xml_cdr_log_dirs() +static switch_status_t set_xml_cdr_log_dirs(void) { switch_time_exp_t tm; char *path = NULL; @@ -254,7 +254,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) #endif int wrote; wrote = write(fd, xml_text, (unsigned) strlen(xml_text)); - wrote++; + (void)wrote; close(fd); } else { char ebuf[512] = { 0 }; @@ -427,7 +427,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) #endif int wrote; wrote = write(fd, xml_text, (unsigned) strlen(xml_text)); - wrote++; + (void)wrote; close(fd); } else { char ebuf[512] = { 0 }; diff --git a/src/switch.c b/src/switch.c index 19a3d93fad..5011ff2d46 100644 --- a/src/switch.c +++ b/src/switch.c @@ -101,7 +101,7 @@ static void handle_SIGTERM(int sig) } /* kill a freeswitch process running in background mode */ -static int freeswitch_kill_background() +static int freeswitch_kill_background(void) { FILE *f; /* FILE handle to open the pid file */ char path[PATH_MAX] = ""; /* full path of the PID file */ diff --git a/src/switch_apr.c b/src/switch_apr.c index 9bc5d8a759..bd6cfdec56 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -74,7 +74,16 @@ #if (defined(HAVE_LIBMD5) || defined(HAVE_LIBMD) || defined(HAVE_MD5INIT)) #include #elif defined(HAVE_LIBCRYPTO) -#include + #ifndef OPENSSL_VERSION_NUMBER + #include + #endif + #if OPENSSL_VERSION_NUMBER < 0x30000000 + #include + #else + #include + #endif +#else + #include #endif #ifndef WIN32 @@ -1174,11 +1183,24 @@ SWITCH_DECLARE(switch_status_t) switch_md5(unsigned char digest[SWITCH_MD5_DIGES return SWITCH_STATUS_SUCCESS; #elif defined(HAVE_LIBCRYPTO) - MD5_CTX md5_context; + #if OPENSSL_VERSION_NUMBER < 0x30000000 + MD5_CTX md5_context; - MD5_Init(&md5_context); - MD5_Update(&md5_context, input, inputLen); - MD5_Final(digest, &md5_context); + MD5_Init(&md5_context); + MD5_Update(&md5_context, input, inputLen); + MD5_Final(digest, &md5_context); + #else + EVP_MD_CTX *md5_context; + + /* MD5_Init */ + md5_context = EVP_MD_CTX_new(); + EVP_DigestInit_ex(md5_context, EVP_md5(), NULL); + /* MD5_Update */ + EVP_DigestUpdate(md5_context, input, inputLen); + /* MD5_Final */ + EVP_DigestFinal_ex(md5_context, digest, NULL); + EVP_MD_CTX_free(md5_context); + #endif return SWITCH_STATUS_SUCCESS; #else diff --git a/src/switch_channel.c b/src/switch_channel.c index 6f0ad7a964..9c7b8e433d 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1022,6 +1022,24 @@ SWITCH_DECLARE(const char *) switch_channel_get_variable_dup(switch_channel_t *c return r; } +SWITCH_DECLARE(const char *) switch_channel_get_variable_strdup(switch_channel_t *channel, const char *varname) +{ + const char *value = switch_channel_get_variable_dup(channel, varname, SWITCH_FALSE, -1); + + return value ? (const char *)strdup(value) : NULL; +} + +SWITCH_DECLARE(switch_status_t) switch_channel_get_variable_buf(switch_channel_t *channel, const char *varname, char *buf, switch_size_t buflen) +{ + const char *value = switch_channel_get_variable_dup(channel, varname, SWITCH_FALSE, -1); + + if (value && buf && buflen && switch_copy_string(buf, value, buflen)) { + return SWITCH_STATUS_SUCCESS; + } + + return SWITCH_STATUS_FALSE; +} + SWITCH_DECLARE(const char *) switch_channel_get_variable_partner(switch_channel_t *channel, const char *varname) { const char *uuid; diff --git a/src/switch_console.c b/src/switch_console.c index 8e26fec749..2157fda8a2 100644 --- a/src/switch_console.c +++ b/src/switch_console.c @@ -1849,7 +1849,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string) SWITCH_STANDARD_STREAM(mystream); if (!strcasecmp(argv[0], "stickyadd")) { - mystream.write_function(&mystream, "insert into complete values (1,"); + mystream.write_function(&mystream, "insert into complete (sticky, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, hostname) values (1,"); for (x = 0; x < 10; x++) { if (argv[x + 1] && !strcasecmp(argv[x + 1], "_any_")) { mystream.write_function(&mystream, "%s", "'', "); @@ -1865,7 +1865,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string) switch_core_sql_exec(mystream.data); status = SWITCH_STATUS_SUCCESS; } else if (!strcasecmp(argv[0], "add")) { - mystream.write_function(&mystream, "insert into complete values (0,"); + mystream.write_function(&mystream, "insert into complete (sticky, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, hostname) values (0,"); for (x = 0; x < 10; x++) { if (argv[x + 1] && !strcasecmp(argv[x + 1], "_any_")) { mystream.write_function(&mystream, "%s", "'', "); diff --git a/src/switch_core.c b/src/switch_core.c index 4e2b70778a..7ec10d8885 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -3566,7 +3566,7 @@ SWITCH_DECLARE(int) switch_stream_system(const char *cmd, switch_stream_handle_t } } -SWITCH_DECLARE(uint16_t) switch_core_get_rtp_port_range_start_port() +SWITCH_DECLARE(uint16_t) switch_core_get_rtp_port_range_start_port(void) { uint16_t start_port = 0; @@ -3577,7 +3577,7 @@ SWITCH_DECLARE(uint16_t) switch_core_get_rtp_port_range_start_port() return start_port; } -SWITCH_DECLARE(uint16_t) switch_core_get_rtp_port_range_end_port() +SWITCH_DECLARE(uint16_t) switch_core_get_rtp_port_range_end_port(void) { uint16_t end_port = 0; diff --git a/src/switch_core_cert.c b/src/switch_core_cert.c index c4fdd84210..64f497ea1a 100644 --- a/src/switch_core_cert.c +++ b/src/switch_core_cert.c @@ -287,7 +287,10 @@ SWITCH_DECLARE(int) switch_core_gen_certs(const char *prefix) //bio_err=BIO_new_fp(stderr, BIO_NOCLOSE); - mkcert(&x509, &pkey, 4096, 0, 36500); + if (!mkcert(&x509, &pkey, 4096, 0, 36500)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Certificate generation failed\n"); + goto end; + } //RSA_print_fp(stdout, pkey->pkey.rsa, 0); //X509_print_fp(stdout, x509); @@ -410,7 +413,9 @@ static int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days { X509 *x; EVP_PKEY *pk; +#if OPENSSL_VERSION_NUMBER < 0x30000000 RSA *rsa; +#endif X509_NAME *name=NULL; switch_assert(pkeyp); @@ -432,7 +437,26 @@ static int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days x = *x509p; } -#if OPENSSL_VERSION_NUMBER >= 0x10100000 +#if OPENSSL_VERSION_NUMBER >= 0x30000000 + { + EVP_PKEY_CTX *ctx; + + ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL); + /* Setup the key context */ + if ((!ctx) || (EVP_PKEY_keygen_init(ctx) <= 0) || (EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, bits) <= 0)) { + abort(); + goto err; + } + + /* Generate key */ + if (EVP_PKEY_generate(ctx, &pk) <= 0) { + abort(); + goto err; + } + + EVP_PKEY_CTX_free(ctx); + } +#elif OPENSSL_VERSION_NUMBER >= 0x10100000 rsa = RSA_new(); { static const BN_ULONG ULONG_RSA_F4 = RSA_F4; @@ -449,11 +473,13 @@ static int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days rsa = RSA_generate_key(bits, RSA_F4, NULL, NULL); #endif +#if OPENSSL_VERSION_NUMBER < 0x30000000 if (!EVP_PKEY_assign_RSA(pk, rsa)) { abort(); } rsa = NULL; +#endif X509_set_version(x, 2); ASN1_INTEGER_set(X509_get_serialNumber(x), serial); @@ -476,13 +502,21 @@ static int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days */ X509_set_issuer_name(x, name); - if (!X509_sign(x, pk, EVP_sha1())) +#if OPENSSL_VERSION_NUMBER >= 0x30000000 + if (!X509_sign(x, pk, EVP_sha256())) { +#else + if (!X509_sign(x, pk, EVP_sha1())) { +#endif goto err; + } *x509p = x; *pkeyp = pk; + return(1); - err: +err: + ERR_print_errors_fp(stdout); + return(0); } diff --git a/src/switch_core_codec.c b/src/switch_core_codec.c index 69883f8122..e5c22cd610 100644 --- a/src/switch_core_codec.c +++ b/src/switch_core_codec.c @@ -120,8 +120,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_real_read_codec(switch_c } } else { /* replace real_read_codec */ switch_codec_t *cur_codec; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Original read codec replaced with %s:%d\n", - switch_channel_get_name(session->channel), codec->implementation->iananame, codec->implementation->ianacode); + switch_channel_get_name(session->channel), codec->implementation ? codec->implementation->iananame : "undefined", codec->implementation ? codec->implementation->ianacode : -1); /* Set real_read_codec to front of the list of read_codecs */ cur_codec = session->read_codec; while (cur_codec != NULL) { @@ -129,8 +130,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_real_read_codec(switch_c cur_codec->next = codec; break; } + cur_codec = cur_codec->next; } + session->real_read_codec = codec; session->real_read_impl = *codec->implementation; @@ -154,6 +157,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_real_read_codec(switch_c session->bug_codec.implementation->iananame, session->bug_codec.implementation->ianacode); switch_core_codec_destroy(&session->bug_codec); } + switch_thread_rwlock_unlock(session->bug_rwlock); } else { status = SWITCH_STATUS_FALSE; @@ -169,6 +173,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_real_read_codec(switch_c if (session->read_impl.actual_samples_per_second != session->read_impl.samples_per_second) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-read-codec-rate", "%d", session->read_impl.samples_per_second); } + switch_event_fire(&event); } @@ -191,6 +196,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_real_read_codec(switch_c } switch_mutex_unlock(session->codec_read_mutex); + return status; } @@ -221,7 +227,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s goto end; } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Push codec %s:%d\n", - switch_channel_get_name(session->channel), codec->implementation->iananame, codec->implementation->ianacode); + switch_channel_get_name(session->channel), codec->implementation ? codec->implementation->iananame : "undefined", codec->implementation ? codec->implementation->ianacode : -1); codec->next = session->read_codec; session->read_codec = codec; if (codec->implementation) { diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 60cc3d531c..252d947035 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -1170,7 +1170,7 @@ static uint32_t parse_lifetime_mki(const char **p, const char *end) val += ((**p) - '0') * i; } res |= (val & 0x000000ff); /* MKI_SIZE */ - } else if (isdigit(*(field_begin + 1)) && (field_begin + 2) && (*(field_begin + 2) == '^') && (field_begin + 3) && isdigit(*(field_begin + 3))) { + } else if (isdigit(*(field_begin + 1)) && (*(field_begin + 2) == '^') && isdigit(*(field_begin + 3))) { res |= (CRYPTO_KEY_MATERIAL_LIFETIME << 24); val = ((uint32_t) (*(field_begin + 1) - '0')) << 8; res |= val; /* LIFETIME base. */ @@ -4167,10 +4167,15 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t argc = switch_split(data, ' ', fields); + if (argc < 6 || !switch_is_uint_in_range(fields[1], 1, MAX_CAND_IDX_COUNT)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_WARNING, "Invalid data\n"); + continue; + } + cid = fields[1] ? atoi(fields[1]) - 1 : 0; - if (argc < 6 || engine->ice_in.cand_idx[cid] >= MAX_CAND - 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_WARNING, "Invalid data\n"); + if (engine->ice_in.cand_idx[cid] >= MAX_CAND - 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_WARNING, "Too many candidates\n"); continue; } @@ -4250,7 +4255,7 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t relay: - for (cid = 0; cid < 2; cid++) { + for (cid = 0; cid < MAX_CAND_IDX_COUNT; cid++) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG, "Searching for %s candidate.\n", cid ? "rtcp" : "rtp"); for (ai = 0; ai < engine->cand_acl_count; ai++) { @@ -4499,19 +4504,28 @@ struct matches { int codec_idx; }; +#ifndef MIN +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) +#endif + static void greedy_sort(switch_media_handle_t *smh, struct matches *matches, int m_idx, const switch_codec_implementation_t **codec_array, int total_codecs) { int j = 0, f = 0, g; struct matches mtmp[MAX_MATCHES] = { { 0 } }; + + m_idx = MIN(m_idx, MAX_MATCHES); + for(j = 0; j < m_idx; j++) { *&mtmp[j] = *&matches[j]; - } - for (g = 0; g < smh->mparams->num_codecs && g < total_codecs; g++) { + } + + for (g = 0; g < smh->mparams->num_codecs && g < total_codecs && f < MAX_MATCHES; g++) { const switch_codec_implementation_t *imp = codec_array[g]; for(j = 0; j < m_idx; j++) { - if (mtmp[j].imp == imp) { + if (mtmp[j].imp && mtmp[j].imp == imp) { *&matches[f++] = *&mtmp[j]; + mtmp[j].imp = NULL; } } } @@ -4762,7 +4776,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s switch_channel_t *channel = switch_core_session_get_channel(session); const char *val; const char *crypto = NULL; - int got_crypto = 0, got_video_crypto = 0, got_audio = 0, saw_audio = 0, saw_video = 0, got_avp = 0, got_video_avp = 0, got_video_savp = 0, got_savp = 0, got_udptl = 0, got_webrtc = 0, got_text = 0, got_text_crypto = 0, got_msrp = 0; + int got_crypto = 0, got_video_crypto = 0, got_audio = 0, saw_audio = 0, saw_video = 0, got_avp = 0, got_savp = 0, got_udptl = 0, got_webrtc = 0, got_text = 0, got_text_crypto = 0, got_msrp = 0; int scrooge = 0; sdp_parser_t *parser = NULL; sdp_session_t *sdp; @@ -4958,14 +4972,10 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s if (m->m_proto == sdp_proto_srtp || m->m_proto == sdp_proto_extended_srtp) { if (m->m_type == sdp_media_audio) { got_savp++; - } else { - got_video_savp++; } } else if (m->m_proto == sdp_proto_rtp) { if (m->m_type == sdp_media_audio) { got_avp++; - } else { - got_video_avp++; } } else if (m->m_proto == sdp_proto_udptl) { got_udptl++; @@ -5549,6 +5559,13 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s /* ptime does not match */ match = 0; + if (nm_idx >= MAX_MATCHES) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, + "Audio Codec Compare [%s:%d:%u:%u:%d:%u:%d] was not saved as a near-match. Too many. Ignoring.\n", + imp->iananame, imp->ianacode, codec_rate, imp->actual_samples_per_second, imp->microseconds_per_packet / 1000, bit_rate, imp->number_of_channels); + continue; + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Audio Codec Compare [%s:%d:%u:%d:%u:%d] is saved as a near-match\n", imp->iananame, imp->ianacode, codec_rate, imp->microseconds_per_packet / 1000, bit_rate, imp->number_of_channels); @@ -6157,10 +6174,18 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s imp->iananame, map->rm_pt); m_idx++; + + if (m_idx >= MAX_MATCHES) { + break; + } } vmatch = 0; } + + if (m_idx >= MAX_MATCHES) { + break; + } } if (consider_video_fmtp && (!m_idx || almost_vmatch)) { @@ -7406,7 +7431,7 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi switch_status_t status; switch_frame_t *read_frame = NULL; switch_media_handle_t *smh; - uint32_t loops = 0, xloops = 0, vloops = 0; + uint32_t loops = 0, xloops = 0; switch_image_t *blank_img = NULL; switch_frame_t fr = { 0 }; unsigned char *buf = NULL; @@ -7531,8 +7556,6 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi continue; } - vloops++; - send_blank = blank_enabled || switch_channel_test_flag(channel, CF_VIDEO_ECHO); if (switch_channel_test_flag(channel, CF_VIDEO_READY) && !switch_test_flag(read_frame, SFF_CNG)) { @@ -14243,7 +14266,7 @@ SWITCH_DECLARE(char *) switch_core_media_filter_sdp(const char *sdp_str, const c switch_size_t len; const char *i; char *o; - int in_m = 0, m_tally = 0, slash = 0; + int in_m = 0, slash = 0; int number = 0, skip = 0; int remove = !strcasecmp(cmd, "remove"); int only = !strcasecmp(cmd, "only"); @@ -14277,7 +14300,6 @@ SWITCH_DECLARE(char *) switch_core_media_filter_sdp(const char *sdp_str, const c if (*i == 'm' && *(i+1) == '=') { in_m = 1; - m_tally++; } if (in_m) { @@ -14981,7 +15003,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core { switch_status_t status = SWITCH_STATUS_FALSE; switch_io_event_hook_video_read_frame_t *ptr; - uint32_t loops = 0; switch_media_handle_t *smh; int is_keyframe = 0; @@ -14993,8 +15014,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core top: - loops++; - if (switch_channel_down_nosig(session->channel)) { return SWITCH_STATUS_FALSE; } diff --git a/src/switch_core_session.c b/src/switch_core_session.c index a103a6e964..61aa500070 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -799,6 +799,7 @@ static const char *message_names[] = { "DEFLECT", "VIDEO_REFRESH_REQ", "DISPLAY", + "MEDIA_PARAMS", "TRANSCODING_NECESSARY", "AUDIO_SYNC", "VIDEO_SYNC", diff --git a/src/switch_curl.c b/src/switch_curl.c index c99a5f61de..d6cfd6ce19 100644 --- a/src/switch_curl.c +++ b/src/switch_curl.c @@ -58,11 +58,16 @@ SWITCH_DECLARE(void) switch_curl_destroy(void) curl_global_cleanup(); } -SWITCH_DECLARE(switch_status_t) switch_curl_process_form_post_params(switch_event_t *event, switch_CURL *curl_handle, struct curl_httppost **formpostp) +SWITCH_DECLARE(switch_status_t) switch_curl_process_mime(switch_event_t *event, switch_CURL *curl_handle, switch_curl_mime **mimep) { - +#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800) + curl_mime *mime = NULL; + curl_mimepart *part = NULL; + uint8_t added = 0; +#else struct curl_httppost *formpost=NULL; struct curl_httppost *lastptr=NULL; +#endif switch_event_header_t *hp; int go = 0; @@ -77,39 +82,87 @@ SWITCH_DECLARE(switch_status_t) switch_curl_process_form_post_params(switch_even return SWITCH_STATUS_FALSE; } - for (hp = event->headers; hp; hp = hp->next) { +#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800) + mime = curl_mime_init(curl_handle); +#endif + for (hp = event->headers; hp; hp = hp->next) { if (!strncasecmp(hp->name, "attach_file:", 12)) { char *pname = strdup(hp->name + 12); if (pname) { char *fname = strchr(pname, ':'); + if (fname) { *fname++ = '\0'; +#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800) + part = curl_mime_addpart(mime); + curl_mime_name(part, pname); + curl_mime_filename(part, fname); + curl_mime_filedata(part, hp->value); + added++; +#else curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, pname, CURLFORM_FILENAME, fname, CURLFORM_FILE, hp->value, CURLFORM_END); +#endif } + free(pname); } } else { +#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800) + part = curl_mime_addpart(mime); + curl_mime_name(part, hp->name); + curl_mime_data(part, hp->value, CURL_ZERO_TERMINATED); + added++; +#else curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, hp->name, CURLFORM_COPYCONTENTS, hp->value, CURLFORM_END); - +#endif } } - *formpostp = formpost; +#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800) + if (!added) { + curl_mime_free(mime); + mime = NULL; + } + + *mimep = mime; +#else + *mimep = formpost; +#endif return SWITCH_STATUS_SUCCESS; +} +SWITCH_DECLARE(void) switch_curl_mime_free(switch_curl_mime **mimep) +{ + if (mimep && *mimep) { +#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800) + curl_mime_free(*mimep); +#else + curl_formfree(*mimep); +#endif + mimep = NULL; + } +} + +SWITCH_DECLARE(switch_CURLcode) switch_curl_easy_setopt_mime(switch_CURL *curl_handle, switch_curl_mime *mime) +{ +#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800) + return curl_easy_setopt(curl_handle, CURLOPT_MIMEPOST, mime); +#else + return curl_easy_setopt(curl_handle, CURLOPT_HTTPPOST, mime); +#endif } /* For Emacs: diff --git a/src/switch_event.c b/src/switch_event.c index be49f2fc14..02a6f81505 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -651,7 +651,6 @@ SWITCH_DECLARE(void) switch_event_launch_dispatch_threads(uint32_t max) { switch_threadattr_t *thd_attr; uint32_t index = 0; - int launched = 0; uint32_t sanity = 200; switch_memory_pool_t *pool = RUNTIME_POOL; @@ -682,7 +681,6 @@ SWITCH_DECLARE(void) switch_event_launch_dispatch_threads(uint32_t max) } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Create additional event dispatch thread %d\n", index); } - launched++; } SOFT_MAX_DISPATCH = index; @@ -2073,15 +2071,18 @@ SWITCH_DECLARE(switch_status_t) switch_event_bind_removable(const char *id, swit switch_mutex_lock(CUSTOM_HASH_MUTEX); if (!(subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name))) { - switch_event_reserve_subclass_detailed(id, subclass_name); - subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name); - subclass->bind = 1; + if (switch_event_reserve_subclass_detailed(id, subclass_name) == SWITCH_STATUS_SUCCESS) { + if ((subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name))) { + subclass->bind = 1; + } + } } switch_mutex_unlock(CUSTOM_HASH_MUTEX); if (!subclass) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not reserve subclass. '%s'\n", subclass_name); + return SWITCH_STATUS_FALSE; } } @@ -2096,6 +2097,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_bind_removable(const char *id, swit if (subclass_name) { event_node->subclass_name = DUP(subclass_name); } + event_node->callback = callback; event_node->user_data = user_data; @@ -2954,14 +2956,17 @@ static void ecd_deliver(event_channel_data_t **ecdP) int x_argc = switch_separate_string_string(key, (char*) sep, x_argv, SWITCH_CHANNEL_DISPATCH_MAX_KEY_PARTS); char buf[1024]; int i, r; + for(i=x_argc - 1; i > 0; i--) { int z; + memset(buf, 0, 1024); - sprintf(buf, "%s", x_argv[0]); + switch_snprintf(buf, sizeof(buf), "%s", x_argv[0]); for(z=1; z < i; z++) { strcat(buf, sep); - strcat(buf, x_argv[z]); + strncat(buf, x_argv[z], sizeof(buf) - strlen(buf) - 1); } + r = _switch_event_channel_broadcast(buf, ecd->event_channel, ecd->json, ecd->key, ecd->id); t += r; if (r && switch_core_test_flag(SCF_EVENT_CHANNEL_HIERARCHY_DELIVERY_ONCE)) { @@ -2970,11 +2975,13 @@ static void ecd_deliver(event_channel_data_t **ecdP) } } else { char *p = NULL; + if ((p = strchr(key, '.'))) { *p = '\0'; t += _switch_event_channel_broadcast(key, ecd->event_channel, ecd->json, ecd->key, ecd->id); } } + switch_safe_free(key); t += _switch_event_channel_broadcast(SWITCH_EVENT_CHANNEL_GLOBAL, ecd->event_channel, ecd->json, ecd->key, ecd->id); @@ -2982,6 +2989,7 @@ static void ecd_deliver(event_channel_data_t **ecdP) if(t == 0) { if (switch_core_test_flag(SCF_EVENT_CHANNEL_LOG_UNDELIVERABLE_JSON)) { char *json = cJSON_Print(ecd->json); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no subscribers for %s , %s => %s\n", ecd->event_channel, ecd->key, json); switch_safe_free(json); } else { diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index f23549713b..a39553e2f9 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -186,15 +186,16 @@ struct key_collect { static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void *obj) { struct key_collect *collect = (struct key_collect *) obj; - switch_channel_t *channel = switch_core_session_get_channel(collect->session); + switch_channel_t *channel = NULL; char buf[10] = SWITCH_BLANK_STRING; switch_application_interface_t *application_interface = NULL; - if (collect->session) { - if (switch_core_session_read_lock(collect->session) != SWITCH_STATUS_SUCCESS) { - return NULL; - } - } else { + if (!collect->session) { + return NULL; + } + + channel = switch_core_session_get_channel(collect->session); + if (switch_core_session_read_lock(collect->session) != SWITCH_STATUS_SUCCESS) { return NULL; } @@ -232,6 +233,7 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void switch_channel_set_flag(channel, CF_WINNER); switch_channel_set_variable(channel, "group_dial_status", "winner"); } + goto wbreak; } @@ -271,6 +273,7 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void switch_ivr_play_file(collect->session, NULL, collect->error_file, NULL); } } + wbreak: switch_core_session_rwunlock(collect->session); diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 25486eee7f..33f3a4e51a 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1271,7 +1271,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess int sleep_val_i = 250; int eof = 0; switch_size_t bread = 0; - int l16 = 0; switch_codec_implementation_t read_impl = { 0 }; char *file_dup; char *argv[128] = { 0 }; @@ -1334,10 +1333,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess arg_recursion_check_start(args); - if (!zstr(read_impl.iananame) && !strcasecmp(read_impl.iananame, "l16")) { - l16++; - } - if (play_delimiter) { file_dup = switch_core_session_strdup(session, file); argc = switch_separate_string(file_dup, play_delimiter, argv, (sizeof(argv) / sizeof(argv[0]))); diff --git a/src/switch_jitterbuffer.c b/src/switch_jitterbuffer.c index d8d9df3a33..6aa872c439 100644 --- a/src/switch_jitterbuffer.c +++ b/src/switch_jitterbuffer.c @@ -362,25 +362,22 @@ static inline void hide_nodes(switch_jb_t *jb) } static inline switch_bool_t packet_vad(switch_jb_t *jb, switch_rtp_packet_t *packet, switch_size_t len) { - void* payload; + void *payload = packet ? (packet->ebody ? packet->ebody : packet->body) : NULL; uint16_t payload_len = len; - if (packet->ebody) { - payload = packet->ebody; - } else { - payload = packet->body; - } if (payload && payload_len > 0) { - switch_bool_t ret; - switch_bool_t *ret_p = &ret; + switch_bool_t ret = SWITCH_FALSE, *ret_p = &ret; switch_codec_control_type_t ret_t; + switch_core_media_codec_control(jb->session, SWITCH_MEDIA_TYPE_AUDIO, SWITCH_IO_WRITE, SCC_AUDIO_VAD, SCCT_STRING, (void *)payload, SCCT_INT, (void *)&payload_len, &ret_t, (void *)&ret_p); + return ret; } + return SWITCH_TRUE; } @@ -916,126 +913,153 @@ static inline switch_status_t jb_next_packet_by_ts(switch_jb_t *jb, switch_jb_no static inline int check_jb_size(switch_jb_t *jb) { switch_jb_node_t *np; - uint16_t seq; - uint16_t l_seq=0; - uint16_t h_seq=0; - uint16_t count=0; - uint16_t old=0; + uint16_t seq_hs, target_seq_hs; + uint16_t l_seq = 0; + uint16_t h_seq = 0; + uint16_t count = 0; + uint16_t old = 0; + switch_mutex_lock(jb->list_mutex); + target_seq_hs = ntohs(jb->target_seq); + for (np = jb->node_list; np; np = np->next) { if (!np->visible) { continue; } - seq = ntohs(np->packet.header.seq); - if (ntohs(jb->target_seq) > seq) { - hide_node(np, SWITCH_FALSE); - old++; - continue; - } - if (count == 0) { - l_seq = h_seq = seq; - } - count++; - if (seq < l_seq) - l_seq = seq; - if (seq > h_seq) - h_seq = seq; + seq_hs = ntohs(np->packet.header.seq); + if (target_seq_hs > seq_hs) { + hide_node(np, SWITCH_FALSE); + old++; + continue; + } + + if (count == 0) { + l_seq = h_seq = seq_hs; + } + + count++; + + if (seq_hs < l_seq) { + l_seq = seq_hs; + } + + if (seq_hs > h_seq) { + h_seq = seq_hs; + } } + if (count > jb->jitter.stats.size_max) { jb->jitter.stats.size_max = count; } + if (jb->jitter.stats.size_est == 0) { jb->jitter.stats.size_est = count; } else { - jb->jitter.stats.size_est = ((99*jb->jitter.stats.size_est)+(1*count))/100; + jb->jitter.stats.size_est = ((99 * jb->jitter.stats.size_est) + (1 * count)) / 100; } - if (ntohs(jb->target_seq) % 50 == 0) { /* update the stats every x packets */ + + /* update the stats every x packets */ + if (target_seq_hs % 50 == 0) { int packet_ms = jb->jitter.samples_per_frame / (jb->jitter.samples_per_second / 1000); + jb->jitter.stats.estimate_ms = (*jb->jitter.estimate) / jb->jitter.samples_per_second * 1000; - switch_channel_set_variable_printf(jb->channel, "rtp_jb_size_max_ms", "%u", jb->jitter.stats.size_max*packet_ms); - switch_channel_set_variable_printf(jb->channel, "rtp_jb_size_est_ms", "%u", jb->jitter.stats.size_est*packet_ms); - switch_channel_set_variable_printf(jb->channel, "rtp_jb_acceleration_ms", "%u", jb->jitter.stats.acceleration*packet_ms); - switch_channel_set_variable_printf(jb->channel, "rtp_jb_expand_ms", "%u", jb->jitter.stats.expand*packet_ms); - if (jb->jitter.stats.jitter_max_ms < jb->jitter.stats.estimate_ms) { + if (jb->channel) { + switch_channel_set_variable_printf(jb->channel, "rtp_jb_size_max_ms", "%u", jb->jitter.stats.size_max * packet_ms); + switch_channel_set_variable_printf(jb->channel, "rtp_jb_size_est_ms", "%u", jb->jitter.stats.size_est * packet_ms); + switch_channel_set_variable_printf(jb->channel, "rtp_jb_acceleration_ms", "%u", jb->jitter.stats.acceleration * packet_ms); + switch_channel_set_variable_printf(jb->channel, "rtp_jb_expand_ms", "%u", jb->jitter.stats.expand * packet_ms); + } + + if (jb->jitter.stats.jitter_max_ms < jb->jitter.stats.estimate_ms) { jb->jitter.stats.jitter_max_ms = jb->jitter.stats.estimate_ms; } - switch_channel_set_variable_printf(jb->channel, "rtp_jb_jitter_max_ms", "%u", jb->jitter.stats.jitter_max_ms); - switch_channel_set_variable_printf(jb->channel, "rtp_jb_jitter_est_ms", "%u", jb->jitter.stats.estimate_ms); + + if (jb->channel) { + switch_channel_set_variable_printf(jb->channel, "rtp_jb_jitter_max_ms", "%u", jb->jitter.stats.jitter_max_ms); + switch_channel_set_variable_printf(jb->channel, "rtp_jb_jitter_est_ms", "%u", jb->jitter.stats.estimate_ms); + } } + if (old) { sort_free_nodes(jb); } + switch_mutex_unlock(jb->list_mutex); - jb_debug(jb, SWITCH_LOG_INFO, "JITTER buffersize %u == %u old[%u] target[%u] seq[%u|%u]\n", count, h_seq-l_seq+1, old, ntohs(jb->target_seq), l_seq, h_seq); + + jb_debug(jb, SWITCH_LOG_INFO, "JITTER buffersize %u == %u old[%u] target[%u] seq[%u|%u]\n", count, h_seq - l_seq + 1, old, target_seq_hs, l_seq, h_seq); + return count; } static inline switch_status_t jb_next_packet_by_seq_with_acceleration(switch_jb_t *jb, switch_jb_node_t **nodep) { - switch_status_t status = jb_next_packet_by_seq(jb, nodep); - switch_rtp_packet_t *packet; - uint32_t len; - uint16_t seq = ntohs(jb->target_seq); + switch_status_t status = jb_next_packet_by_seq(jb, nodep); + switch_rtp_packet_t *packet; + uint32_t len; + uint16_t seq = ntohs(jb->target_seq); - /* When using a Codec that provides voice activity detection ex. Opus, use it to - select packet to drop/accelerate. */ + /* When using a Codec that provides voice activity detection ex. Opus, use it to + select packet to drop/accelerate. */ - if (jb->elastic && jb->jitter.estimate && (jb->visible_nodes*jb->jitter.samples_per_frame)>0 && jb->jitter.samples_per_second) { - int visible_not_old = check_jb_size(jb); - jb->jitter.stats.estimate_ms = (int)((*jb->jitter.estimate)/((jb->jitter.samples_per_second))*1000); - jb->jitter.stats.buffer_size_ms = (int)((visible_not_old*jb->jitter.samples_per_frame)/(jb->jitter.samples_per_second/1000)); + if (jb->elastic && jb->jitter.estimate && (jb->visible_nodes * jb->jitter.samples_per_frame) > 0 && jb->jitter.samples_per_second) { + int visible_not_old = check_jb_size(jb); - // We try to accelerate in order to remove delay when the jitter buffer is 3x larger than the estimation. - if (jb->jitter.stats.buffer_size_ms > (3*jb->jitter.stats.estimate_ms) && jb->jitter.stats.buffer_size_ms > 60) { - if (status == SWITCH_STATUS_SUCCESS) { - packet = &(*nodep)->packet; - seq = ntohs((*nodep)->packet.header.seq); - len = (*nodep)->len; - } - if (jb->jitter.drop_gap > 0) { - jb_debug(jb, SWITCH_LOG_INFO, "JITTER estimation %dms buffersize %d/%d %dms seq:%u [drop-gap][%d]\n", - jb->jitter.stats.estimate_ms, jb->complete_frames , jb->frame_len, jb->jitter.stats.buffer_size_ms, seq, jb->jitter.drop_gap); - jb->jitter.drop_gap--; - } else { - if (status != SWITCH_STATUS_SUCCESS || packet_vad(jb, packet, len) == SWITCH_FALSE) { - jb->jitter.drop_gap = 3; - if (status != SWITCH_STATUS_SUCCESS) { - jb_debug(jb, SWITCH_LOG_INFO, "JITTER estimation n/a buffersize %d/%d %dms seq:%u [drop-missing/no-plc]\n", - jb->complete_frames , jb->frame_len, jb->jitter.stats.buffer_size_ms, seq); - } else { - jb_debug(jb, SWITCH_LOG_INFO, "JITTER estimation %dms buffersize %d/%d %dms seq:%u ACCELERATE [drop]\n", - jb->jitter.stats.estimate_ms, jb->complete_frames , jb->frame_len, jb->jitter.stats.buffer_size_ms, seq); - } - jb->jitter.stats.acceleration++; - return jb_next_packet_by_seq(jb, nodep); - } else { - jb_debug(jb, SWITCH_LOG_INFO, "JITTER estimation %dms buffersize %d/%d %dms seq:%u [drop-skip-vad]\n", - jb->jitter.stats.estimate_ms, jb->complete_frames , jb->frame_len, jb->jitter.stats.buffer_size_ms, seq); - } - } - } else { - jb_debug(jb, 2, "JITTER estimation %dms buffersize %d/%d %dms\n", - jb->jitter.stats.estimate_ms, jb->complete_frames , jb->frame_len, jb->jitter.stats.buffer_size_ms); + jb->jitter.stats.estimate_ms = (int)((*jb->jitter.estimate) / ((jb->jitter.samples_per_second)) * 1000); + jb->jitter.stats.buffer_size_ms = (int)((visible_not_old * jb->jitter.samples_per_frame) / (jb->jitter.samples_per_second / 1000)); + + /* We try to accelerate in order to remove delay when the jitter buffer is 3x larger than the estimation. */ + if (jb->jitter.stats.buffer_size_ms > (3 * jb->jitter.stats.estimate_ms) && jb->jitter.stats.buffer_size_ms > 60) { + if (status == SWITCH_STATUS_SUCCESS) { + packet = &(*nodep)->packet; + seq = ntohs((*nodep)->packet.header.seq); + len = (*nodep)->len; } + + if (jb->jitter.drop_gap > 0) { + jb_debug(jb, SWITCH_LOG_INFO, "JITTER estimation %dms buffersize %d/%d %dms seq:%u [drop-gap][%d]\n", + jb->jitter.stats.estimate_ms, jb->complete_frames, jb->frame_len, jb->jitter.stats.buffer_size_ms, seq, jb->jitter.drop_gap); + jb->jitter.drop_gap--; + } else { + if (status != SWITCH_STATUS_SUCCESS || packet_vad(jb, packet, len) == SWITCH_FALSE) { + jb->jitter.drop_gap = 3; + if (status != SWITCH_STATUS_SUCCESS) { + jb_debug(jb, SWITCH_LOG_INFO, "JITTER estimation n/a buffersize %d/%d %dms seq:%u [drop-missing/no-plc]\n", + jb->complete_frames, jb->frame_len, jb->jitter.stats.buffer_size_ms, seq); + } else { + jb_debug(jb, SWITCH_LOG_INFO, "JITTER estimation %dms buffersize %d/%d %dms seq:%u ACCELERATE [drop]\n", + jb->jitter.stats.estimate_ms, jb->complete_frames, jb->frame_len, jb->jitter.stats.buffer_size_ms, seq); + } + + jb->jitter.stats.acceleration++; + + return jb_next_packet_by_seq(jb, nodep); + } else { + jb_debug(jb, SWITCH_LOG_INFO, "JITTER estimation %dms buffersize %d/%d %dms seq:%u [drop-skip-vad]\n", + jb->jitter.stats.estimate_ms, jb->complete_frames, jb->frame_len, jb->jitter.stats.buffer_size_ms, seq); + } + } + } else { + jb_debug(jb, 2, "JITTER estimation %dms buffersize %d/%d %dms\n", + jb->jitter.stats.estimate_ms, jb->complete_frames, jb->frame_len, jb->jitter.stats.buffer_size_ms); } - return status; + } + + return status; } static inline switch_status_t jb_next_packet(switch_jb_t *jb, switch_jb_node_t **nodep) { if (jb->samples_per_frame) { return jb_next_packet_by_ts(jb, nodep); - } else { - switch_status_t status; - if (jb->elastic && jb->jitter.estimate) { - status = jb_next_packet_by_seq_with_acceleration(jb, nodep); - } else { - status = jb_next_packet_by_seq(jb, nodep); - } - return status; } + + if (jb->elastic && jb->jitter.estimate) { + return jb_next_packet_by_seq_with_acceleration(jb, nodep); + } + + return jb_next_packet_by_seq(jb, nodep); } static inline void free_nodes(switch_jb_t *jb) @@ -1055,21 +1079,24 @@ SWITCH_DECLARE(void) switch_jb_ts_mode(switch_jb_t *jb, uint32_t samples_per_fra SWITCH_DECLARE(void) switch_jb_set_jitter_estimator(switch_jb_t *jb, double *jitter, uint32_t samples_per_frame, uint32_t samples_per_second) { if (jb && jitter) { - memset(&jb->jitter,0,sizeof(switch_jb_jitter_t)); - switch_channel_set_variable_printf(jb->channel, "rtp_jb_max_ms", "%u", 0); - switch_channel_set_variable_printf(jb->channel, "rtp_jb_size_ms", "%u", 0); - switch_channel_set_variable_printf(jb->channel, "rtp_jb_acceleration_ms", "%u", 0); - switch_channel_set_variable_printf(jb->channel, "rtp_jb_expand_ms", "%u", 0); - switch_channel_set_variable_printf(jb->channel, "rtp_jb_jitter_max_ms", "%u", 0); - switch_channel_set_variable_printf(jb->channel, "rtp_jb_jitter_ms", "%u", 0); - switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_count", "%u", 0); - switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_too_big", "%u", 0); - switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_missing_frames", "%u", 0); - switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_ts_jump", "%u", 0); - switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_error", "%u", 0); + memset(&jb->jitter, 0, sizeof(switch_jb_jitter_t)); + if (jb->channel) { + switch_channel_set_variable_printf(jb->channel, "rtp_jb_max_ms", "%u", 0); + switch_channel_set_variable_printf(jb->channel, "rtp_jb_size_ms", "%u", 0); + switch_channel_set_variable_printf(jb->channel, "rtp_jb_acceleration_ms", "%u", 0); + switch_channel_set_variable_printf(jb->channel, "rtp_jb_expand_ms", "%u", 0); + switch_channel_set_variable_printf(jb->channel, "rtp_jb_jitter_max_ms", "%u", 0); + switch_channel_set_variable_printf(jb->channel, "rtp_jb_jitter_ms", "%u", 0); + switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_count", "%u", 0); + switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_too_big", "%u", 0); + switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_missing_frames", "%u", 0); + switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_ts_jump", "%u", 0); + switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_error", "%u", 0); + } + jb->jitter.estimate = jitter; jb->jitter.samples_per_frame = samples_per_frame; - jb->jitter.samples_per_second = samples_per_second; + jb->jitter.samples_per_second = samples_per_second; jb->jitter.drop_gap = 5; } } @@ -1083,22 +1110,22 @@ SWITCH_DECLARE(void) switch_jb_set_session(switch_jb_t *jb, switch_core_session_ jb->session = session; jb->channel = switch_core_session_get_channel(session); if (!strcmp(jb->codec->implementation->iananame, "opus")) { - if (switch_true(switch_channel_get_variable(jb->channel, "rtp_jitter_buffer_accelerate"))) { + if (switch_channel_var_true(jb->channel, "rtp_jitter_buffer_accelerate")) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "codec is %s, accelerate on\n", jb->codec->implementation->iananame); jb->elastic = SWITCH_TRUE; } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "codec is %s, accelerate off\n", jb->codec->implementation->iananame); jb->elastic = SWITCH_FALSE; } - } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "codec not opus: %s\n", jb->codec->implementation->iananame); jb->elastic = SWITCH_FALSE; } - if (jb->type == SJB_VIDEO && !switch_test_flag(jb, SJB_QUEUE_ONLY) && + if (jb->type == SJB_VIDEO && !switch_test_flag(jb, SJB_QUEUE_ONLY) && (var = switch_channel_get_variable_dup(jb->channel, "jb_video_low_bitrate", SWITCH_FALSE, -1))) { int tmp = atoi(var); + if (tmp >= 128 && tmp <= 10240) { jb->video_low_bitrate = (uint32_t)tmp; } @@ -1145,11 +1172,13 @@ SWITCH_DECLARE(void) switch_jb_debug_level(switch_jb_t *jb, uint8_t level) SWITCH_DECLARE(void) switch_jb_reset(switch_jb_t *jb) { jb->jitter.stats.reset++; - switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_count", "%u", jb->jitter.stats.reset); - switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_too_big", "%u", jb->jitter.stats.reset_too_big); - switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_missing_frames", "%u", jb->jitter.stats.reset_missing_frames); - switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_ts_jump", "%u", jb->jitter.stats.reset_ts_jump); - switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_error", "%u", jb->jitter.stats.reset_error); + if (jb->channel) { + switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_count", "%u", jb->jitter.stats.reset); + switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_too_big", "%u", jb->jitter.stats.reset_too_big); + switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_missing_frames", "%u", jb->jitter.stats.reset_missing_frames); + switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_ts_jump", "%u", jb->jitter.stats.reset_ts_jump); + switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_error", "%u", jb->jitter.stats.reset_error); + } if (jb->type == SJB_VIDEO) { switch_mutex_lock(jb->mutex); @@ -1161,13 +1190,13 @@ SWITCH_DECLARE(void) switch_jb_reset(switch_jb_t *jb) switch_core_session_request_video_refresh(jb->session); } } - + jb_debug(jb, 2, "%s", "RESET BUFFER\n"); switch_mutex_lock(jb->mutex); hide_nodes(jb); switch_mutex_unlock(jb->mutex); - + jb->drop_flag = 0; jb->last_target_seq = 0; jb->target_seq = 0; @@ -1478,7 +1507,6 @@ SWITCH_DECLARE(switch_status_t) switch_jb_put_packet(switch_jb_t *jb, switch_rtp jb->jitter.stats.reset_missing_frames++; switch_jb_reset(jb); } else { - if (jb->type != SJB_VIDEO && jb->frame_len < got - want) { jb_frame_inc(jb, 1); } @@ -1666,12 +1694,13 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp } else { if (jb->elastic) { int visible_not_old = check_jb_size(jb); - jb->jitter.stats.estimate_ms = (int)((*jb->jitter.estimate)/((jb->jitter.samples_per_second))*1000); - jb->jitter.stats.buffer_size_ms = (int)((visible_not_old*jb->jitter.samples_per_frame)/(jb->jitter.samples_per_second/1000)); + + jb->jitter.stats.estimate_ms = (int)((*jb->jitter.estimate) / ((jb->jitter.samples_per_second)) * 1000); + jb->jitter.stats.buffer_size_ms = (int)((visible_not_old * jb->jitter.samples_per_frame) / (jb->jitter.samples_per_second / 1000)); /* When playing PLC, we take the oportunity to expand the buffer if the jitter buffer is smaller than the 3x the estimated jitter. */ - if (jb->jitter.stats.buffer_size_ms < (3*jb->jitter.stats.estimate_ms)) { + if (jb->jitter.stats.buffer_size_ms < (3 * jb->jitter.stats.estimate_ms)) { jb_debug(jb, SWITCH_LOG_INFO, "JITTER estimation %dms buffersize %d/%d %dms EXPAND [plc]\n", - jb->jitter.stats.estimate_ms, jb->complete_frames , jb->frame_len, jb->jitter.stats.buffer_size_ms); + jb->jitter.stats.estimate_ms, jb->complete_frames, jb->frame_len, jb->jitter.stats.buffer_size_ms); jb->jitter.stats.expand++; decrement_seq(jb); } else { @@ -1680,6 +1709,7 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp } else { jb_debug(jb, 2, "%s", "Frame not found suggest PLC\n"); } + plc = 1; switch_goto_status(SWITCH_STATUS_NOTFOUND, end); } diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index f782e89f6e..bacd2f012a 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -115,12 +115,11 @@ static void *SWITCH_THREAD_FUNC switch_loadable_module_exec(switch_thread_t *thr switch_status_t status = SWITCH_STATUS_SUCCESS; switch_core_thread_session_t *ts = obj; switch_loadable_module_t *module = ts->objs[0]; - int restarts; switch_assert(thread != NULL); switch_assert(module != NULL); - for (restarts = 0; status != SWITCH_STATUS_TERM && !module->shutting_down; restarts++) { + while (status != SWITCH_STATUS_TERM && !module->shutting_down) { status = module->switch_module_runtime(); } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Thread ended for %s\n", module->module_interface->module_name); diff --git a/src/switch_log.c b/src/switch_log.c index 74a5713635..563a554510 100644 --- a/src/switch_log.c +++ b/src/switch_log.c @@ -246,7 +246,7 @@ SWITCH_DECLARE(cJSON *) switch_log_node_to_json(const switch_log_node_t *node, i return json; } -static switch_log_node_t *switch_log_node_alloc() +static switch_log_node_t *switch_log_node_alloc(void) { switch_log_node_t *node = NULL; #ifdef SWITCH_LOG_RECYCLE diff --git a/src/switch_msrp.c b/src/switch_msrp.c index 1f5db7ac20..9fd84d846b 100644 --- a/src/switch_msrp.c +++ b/src/switch_msrp.c @@ -99,7 +99,7 @@ static switch_bool_t msrp_check_success_report(switch_msrp_msg_t *msrp_msg) return (msrp_h_success_report && !strcmp(msrp_h_success_report, "yes")); } -static void msrp_deinit_ssl() +static void msrp_deinit_ssl(void) { globals.ssl_ready = 0; if (globals.ssl_ctx) { @@ -112,7 +112,7 @@ static void msrp_deinit_ssl() } } -static void msrp_init_ssl() +static void msrp_init_ssl(void) { const char *err = ""; @@ -187,7 +187,7 @@ static void msrp_init_ssl() SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ip, globals.ip); -static switch_status_t load_config() +static switch_status_t load_config(void) { char *cf = "msrp.conf"; switch_xml_t cfg, xml = NULL, settings, param; @@ -286,12 +286,12 @@ sock_fail: return rv; } -SWITCH_DECLARE(const char *) switch_msrp_listen_ip() +SWITCH_DECLARE(const char *) switch_msrp_listen_ip(void) { return globals.ip; } -SWITCH_DECLARE(switch_status_t) switch_msrp_init() +SWITCH_DECLARE(switch_status_t) switch_msrp_init(void) { switch_memory_pool_t *pool; switch_thread_t *thread; @@ -346,7 +346,7 @@ SWITCH_DECLARE(switch_status_t) switch_msrp_init() return SWITCH_STATUS_SUCCESS; } -SWITCH_DECLARE(switch_status_t) switch_msrp_destroy() +SWITCH_DECLARE(switch_status_t) switch_msrp_destroy(void) { switch_status_t st = SWITCH_STATUS_SUCCESS; switch_socket_t *sock; @@ -1622,7 +1622,7 @@ SWITCH_DECLARE (switch_status_t) switch_msrp_perform_send(switch_msrp_session_t return status; } -SWITCH_DECLARE(switch_msrp_msg_t *) switch_msrp_msg_create() +SWITCH_DECLARE(switch_msrp_msg_t *) switch_msrp_msg_create(void) { switch_msrp_msg_t *msg = malloc(sizeof(switch_msrp_msg_t)); switch_assert(msg); diff --git a/src/switch_packetizer.c b/src/switch_packetizer.c index 626e85ba8e..c9cdcbf3e7 100644 --- a/src/switch_packetizer.c +++ b/src/switch_packetizer.c @@ -265,7 +265,7 @@ SWITCH_DECLARE(switch_status_t) switch_packetizer_feed(switch_packetizer_t *pack context->nalus[i].eat = p; } else { context->nalus[i].len = p - context->nalus[i].start; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "#%d %x len=%u\n", i, *context->nalus[i].start, context->nalus[i].len); + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "#%d %x len=%u\n", i, *context->nalus[i].start, context->nalus[i].len); while (!(*p++)) ; /* eat the sync bytes, what ever 0 0 1 or 0 0 0 1 */ i++; context->nalus[i].start = p; @@ -307,8 +307,8 @@ SWITCH_DECLARE(switch_status_t) switch_packetizer_read(switch_packetizer_t *pack nri = nalu_hdr & 0x60; if (real_slice_size > slice_size) real_slice_size = slice_size; - if (frame->buflen < slice_size) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "frame buffer too small %u < %u\n", frame->buflen, slice_size); + if (frame->datalen < slice_size) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "frame buffer too small %u < %u\n", frame->datalen, slice_size); return SWITCH_STATUS_FALSE; } diff --git a/src/switch_rtp.c b/src/switch_rtp.c index c68c800f92..09e2987bad 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -262,8 +262,8 @@ typedef struct { struct switch_rtp; -static void switch_rtp_dtls_init(); -static void switch_rtp_dtls_destroy(); +static void switch_rtp_dtls_init(void); +static void switch_rtp_dtls_destroy(void); #define MAX_DTLS_MTU 4096 @@ -1660,7 +1660,7 @@ static void rtcp_generate_sender_info(switch_rtp_t *rtp_session, struct switch_r ); } -static inline uint32_t calc_local_lsr_now() +static inline uint32_t calc_local_lsr_now(void) { switch_time_t now; uint32_t ntp_sec, ntp_usec, lsr_now, sec; @@ -3493,7 +3493,7 @@ static BIO_METHOD dtls_bio_filter_methods = { static BIO_METHOD *dtls_bio_filter_methods = NULL; #endif -static void switch_rtp_dtls_init() { +static void switch_rtp_dtls_init(void) { #if OPENSSL_VERSION_NUMBER >= 0x10100000L dtls_bio_filter_methods = BIO_meth_new(BIO_TYPE_FILTER | BIO_get_new_index(), "DTLS filter"); BIO_meth_set_write(dtls_bio_filter_methods, dtls_bio_filter_write); @@ -3503,7 +3503,7 @@ static void switch_rtp_dtls_init() { #endif } -static void switch_rtp_dtls_destroy() { +static void switch_rtp_dtls_destroy(void) { #if OPENSSL_VERSION_NUMBER >= 0x10100000L if (dtls_bio_filter_methods) { BIO_meth_free(dtls_bio_filter_methods); @@ -3642,8 +3642,10 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d unsigned long ssl_ctx_error = 0; const SSL_METHOD *ssl_method; SSL_CTX *ssl_ctx; +#if OPENSSL_VERSION_NUMBER < 0x30000000 BIO *bio; DH *dh; +#endif switch_status_t status = SWITCH_STATUS_SUCCESS; #ifndef OPENSSL_NO_EC #if OPENSSL_VERSION_NUMBER < 0x10002000L @@ -3722,6 +3724,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d switch_assert(dtls->ssl_ctx); +#if OPENSSL_VERSION_NUMBER < 0x30000000 bio = BIO_new_file(dtls->pem, "r"); dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL); BIO_free(bio); @@ -3729,7 +3732,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d SSL_CTX_set_tmp_dh(dtls->ssl_ctx, dh); DH_free(dh); } - +#else + if(!SSL_CTX_set_dh_auto(dtls->ssl_ctx, 1)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Failed enable auto DH!\n"); + } +#endif SSL_CTX_set_mode(dtls->ssl_ctx, SSL_MODE_AUTO_RETRY); //SSL_CTX_set_verify(dtls->ssl_ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, NULL); @@ -3934,12 +3941,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess case SWITCH_RTP_CRYPTO_RECV: switch_channel_set_variable(channel, "srtp_remote_crypto_key", (const char *)b64_key); break; - case SWITCH_RTP_CRYPTO_SEND_RTCP: - switch_channel_set_variable(channel, "srtcp_local_crypto_key", (const char *)b64_key); - break; - case SWITCH_RTP_CRYPTO_RECV_RTCP: - switch_channel_set_variable(channel, "srtcp_remote_crypto_key", (const char *)b64_key); - break; default: break; } @@ -3952,12 +3953,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess case SWITCH_RTP_CRYPTO_RECV: switch_channel_set_variable(channel, "srtp_remote_video_crypto_key", (const char *)b64_key); break; - case SWITCH_RTP_CRYPTO_SEND_RTCP: - switch_channel_set_variable(channel, "srtcp_local_video_crypto_key", (const char *)b64_key); - break; - case SWITCH_RTP_CRYPTO_RECV_RTCP: - switch_channel_set_variable(channel, "srtcp_remote_video_crypto_key", (const char *)b64_key); - break; default: break; } @@ -3970,12 +3965,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess case SWITCH_RTP_CRYPTO_RECV: switch_channel_set_variable(channel, "srtp_remote_audio_crypto_key", (const char *)b64_key); break; - case SWITCH_RTP_CRYPTO_SEND_RTCP: - switch_channel_set_variable(channel, "srtcp_local_audio_crypto_key", (const char *)b64_key); - break; - case SWITCH_RTP_CRYPTO_RECV_RTCP: - switch_channel_set_variable(channel, "srtcp_remote_audio_crypto_key", (const char *)b64_key); - break; default: break; } @@ -5494,7 +5483,6 @@ static switch_size_t do_flush(switch_rtp_t *rtp_session, int force, switch_size_ { int was_blocking = 0; switch_size_t bytes; - uint32_t flushed = 0; switch_size_t bytes_out = 0; if (!switch_rtp_ready(rtp_session)) { @@ -5576,8 +5564,6 @@ static switch_size_t do_flush(switch_rtp_t *rtp_session, int force, switch_size_ #endif } - flushed++; - rtp_session->stats.inbound.raw_bytes += bytes; rtp_session->stats.inbound.flush_packet_count++; rtp_session->stats.inbound.packet_count++; diff --git a/src/switch_speex.c b/src/switch_speex.c index 122ae79a73..5a97b082f2 100644 --- a/src/switch_speex.c +++ b/src/switch_speex.c @@ -470,7 +470,7 @@ static switch_status_t switch_speex_destroy(switch_codec_t *codec) /** * read default settings from speex.conf */ -static void load_configuration() +static void load_configuration(void) { switch_xml_t xml = NULL, cfg = NULL; diff --git a/src/switch_time.c b/src/switch_time.c index 445e698f9b..a56c5e96f1 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -1173,9 +1173,8 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) } else { if (tfd > -1 && globals.RUNNING == 1) { uint64_t exp; - int r; - r = read(tfd, &exp, sizeof(exp)); - r++; + read(tfd, &exp, sizeof(exp)); + (void)exp; } else { switch_time_t timediff = runtime.reference - ts; diff --git a/src/switch_utils.c b/src/switch_utils.c index d8b830943a..c51953f0cf 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -139,13 +139,10 @@ struct switch_frame_buffer_s { static switch_frame_t *find_free_frame(switch_frame_buffer_t *fb, switch_frame_t *orig) { switch_frame_node_t *np; - int x = 0; switch_mutex_lock(fb->mutex); for (np = fb->head; np; np = np->next) { - x++; - if (!np->inuse && ((orig->packet && np->frame->packet) || (!orig->packet && !np->frame->packet))) { if (np == fb->head) { @@ -1610,6 +1607,30 @@ SWITCH_DECLARE(char *) switch_separate_paren_args(char *str) return args; } +SWITCH_DECLARE(switch_bool_t) switch_is_uint_in_range(const char *str, unsigned int from, unsigned int to) +{ + unsigned int number; + const char *original_str = str; + + if (str == NULL || *str == '\0' || from > to) { + return SWITCH_FALSE; + } + + for (; *str != '\0'; str++) { + if (!isdigit(*str)) { + return SWITCH_FALSE; + } + } + + number = atoi(original_str); + + if (number < from || number > to) { + return SWITCH_FALSE; + } + + return SWITCH_TRUE; +} + SWITCH_DECLARE(switch_bool_t) switch_is_number(const char *str) { const char *p; @@ -2383,7 +2404,7 @@ SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *s return (s1->sin_addr.s_addr == s2->sin_addr.s_addr && s1->sin_port == s2->sin_port); } case AF_INET6: - if (s16->sin6_addr.s6_addr && s26->sin6_addr.s6_addr) { + { int i; if (!ip_only) { @@ -2437,7 +2458,7 @@ SWITCH_DECLARE(int) switch_cp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa return 1; case AF_INET6: - if (s16->sin6_addr.s6_addr && s26->sin6_addr.s6_addr) { + { int i; s16->sin6_port = s26->sin6_port; diff --git a/src/switch_vpx.c b/src/switch_vpx.c index e35d87712f..751f2b8c5b 100644 --- a/src/switch_vpx.c +++ b/src/switch_vpx.c @@ -1853,7 +1853,7 @@ static void parse_codecs(my_vpx_cfg_t *my_cfg, switch_xml_t codecs) } } -static void load_config() +static void load_config(void) { switch_xml_t cfg = NULL, xml = NULL; my_vpx_cfg_t *my_cfg = NULL; diff --git a/src/switch_xml.c b/src/switch_xml.c index 80b7553907..8ed7c27658 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -550,15 +550,22 @@ SWITCH_DECLARE(const char **) switch_xml_pi(switch_xml_t xml, const char *target switch_xml_root_t root = (switch_xml_root_t) xml; int i = 0; - if (!root) + if (!root) { return (const char **) SWITCH_XML_NIL; - while (root->xml.parent) + } + + while (root && root->xml.parent) { root = (switch_xml_root_t) root->xml.parent; /* root tag */ + } + if (!root || !root->pi) { return (const char **) SWITCH_XML_NIL; } - while (root->pi[i] && strcmp(target, root->pi[i][0])) + + while (root->pi[i] && strcmp(target, root->pi[i][0])) { i++; /* find target */ + } + return (const char **) ((root->pi[i]) ? root->pi[i] + 1 : SWITCH_XML_NIL); } @@ -1146,7 +1153,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str(char *s, switch_size_t len) return switch_xml_err(root, d, "unclosed