From 59cdb8850b57b13919b9fe2bab3d6920ca7205f9 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 1 Sep 2014 18:26:45 +0200 Subject: [PATCH] various fix for lib linphone tester on Android --- build/android/liblinphone_gitversion.h | 1 - coreapi/linphonecore.c | 39 +++----------------------- tester/call_tester.c | 5 ++++ tester/message_tester.c | 3 +- 4 files changed, 10 insertions(+), 38 deletions(-) delete mode 100644 build/android/liblinphone_gitversion.h diff --git a/build/android/liblinphone_gitversion.h b/build/android/liblinphone_gitversion.h deleted file mode 100644 index 50e8a106e..000000000 --- a/build/android/liblinphone_gitversion.h +++ /dev/null @@ -1 +0,0 @@ -#define LIBLINPHONE_GIT_VERSION "unknown" diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 741791109..03d148402 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -40,7 +40,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef HAVE_CONFIG_H #include "config.h" -#include "liblinphone_gitversion.h" +#ifndef ANDROID /*on Android LIBLINPHONE version is passed from root Makefile*/ + #include "liblinphone_gitversion.h" +#endif #else #ifndef LIBLINPHONE_GIT_VERSION #define LIBLINPHONE_GIT_VERSION "unknown" @@ -1598,28 +1600,8 @@ int linphone_core_get_sip_port(LinphoneCore *lc) return tr.udp_port>0 ? tr.udp_port : (tr.tcp_port > 0 ? tr.tcp_port : tr.tls_port); } -#if !USE_BELLE_SIP static char _ua_name[64]="Linphone"; -static char _ua_version[64]=LINPHONE_VERSION; -#endif - -#if HAVE_EXOSIP_GET_VERSION && !USE_BELLESIP -extern const char *eXosip_get_version(); -#endif - -static void apply_user_agent(LinphoneCore *lc){ -#if !USE_BELLESIP /*default user agent is handled at sal level*/ - char ua_string[256]; - snprintf(ua_string,sizeof(ua_string)-1,"%s/%s (eXosip2/%s)",_ua_name,_ua_version, -#if HAVE_EXOSIP_GET_VERSION - eXosip_get_version() -#else - "unknown" -#endif - ); - if (lc->sal) sal_set_user_agent(lc->sal,ua_string); -#endif -} +static char _ua_version[64]=LIBLINPHONE_VERSION; /** * Sets the user agent string used in SIP messages. @@ -1627,27 +1609,15 @@ static void apply_user_agent(LinphoneCore *lc){ * @ingroup misc **/ void linphone_core_set_user_agent(LinphoneCore *lc, const char *name, const char *ver){ -#if USE_BELLESIP char ua_string[256]; snprintf(ua_string, sizeof(ua_string) - 1, "%s/%s", name?name:"", ver?ver:""); if (lc->sal) { sal_set_user_agent(lc->sal, ua_string); sal_append_stack_string_to_user_agent(lc->sal); } -#else - strncpy(_ua_name,name,sizeof(_ua_name)-1); - strncpy(_ua_version,ver,sizeof(_ua_version)); - apply_user_agent(lc); -#endif } const char *linphone_core_get_user_agent(LinphoneCore *lc){ -#if USE_BELLESIP return sal_get_user_agent(lc->sal); -#else - static char ua_buffer[255] = {0}; - snprintf(ua_buffer, "%s/%s", _ua_name, _ua_version, 254); - return ua_buffer; -#endif } const char *linphone_core_get_user_agent_name(void){ @@ -1705,7 +1675,6 @@ static int apply_transports(LinphoneCore *lc){ } } } - apply_user_agent(lc); return 0; } diff --git a/tester/call_tester.c b/tester/call_tester.c index 04243d0c4..276a2456e 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -454,10 +454,15 @@ static void call_with_specified_codec_bitrate(void) { #ifdef __arm__ if (ms_get_cpu_count() <2) { /*2 opus codec channel + resampler is too much for a single core*/ +#ifndef ANDROID codec = "speex"; rate = 8000; min_bw=20; max_bw=35; +#else + CU_PASS("Test requires at least a dual core"); + goto end; +#endif } #endif diff --git a/tester/message_tester.c b/tester/message_tester.c index 2969a3b18..13081bd18 100644 --- a/tester/message_tester.c +++ b/tester/message_tester.c @@ -66,10 +66,9 @@ void file_transfer_received(LinphoneCore *lc, LinphoneChatMessage *message, cons FILE* file=NULL; char receive_file[256]; snprintf(receive_file,sizeof(receive_file), "%s/receive_file.dump", liblinphone_tester_writable_dir_prefix); - if (!linphone_chat_message_get_user_data(message)) { /*first chunk, creating file*/ - file = fopen("receive_file.dump","wb"); + file = fopen(receive_file,"wb"); linphone_chat_message_set_user_data(message,(void*)file); /*store fd for next chunks*/ } else { /*next chunk*/