summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-11-24 00:27:14 +0100
committerPeter Wu <peter@lekensteyn.nl>2016-12-06 17:51:47 +0000
commitf5e22a14877922aa7b907d2e434958c86efd6875 (patch)
tree33439d1a8cd3322faa9ce8b0f6b12a08427d47fb /cmake
parentd8cdb550445a1bc86626bd9d45da1ce958d1592b (diff)
downloadwireshark-f5e22a14877922aa7b907d2e434958c86efd6875.tar.gz
codecs: Add support for G.722 and G.726
Integrate the Spandsp library for G.722 and G.726 support. Adds support for G.722 and all eight variants of G.726. Note: this also fixes a crash in Qt (buffer overrun, reading too much data) caused by confusion of the larger output buffer (resample_buff) with the smaller input buffer (decode_buff). It was not triggered before because the sample rate was always 8k, but with the addition of the new codecs, a different sample rate became possible (16k). Fix also a crash which occurs when the RTP_STREAM_DEBUG macro is enabled and the VOIP Calls dialog is opened (the begin frame, start_fd, is not yet known and therfore a NULL dereference could occur). Passes testing (plays normally without bad RTP timing errors) with SampleCaptures files: sip-rtp-g722.pcap and sip-rtp-g726.pcap. Tested with cmake (Qt), autotools (Qt and GTK+) with ASAN enabled. Bug: 5619 Change-Id: I5661908d193927bba50901079119eeff0c04991f Reviewed-on: https://code.wireshark.org/review/18939 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/FindSPANDSP.cmake55
1 files changed, 55 insertions, 0 deletions
diff --git a/cmake/modules/FindSPANDSP.cmake b/cmake/modules/FindSPANDSP.cmake
new file mode 100644
index 0000000000..6c64d8fdba
--- /dev/null
+++ b/cmake/modules/FindSPANDSP.cmake
@@ -0,0 +1,55 @@
+# Find the system's Spandsp includes and library
+#
+# SPANDSP_INCLUDE_DIRS - where to find spandsp.h
+# SPANDSP_LIBRARIES - List of libraries when using spandsp
+# SPANDSP_FOUND - True if spandsp found
+# SPANDSP_DLL_DIR - (Windows) Path to the Spandsp DLL
+# SPANDSP_DLL - (Windows) Name of the Spandsp DLL
+
+include( FindWSWinLibs )
+FindWSWinLibs( "spandsp-.*" "SPANDSP_HINTS" )
+
+find_package(PkgConfig)
+pkg_search_module(SPANDSP spandsp)
+
+find_path( SPANDSP_INCLUDE_DIR
+ NAMES spandsp.h
+ HINTS
+ "${SPANDSP_INCLUDEDIR}"
+ "${SPANDSP_HINTS}/include"
+ PATHS /usr/local/include /usr/include
+)
+
+find_library( SPANDSP_LIBRARY
+ NAMES spandsp
+ HINTS
+ "${SPANDSP_LIBDIR}"
+ "${SPANDSP_HINTS}/lib"
+ PATHS /usr/local/lib /usr/lib
+)
+
+include( FindPackageHandleStandardArgs )
+find_package_handle_standard_args( Spandsp DEFAULT_MSG SPANDSP_INCLUDE_DIR SPANDSP_LIBRARY )
+
+if( SPANDSP_FOUND )
+ set( SPANDSP_INCLUDE_DIRS ${SPANDSP_INCLUDE_DIR} )
+ set( SPANDSP_LIBRARIES ${SPANDSP_LIBRARY} )
+ if (WIN32)
+ set ( SPANDSP_DLL_DIR "${SPANDSP_HINTS}/bin"
+ CACHE PATH "Path to spandsp DLL"
+ )
+ file( GLOB _spandsp_dll RELATIVE "${SPANDSP_DLL_DIR}"
+ "${SPANDSP_DLL_DIR}/libspandsp-*.dll"
+ )
+ set ( SPANDSP_DLL ${_spandsp_dll}
+ # We're storing filenames only. Should we use STRING instead?
+ CACHE FILEPATH "spandsp DLL file name"
+ )
+ mark_as_advanced( SPANDSP_DLL_DIR SPANDSP_DLL )
+ endif()
+else()
+ set( SPANDSP_INCLUDE_DIRS )
+ set( SPANDSP_LIBRARIES )
+endif()
+
+mark_as_advanced( SPANDSP_LIBRARIES SPANDSP_INCLUDE_DIRS )