diff --git a/CMakeLists.txt b/CMakeLists.txt index ae3952338..94f49e8f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,18 +1,92 @@ -cmake_minimum_required(VERSION 2.6) -project(LINPHONE C) +############################################################################ +# CMakeLists.txt +# Copyright (C) 2014 Belledonne Communications, Grenoble France +# +############################################################################ +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################ + +cmake_minimum_required(VERSION 2.6) +project(LINPHONE C CXX) + + +set(LINPHONE_MAJOR_VERSION "3") +set(LINPHONE_MINOR_VERSION "7") +set(LINPHONE_MICRO_VERSION "0") +set(LINPHONE_VERSION "${LINPHONE_MAJOR_VERSION}.${LINPHONE_MINOR_VERSION}.${LINPHONE_MICRO_VERSION}") +set(LINPHONE_SO_VERSION "6") + + +include(CMakeDependentOption) + +option(ENABLE_STATIC "Build static library (default is shared library)." NO) +option(ENABLE_CONSOLE_UI "Turn on or off compilation of console interface." YES) +option(ENABLE_DATE "Use build date in internal version number." NO) +option(ENABLE_GTK_UI "Turn on or off compilation of gtk interface." YES) +option(ENABLE_LDAP "Enable LDAP support." NO) +option(ENABLE_MSG_STORAGE "Turn on compilation of message storage." YES) +option(ENABLE_NOTIFY "Enable libnotify support." YES) +option(ENABLE_RELATIVE_PREFIX "Find resources relatively to the installation directory." NO) +option(ENABLE_TOOLS "Turn on or off compilation of console interface" YES) +option(ENABLE_TUNNEL "Turn on compilation of tunnel support." NO) +option(ENABLE_TUTORIALS "Enable compilation of tutorials." YES) +option(ENABLE_UNIT_TESTS "Enable compilation of unit tests." YES) +option(ENABLE_UPNP "Build with uPnP support." YES) +option(ENABLE_VIDEO "Build with video support." YES) +cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENABLE_GTK_UI" NO) + + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_PREFIX_PATH}/share/cmake/Modules) + +include(CheckIncludeFile) + +if(MSVC) + list(APPEND CMAKE_REQUIRED_INCLUDES ${CMAKE_PREFIX_PATH}/include/MSVC) +endif() + +find_package(BelleSIP REQUIRED) +find_package(MS2 REQUIRED) +find_package(XML2 REQUIRED) -option(LINPHONE_ENABLE_VIDEO "Build linphone with video support." ON) include_directories( include/ coreapi/ + ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/coreapi/ + ${BELLESIP_INCLUDE_DIRS} + ${MS2_INCLUDE_DIRS} + ${XML2_INCLUDE_DIRS} ) -include_directories( - ${CMAKE_INSTALL_PREFIX}/include - ${CMAKE_INSTALL_PREFIX}/include/libxml2 -) +if(MSVC) + include_directories(${CMAKE_PREFIX_PATH}/include/MSVC) +endif() + + +if(ENABLE_RELATIVE_PREFIX) + set(LINPHONE_PLUGINS_DIR "./lib/liblinphone/plugins") +else() + set(LINPHONE_PLUGINS_DIR "${CMAKE_INSTALL_PREFIX}/lib/liblinphone/plugins") +endif() +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) +set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/config.h PROPERTIES GENERATED ON) +add_definitions(-DHAVE_CONFIG_H) + add_subdirectory(coreapi) add_subdirectory(share) diff --git a/README.mingw b/README.mingw index 79e8ce547..8b97ea1ef 100644 --- a/README.mingw +++ b/README.mingw @@ -4,20 +4,20 @@ Software to install Download lastest mingw-get-setup.exe from http://www.mingw.org Run mingw-get-setup.exe. In the package list, select and install: -* mingw32-developer-tool +* mingw-developer-toolkit * mingw32-base * mingw32-gcc-g++ +* mingw32-pthreads-w32 * msys-base +* msys-zip +* msys-unzip +* msys-wget For more information: http://www.mingw.org/wiki/Getting_Started In mingw shell (also refered as msys), run -mingw-get install msys-zip -mingw-get install msys-unzip -mingw-get install msys-wget - mkdir -p /opt/perl/bin cp /bin/perl /opt/perl/bin/. @@ -48,7 +48,7 @@ libintl.a libintl.la libintl.dll.a * Download and install Inno Setup Compiler (required only if you run 'make setup.exe'). Add it to your windows Path environment variable. -* Install msys-git from (http://code.google.com/p/msysgit/). During installation you are asked to make a choice about how line endings are treated by git. Choose "Checkout line endings as they are, commit as they are". THIS CHOICE IS VERY IMPORTANT. OTHERS BREAK AUTOMAKE. +* Install msys-git from (http://msysgit.github.io/). During installation you are asked to make a choice about how line endings are treated by git. Choose "Checkout line endings as they are, commit as they are". THIS CHOICE IS VERY IMPORTANT. OTHERS BREAK AUTOMAKE. General rules for compilation @@ -98,7 +98,8 @@ Building plugins (optional) *************************** This the example for msx264 (H264 plugin), the same applies for other linphone plugins. - $ cd mediastreamer2/plugins/msx264 + $ git clone git://git.linphone.org/msx264.git + $ cd msx264 $ ./autogen.sh $ PKG_CONFIG_PATH=/usr/lib/pkgconfig ./configure --prefix=/usr --enable-shared --disable-static #make a binary zip of this plugin diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 000000000..6f8db1a86 --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,28 @@ +/*************************************************************************** +* config.h.cmake +* Copyright (C) 2014 Belledonne Communications, Grenoble France +* +**************************************************************************** +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* +****************************************************************************/ + +#define LINPHONE_MAJOR_VERSION ${LINPHONE_MAJOR_VERSION} +#define LINPHONE_MINOR_VERSION ${LINPHONE_MINOR_VERSION} +#define LINPHONE_MICRO_VERSION ${LINPHONE_MICRO_VERSION} +#define LINPHONE_VERSION "${LINPHONE_VERSION}" + +#cmakedefine LINPHONE_PLUGINS_DIR "${LINPHONE_PLUGINS_DIR}" diff --git a/configure.ac b/configure.ac index 092b41129..8d4c80155 100644 --- a/configure.ac +++ b/configure.ac @@ -537,7 +537,7 @@ fi dnl conditionnal build of video support AC_ARG_ENABLE(video, - [AS_HELP_STRING([--enable-video], [Turn on video support compiling])], + [AS_HELP_STRING([--enable-video], [Turn on video support compiling (default=yes)])], [case "${enableval}" in yes) video=true ;; no) video=false ;; diff --git a/console/commands.c b/console/commands.c index 009d8724b..f0b44bdd5 100644 --- a/console/commands.c +++ b/console/commands.c @@ -515,7 +515,7 @@ lpc_cmd_help(LinphoneCore *lc, char *arg) i=0; while (advanced_commands[i].help) { - linphonec_out("%10.10s\t%s\n", advanced_commands[i].name, + linphonec_out("%20.20s\t%s\n", advanced_commands[i].name, advanced_commands[i].help); i++; } diff --git a/coreapi/CMakeLists.txt b/coreapi/CMakeLists.txt index 1fb5f2add..ff39dfb41 100644 --- a/coreapi/CMakeLists.txt +++ b/coreapi/CMakeLists.txt @@ -1,47 +1,30 @@ +############################################################################ +# CMakeLists.txt +# Copyright (C) 2014 Belledonne Communications, Grenoble France +# +############################################################################ +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################ + if(MSVC) find_library(LIBGCC NAMES gcc) find_library(LIBMINGWEX NAMES mingwex) endif() -find_library(LIBORTP NAMES ortp) -find_library(LIBMEDIASTREAMER_BASE NAMES mediastreamer_base) -find_library(LIBMEDIASTREAMER_VOIP NAMES mediastreamer_voip) -find_library(LIBBELLESIP NAMES bellesip) -find_library(LIBXML2 NAMES xml2) -find_program(GIT git) - -set(GIT_VERSION "unknown") -if(GIT) - execute_process( - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND ${GIT} describe --always - OUTPUT_VARIABLE GIT_DESCRIBE - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - execute_process( - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND ${GIT} describe --abbrev=0 - OUTPUT_VARIABLE GIT_TAG - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - execute_process( - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND ${GIT} rev-parse HEAD - OUTPUT_VARIABLE GIT_REVISION - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if(GIT_DESCRIBE) - set(GIT_VERSION ${GIT_DESCRIBE}) - else(GIT_DESCRIBE) - if(GIT_REVISION) - set(GIT_VERSION ${GIT_REVISION}) - endif(GIT_REVISION) - endif(GIT_DESCRIBE) -endif(GIT) -execute_process( - COMMAND ${CMAKE_COMMAND} -E echo "#define LIBLINPHONE_GIT_VERSION \"${GIT_VERSION}\"" - OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/liblinphone_gitversion.h -) set(SOURCE_FILES address.c @@ -68,7 +51,6 @@ set(SOURCE_FILES info.c linphonecall.c linphonecore.c - #linphone_tunnel.cc linphone_tunnel_stubs.c linphone_tunnel_config.c lpconfig.c @@ -83,7 +65,6 @@ set(SOURCE_FILES sal.c siplogin.c sipsetup.c - #TunnelManager.cc xml.c xml2lpc.c bellesip_sal/sal_impl.h @@ -99,42 +80,63 @@ set(SOURCE_FILES sipsetup.h xml2lpc.h ) +if(ENABLE_TUNNEL) + list(APPEND SOURCE_FILES + linphone_tunnel.cc + TunnelManager.cc + ) + add_definitions(-DTUNNEL_ENABLED) +endif() + +set(GENERATED_SOURCE_FILES + ${CMAKE_CURRENT_BINARY_DIR}/liblinphone_gitversion.h +) +set_source_files_properties(${GENERATED_SOURCE_FILES} PROPERTIES GENERATED TRUE) +find_package(Git) +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/liblinphone_gitversion.h + COMMAND ${CMAKE_COMMAND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -DOUTPUT_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/gitversion.cmake) add_definitions( - -D_TRUE_TIME -DIN_LINPHONE -DUSE_BELLESIP - #-DTUNNEL_ENABLED - -DLINPHONE_PACKAGE_NAME="linphone" - -DLINPHONE_VERSION="Devel" -DLIBLINPHONE_EXPORTS - -DLINPHONE_PLUGINS_DIR="" ) -if(LINPHONE_ENABLE_VIDEO) +if(ENABLE_VIDEO) add_definitions(-DVIDEO_ENABLED) -endif(LINPHONE_ENABLE_VIDEO) +endif() -if(WIN32) -add_definitions( - -DWINDOW_NATIVE - /FIliblinphone_gitversion.h +set(LIBS + ${LIBGCC} + ${LIBMINGWEX} + ${BELLESIP_LIBRARIES} + ${MS2_LIBRARIES} + ${XML2_LIBRARIES} ) -set(LIBS ws2_32) -endif(WIN32) -set(LIBS ${LIBS} ${LIBGCC} ${LIBMINGWEX} ${LIBORTP} ${LIBMEDIASTREAMER_BASE} ${LIBMEDIASTREAMER_VOIP} ${LIBBELLESIP} ${LIBXML2}) - -add_library(linphone SHARED ${SOURCE_FILES}) -set_target_properties(linphone PROPERTIES VERSION 3.7.0 SOVERSION 5) - -target_link_libraries(linphone ${LIBS}) +if(ENABLE_STATIC) + add_library(linphone STATIC ${SOURCE_FILES} ${GENERATED_SOURCE_FILES}) + target_link_libraries(linphone ${LIBS}) +else() + add_library(linphone SHARED ${SOURCE_FILES} ${GENERATED_SOURCE_FILES}) + set_target_properties(linphone PROPERTIES VERSION ${LINPHONE_VERSION} SOVERSION ${LINPHONE_SO_VERSION} LINKER_LANGUAGE CXX) + target_link_libraries(linphone ${LIBS}) + if(MSVC) + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/linphone.pdb + DESTINATION bin + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) + endif() + endif() +endif() install(TARGETS linphone - RUNTIME DESTINATION bin + RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE +) file(GLOB HEADER_FILES "*.h") @@ -143,11 +145,3 @@ install(FILES ${HEADER_FILES} DESTINATION include/linphone PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) -if(WIN32) -if(CMAKE_BUILD_TYPE STREQUAL "Debug") -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/linphone.pdb - DESTINATION bin - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE -) -endif() -endif(WIN32) diff --git a/coreapi/chat.c b/coreapi/chat.c index 165d71ac3..c9ec8b6d5 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -184,11 +184,12 @@ static void linphone_chat_message_process_response_from_post_file(void *data, co belle_http_provider_send_request(msg->chat_room->lc->http_provider,req,l); } if (code == 200 ) { /* file has been uploaded correctly, get server reply and send it */ + const char *body; /* TODO Check that the transfer has not been cancelled, note this shall be removed once the belle sip API will provide a cancel request as we shall never reach this part if the transfer is actually cancelled */ if (msg->http_request == NULL) { return; } - const char *body = belle_sip_message_get_body((belle_sip_message_t *)event->response); + body = belle_sip_message_get_body((belle_sip_message_t *)event->response); msg->message = ms_strdup(body); linphone_content_uninit(msg->file_transfer_information); ms_free(msg->file_transfer_information); diff --git a/coreapi/gitversion.cmake b/coreapi/gitversion.cmake new file mode 100644 index 000000000..1a6ec406c --- /dev/null +++ b/coreapi/gitversion.cmake @@ -0,0 +1,38 @@ +############################################################################ +# CMakeLists.txt +# Copyright (C) 2014 Belledonne Communications, Grenoble France +# +############################################################################ +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################ + +if(GIT_EXECUTABLE) + execute_process( + COMMAND ${GIT_EXECUTABLE} describe --always + OUTPUT_VARIABLE GIT_REVISION + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + execute_process( + COMMAND ${CMAKE_COMMAND} -E echo "#define GIT_VERSION \"${GIT_REVISION}\"" + OUTPUT_FILE ${OUTPUT_DIR}/liblinphone_gitversion.h + ) +else() + execute_process( + COMMAND ${CMAKE_COMMAND} -E echo "#define GIT_VERSION \"unknown\"" + OUTPUT_FILE ${OUTPUT_DIR}/liblinphone_gitversion.h + ) +endif() diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 299bdc27f..a3d618e96 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1331,6 +1331,7 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab linphone_core_set_state(lc,LinphoneGlobalStartup,"Starting up"); ortp_init(); + ortp_set_log_thread_id(ortp_thread_self()); lc->dyn_pt=96; lc->default_profile=rtp_profile_new("default profile"); linphone_core_assign_payload_type(lc,&payload_type_pcmu8000,0,NULL); @@ -2395,6 +2396,8 @@ void linphone_core_iterate(LinphoneCore *lc){ lp_config_sync(lc->config); } } + + ortp_logv_flush(); } /** @@ -6035,6 +6038,7 @@ static void linphone_core_uninit(LinphoneCore *lc) linphone_core_message_storage_close(lc); ms_exit(); linphone_core_set_state(lc,LinphoneGlobalOff,"Off"); + ortp_set_log_thread_id(0); } static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t curtime){ diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 1f01ccadf..fc6b76f1f 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1287,6 +1287,20 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getPayloadTypeBitrate(JN return (jint)linphone_core_get_payload_type_bitrate((LinphoneCore*)lc,(PayloadType*)pt); } +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableAdaptiveRateControl(JNIEnv* env + ,jobject thiz + ,jlong lc + ,jboolean enable) { + linphone_core_enable_adaptive_rate_control((LinphoneCore*)lc, enable); +} + +extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isAdaptiveRateControlEnabled(JNIEnv* env + ,jobject thiz + ,jlong lc + ) { + return (jboolean)linphone_core_adaptive_rate_control_enabled((LinphoneCore*)lc); +} + extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableEchoCancellation(JNIEnv* env ,jobject thiz ,jlong lc diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 332a85be0..a74ebc125 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -707,6 +707,18 @@ public interface LinphoneCore { */ int getPayloadTypeBitrate(PayloadType pt); + /** + * Enable adaptive rate control. + * @param enable + */ + void enableAdaptiveRateControl(boolean enable); + + /** + * Enables or disable adaptive rate control. + * @return true if adaptive rate control is enabled. + */ + boolean isAdaptiveRateControlEnabled(); + /** * Enables or disable echo cancellation. * @param enable diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index eeebbd328..04a679f1a 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -73,6 +73,8 @@ class LinphoneCoreImpl implements LinphoneCore { private native long findPayloadType(long nativePtr, String mime, int clockRate, int channels); private native int enablePayloadType(long nativePtr, long payloadType, boolean enable); private native boolean isPayloadTypeEnabled(long nativePtr, long payloadType); + private native void enableAdaptiveRateControl(long nativePtr,boolean enable); + private native boolean isAdaptiveRateControlEnabled(long nativePtr); private native void enableEchoCancellation(long nativePtr,boolean enable); private native boolean isEchoCancellationEnabled(long nativePtr); private native Object getCurrentCall(long nativePtr) ; @@ -1190,5 +1192,14 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized int getPayloadTypeBitrate(PayloadType pt) { return getPayloadTypeBitrate(nativePtr, ((PayloadTypeImpl)pt).nativePtr); } + @Override + public void enableAdaptiveRateControl(boolean enable) { + enableAdaptiveRateControl(nativePtr,enable); + + } + @Override + public boolean isAdaptiveRateControlEnabled() { + return isAdaptiveRateControlEnabled(nativePtr); + } } diff --git a/mediastreamer2 b/mediastreamer2 index 47df383ea..70a029a00 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 47df383ea1631ef1171e10ecf4d6d8333979c3fd +Subproject commit 70a029a00f2b7272d8c790557e71ff8b73004b85 diff --git a/oRTP b/oRTP index 1fc29ba46..fc8d8457e 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 1fc29ba469c5bb1dbfc19c64e8dac382913d2fa7 +Subproject commit fc8d8457eb630907eff50333ddf5243b448fe733 diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index 8d15a6f5c..03b36a74d 100644 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -1,17 +1,32 @@ +############################################################################ +# CMakeLists.txt +# Copyright (C) 2014 Belledonne Communications, Grenoble France +# +############################################################################ +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################ + install(FILES archived-rootca.pem RENAME rootca.pem - COMPONENT COMP_liblinphone DESTINATION share/linphone PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) install(FILES ringback.wav - COMPONENT COMP_liblinphone DESTINATION share/sounds/linphone PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) add_subdirectory(rings) - -install(FILES ../mediastreamer2/src/voip/nowebcamCIF.jpg - COMPONENT COMP_liblinphone - DESTINATION share/images - PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) diff --git a/share/rings/CMakeLists.txt b/share/rings/CMakeLists.txt index cf359bb4e..63f2c47ac 100644 --- a/share/rings/CMakeLists.txt +++ b/share/rings/CMakeLists.txt @@ -1,3 +1,25 @@ +############################################################################ +# CMakeLists.txt +# Copyright (C) 2014 Belledonne Communications, Grenoble France +# +############################################################################ +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################ + install(FILES oldphone.wav toy-mono.wav COMPONENT COMP_liblinphone DESTINATION share/sounds/linphone/rings diff --git a/tester/call_tester.c b/tester/call_tester.c index b507b5855..3269c6fe0 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -18,6 +18,8 @@ #include +#include +#include #include "CUnit/Basic.h" #include "linphonecore.h" #include "lpconfig.h" @@ -25,7 +27,7 @@ #include "liblinphone_tester.h" static void call_base(LinphoneMediaEncryption mode, bool_t enable_video,bool_t enable_relay,LinphoneFirewallPolicy policy); -static void disable_all_codecs_except_one(LinphoneCore *lc, const char *mime); +static void disable_all_audio_codecs_except_one(LinphoneCore *lc, const char *mime); void call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *msg){ char* to=linphone_address_as_string(linphone_call_get_call_log(call)->to); @@ -425,8 +427,8 @@ static void call_with_specified_codec_bitrate(void) { goto end; } - disable_all_codecs_except_one(marie->lc,"opus"); - disable_all_codecs_except_one(pauline->lc,"opus"); + disable_all_audio_codecs_except_one(marie->lc,"opus"); + disable_all_audio_codecs_except_one(pauline->lc,"opus"); linphone_core_set_payload_type_bitrate(marie->lc, linphone_core_find_payload_type(marie->lc,"opus",48000,-1), @@ -535,7 +537,7 @@ static void cancelled_call(void) { linphone_core_manager_destroy(pauline); } -static void disable_all_codecs_except_one(LinphoneCore *lc, const char *mime){ +static void disable_all_audio_codecs_except_one(LinphoneCore *lc, const char *mime){ const MSList *elem=linphone_core_get_audio_codecs(lc); PayloadType *pt; @@ -548,13 +550,27 @@ static void disable_all_codecs_except_one(LinphoneCore *lc, const char *mime){ linphone_core_enable_payload_type(lc,pt,TRUE); } +#ifdef VIDEO_ENABLED +static void disable_all_video_codecs_except_one(LinphoneCore *lc, const char *mime) { + const MSList *codecs = linphone_core_get_video_codecs(lc); + const MSList *it = NULL; + PayloadType *pt = NULL; + + for(it = codecs; it != NULL; it = it->next) { + linphone_core_enable_payload_type(lc, (PayloadType *)it->data, FALSE); + } + CU_ASSERT_PTR_NOT_NULL_FATAL(pt = linphone_core_find_payload_type(lc, mime, -1, -1)); + linphone_core_enable_payload_type(lc, pt, TRUE); +} +#endif + static void call_failed_because_of_codecs(void) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); LinphoneCall* out_call; - disable_all_codecs_except_one(marie->lc,"pcmu"); - disable_all_codecs_except_one(pauline->lc,"pcma"); + disable_all_audio_codecs_except_one(marie->lc,"pcmu"); + disable_all_audio_codecs_except_one(pauline->lc,"pcma"); out_call = linphone_core_invite(pauline->lc,"marie"); linphone_call_ref(out_call); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallOutgoingInit,1)); @@ -1911,8 +1927,8 @@ static void early_media_call_with_update_base(bool_t media_change){ lcs = ms_list_append(lcs,marie->lc); lcs = ms_list_append(lcs,pauline->lc); if (media_change) { - disable_all_codecs_except_one(marie->lc,"pcmu"); - disable_all_codecs_except_one(pauline->lc,"pcmu"); + disable_all_audio_codecs_except_one(marie->lc,"pcmu"); + disable_all_audio_codecs_except_one(pauline->lc,"pcmu"); } /* @@ -1937,8 +1953,8 @@ static void early_media_call_with_update_base(bool_t media_change){ pauline_params = linphone_call_params_copy(linphone_call_get_current_params(pauline_call)); if (media_change) { - disable_all_codecs_except_one(marie->lc,"pcma"); - disable_all_codecs_except_one(pauline->lc,"pcma"); + disable_all_audio_codecs_except_one(marie->lc,"pcma"); + disable_all_audio_codecs_except_one(pauline->lc,"pcma"); } #define UPDATED_SESSION_NAME "nouveau nom de session" @@ -2647,6 +2663,68 @@ static void savpf_to_savpf_call(void) { profile_call(TRUE, TRUE, TRUE, TRUE, "RTP/SAVPF"); } +static void recording_call() { + LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); + LinphoneCoreManager *pauline = linphone_core_manager_new("pauline_rc"); + LinphoneCallParams *marieParams = linphone_core_create_default_call_parameters(marie->lc); + LinphoneCallParams *paulineParams = linphone_core_create_default_call_parameters(pauline->lc); + LinphoneCall *callInst = NULL; + +#ifdef VIDEO_ENABLED + const char filename[] = "recording.mkv"; +#else + const char filename[] = "recording.wav"; +#endif + + const char dirname[] = ".test"; + char *filepath = NULL; + + filepath = ms_new0(char, strlen(dirname) + strlen(filename) + 2); + strcpy(filepath, dirname); + strcat(filepath, "/"); + strcat(filepath, filename); + if(access(dirname, F_OK) != 0) { + CU_ASSERT_EQUAL(mkdir(dirname, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH), 0); + } + CU_ASSERT_EQUAL(access(dirname, W_OK), 0); + if(access(filepath, F_OK) == 0) { + CU_ASSERT_EQUAL(remove(filepath), 0); + } + + linphone_call_params_set_record_file(marieParams, filepath); + +#ifdef VIDEO_ENABLED + if((linphone_core_find_payload_type(marie->lc, "H264", -1, -1) != NULL) && (linphone_core_find_payload_type(pauline->lc, "H264", -1, -1) != NULL)) { + linphone_core_enable_video_display(marie->lc, TRUE); + linphone_core_enable_video_display(pauline->lc, FALSE); + linphone_core_enable_video_capture(marie->lc, TRUE); + linphone_core_enable_video_capture(pauline->lc, TRUE); + + linphone_call_params_enable_video(marieParams, TRUE); + linphone_call_params_enable_video(paulineParams, TRUE); + + disable_all_video_codecs_except_one(marie->lc, "H264"); + disable_all_video_codecs_except_one(pauline->lc, "H264"); + } else { + ms_warning("call_recording(): the H264 payload has not been found. Only sound will be recorded"); + } +#endif + + CU_ASSERT_TRUE(call_with_params(marie, pauline, marieParams, paulineParams)); + CU_ASSERT_PTR_NOT_NULL(callInst = linphone_core_get_current_call(marie->lc)); + + linphone_call_start_recording(callInst); + sleep(20); + linphone_call_stop_recording(callInst); + + CU_ASSERT_EQUAL(access(filepath, F_OK), 0); + end_call(marie, pauline); + + linphone_core_manager_destroy(marie); + linphone_core_manager_destroy(pauline); + ms_free(filepath); +} + test_t call_tests[] = { { "Early declined call", early_declined_call }, { "Call declined", call_declined }, @@ -2735,7 +2813,8 @@ test_t call_tests[] = { { "SAVPF to AVP call", savpf_to_avp_call }, { "SAVPF to AVPF call", savpf_to_avpf_call }, { "SAVPF to SAVP call", savpf_to_savp_call }, - { "SAVPF to SAVPF call", savpf_to_savpf_call } + { "SAVPF to SAVPF call", savpf_to_savpf_call }, + { "Call recording", recording_call } }; test_suite_t call_test_suite = { diff --git a/tester/liblinphone_tester.c b/tester/liblinphone_tester.c index b11cbefaf..5fb91605c 100644 --- a/tester/liblinphone_tester.c +++ b/tester/liblinphone_tester.c @@ -27,9 +27,6 @@ #ifdef ANDROID -extern void AndroidPrintf(FILE *stream, const char *fmt, ...); -#define fprintf(file, fmt, ...) AndroidPrintf(file, fmt, ##__VA_ARGS__) - #include #include #include @@ -118,8 +115,9 @@ static void liblinphone_tester_qnx_log_handler(OrtpLogLevel lev, const char *fmt #endif /* __QNX__ */ + void helper(const char *name) { - fprintf(stderr,"%s --help\n" + liblinphone_tester_fprintf(stderr,"%s --help\n" "\t\t\t--verbose\n" "\t\t\t--silent\n" "\t\t\t--list-suites\n" @@ -197,7 +195,7 @@ int main (int argc, char *argv[]) liblinphone_tester_list_suite_tests(suite_name); return 0; } else { - fprintf(stderr, "Unknown option \"%s\"\n", argv[i]); \ + liblinphone_tester_fprintf(stderr, "Unknown option \"%s\"\n", argv[i]); \ helper(argv[0]); return -1; } diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h index 8fbeafc31..9b2eeeb60 100644 --- a/tester/liblinphone_tester.h +++ b/tester/liblinphone_tester.h @@ -247,6 +247,10 @@ void liblinphone_tester_chat_message_state_change(LinphoneChatMessage* msg,Linph void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreManager* callee); void liblinphone_tester_clock_start(MSTimeSpec *start); bool_t liblinphone_tester_clock_elapsed(const MSTimeSpec *start, int value_ms); +#ifdef ANDROID +void cunit_android_trace_handler(int level, const char *fmt, va_list args) ; +#endif +int liblinphone_tester_fprintf(FILE * stream, const char * format, ...); #endif /* LIBLINPHONE_TESTER_H_ */ diff --git a/tester/tester.c b/tester/tester.c index d0faca038..12dd60a4a 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -294,7 +294,7 @@ int liblinphone_tester_test_suite_index(const char *suite_name) { void liblinphone_tester_list_suites() { int j; for(j=0;j