automatically detect which ORTP library is present and API to use

This commit is contained in:
Michael Iedema
2014-10-23 02:25:07 +02:00
parent 5929269256
commit ef76ef005b
3 changed files with 19 additions and 1 deletions

View File

@@ -751,7 +751,11 @@ void SIPEngine::InitRTP(const osip_message_t * msg )
get_rtp_params(msg, d_port, d_ip_addr);
LOG(DEBUG) << "IP="<<d_ip_addr<<" "<<d_port<<" "<<mRTPPort;
rtp_session_set_local_addr(mSession, "0.0.0.0", mRTPPort );
#ifdef ORTP_NEW_API
rtp_session_set_local_addr(mSession, "0.0.0.0", mRTPPort, -1);
#else
rtp_session_set_local_addr(mSession, "0.0.0.0", mRTPPort);
#endif
rtp_session_set_remote_addr(mSession, d_ip_addr, atoi(d_port));
// Check for event support.

View File

@@ -0,0 +1,8 @@
#include <ortp/ortp.h>
int main(int argc, char **argv)
{
RtpSession * mSession;
mSession = rtp_session_new(RTP_SESSION_SENDRECV);
rtp_session_set_local_addr(mSession, "0.0.0.0", -1, -1);
}

View File

@@ -73,6 +73,12 @@ PKG_CHECK_MODULES(OSIP, libosip2)
# Defines ORTP_CFLAGS, ORTP_INCLUDEDIR, and ORTP_LIBS
PKG_CHECK_MODULES(ORTP, ortp)
AC_MSG_CHECKING([ortp api version])
AS_IF([gcc -I=/usr/local/include -o config/test_ortp_version config/test_ortp_version.cpp -lortp &> /dev/null], [
AC_DEFINE(ORTP_NEW_API, 1, rtp_session_set_local_addr takes four arguments)
AC_MSG_RESULT([>= 0.22.0])
],
[AC_MSG_RESULT([< 0.22.0])])
# Defines LIBUSB_TRANSFER_CANCELLED, LIBUSB_TRANSFER_COMPLETED, LIBUSB_SUCCESS, LIBUSB_ERROR_*
PKG_CHECK_MODULES(LIBUSB, libusb-1.0)