diff --git a/.gitignore b/.gitignore index cb5a36dea..dd920d531 100644 --- a/.gitignore +++ b/.gitignore @@ -84,3 +84,4 @@ po/linphone.pot tester/linphone_log.gz.txt tools/auto_answer tools/lp-autoanswer +build/macos/pkg-distribution.xml diff --git a/README.macos.md b/README.macos.md index 6f54e1444..89e3b3525 100644 --- a/README.macos.md +++ b/README.macos.md @@ -44,14 +44,14 @@ Install `GTK`. It is recommended to use the `quartz` backend for better integrat antlr3.2 gettext speex ffmpeg readline libvpx opus ln -s /usr/local/bin/glibtoolize /usr/local/bin/libtoolize brew link --force gettext + #readline is required from linphonec.c otherwise compilation will fail + brew link readline --force ##### Linphone UI (GTK version) - brew install cairo --without-x11 + brew install cairo --without-x11 brew install gtk+ --without-x11 - brew install gettext gtk-mac-integration libsoup hicolor-icon-theme - #readline is required from linphonec.c otherwise compilation will fail - brew link readline --force + brew install gtk-mac-integration libsoup hicolor-icon-theme ### Building Linphone diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 4f2a571a9..94655e19c 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -37,7 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "mediastreamer2/mseventqueue.h" #include "mediastreamer2/mssndcard.h" -static const char EC_STATE_STORE[] = ".linphone.ecstate"; +static const char *EC_STATE_STORE = ".linphone.ecstate"; #define EC_STATE_MAX_LEN 1048576 // 1Mo static void linphone_call_stats_uninit(LinphoneCallStats *stats); @@ -1980,7 +1980,8 @@ void linphone_call_init_audio_stream(LinphoneCall *call){ audio_stream_set_echo_canceller_params(audiostream,len,delay,framesize); if (audiostream->ec) { char *statestr=ms_malloc0(EC_STATE_MAX_LEN); - if (lp_config_read_relative_file(lc->config, EC_STATE_STORE, statestr, EC_STATE_MAX_LEN) == 0) { + if (lp_config_relative_file_exists(lc->config, EC_STATE_STORE) + && lp_config_read_relative_file(lc->config, EC_STATE_STORE, statestr, EC_STATE_MAX_LEN) == 0) { ms_filter_call_method(audiostream->ec, MS_ECHO_CANCELLER_SET_STATE_STRING, statestr); } ms_free(statestr); diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c index f6755863b..d1be24dc7 100644 --- a/coreapi/lpconfig.c +++ b/coreapi/lpconfig.c @@ -100,7 +100,7 @@ LpItem * lp_comment_new(const char *comment){ pos=strchr(item->value,'\r'); if (pos==NULL) pos=strchr(item->value,'\n'); - + if(pos) { *pos='\0'; /*replace the '\n' */ } @@ -362,7 +362,7 @@ LpConfig *lp_config_new_with_factory(const char *config_filename, const char *fa ms_message("Using (r/w) config information from %s", config_filename); lpconfig->filename=ortp_strdup(config_filename); lpconfig->tmpfilename=ortp_strdup_printf("%s.tmp",config_filename); - + #if !defined(WIN32) { struct stat fileStat; @@ -719,6 +719,22 @@ static char *_lp_config_dirname(char *path) { #endif } +bool_t lp_config_relative_file_exists(const LpConfig *lpconfig, const char *filename) { + if (lpconfig->filename == NULL) { + return FALSE; + } else { + char *dir = _lp_config_dirname(lpconfig->filename); + char *filepath = ms_strdup_printf("%s/%s", dir, filename); + FILE *file = fopen(filepath, "r"); + ms_free(dir); + ms_free(filepath); + if (file) { + fclose(file); + } + return file != NULL; + } +} + void lp_config_write_relative_file(const LpConfig *lpconfig, const char *filename, const char *data) { if (lpconfig->filename == NULL) return; if(strlen(data) > 0) { @@ -760,7 +776,7 @@ int lp_config_read_relative_file(const LpConfig *lpconfig, const char *filename, ms_free(dir); ms_free(filepath); return 0; - + err: ms_free(dir); ms_free(filepath); diff --git a/coreapi/lpconfig.h b/coreapi/lpconfig.h index 65fd613f4..b03bfa57f 100644 --- a/coreapi/lpconfig.h +++ b/coreapi/lpconfig.h @@ -290,6 +290,11 @@ LINPHONE_PUBLIC void lp_config_write_relative_file(const LpConfig *lpconfig, con */ LINPHONE_PUBLIC int lp_config_read_relative_file(const LpConfig *lpconfig, const char *filename, char *data, size_t max_length); +/** + * @return TRUE if file exists relative to the to the current location +**/ +LINPHONE_PUBLIC bool_t lp_config_relative_file_exists(const LpConfig *lpconfig, const char *filename); + #ifdef __cplusplus } #endif diff --git a/mediastreamer2 b/mediastreamer2 index df8fdb8f4..ceb0f52e8 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit df8fdb8f4d4284b294fe5c0890ba89e2943050f5 +Subproject commit ceb0f52e88084ceafbb43087c6742a04f4543f88 diff --git a/tester/call_tester.c b/tester/call_tester.c index 8c8640ec3..58b396704 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -2363,9 +2363,9 @@ static void call_with_file_player(void) { { double similar; const int threshold = 90; - BC_ASSERT_EQUAL_INT(ms_audio_diff(hellopath,recordpath,&similar,audio_cmp_min_overlap,NULL,NULL), 0); - BC_ASSERT_GREATER_INT(100*similar, threshold); - BC_ASSERT_LOWER_INT(100*similar, 100); + BC_ASSERT_EQUAL_WITH_TYPE(ms_audio_diff(hellopath,recordpath,&similar,audio_cmp_min_overlap,NULL,NULL), 0, int, "%d"); + BC_ASSERT_GREATER_WITH_TYPE(100*similar, threshold, int, "%d"); + BC_ASSERT_LOWER_WITH_TYPE(100*similar, 100, int, "%d"); if (threshold < 100*similar && 100*similar < 100) { remove(recordpath); } diff --git a/tester/common/bc_tester_utils.h b/tester/common/bc_tester_utils.h index 68f573bed..6bd17b03c 100644 --- a/tester/common/bc_tester_utils.h +++ b/tester/common/bc_tester_utils.h @@ -124,37 +124,24 @@ char * bc_tester_res(const char *name); #define BC_ASSERT_LOWER(actual, expected) CU_assertImplementation(((actual) <= (expected)), __LINE__, ("CU_ASSERT_LOWER(" #actual "," #expected ")"), __FILE__, "", CU_FALSE) /*Add some custom defines with logs in case of fail*/ -#define BC_ASSERT_EQUAL_INT(actual, expected) { \ - int cactual = (actual), cexpected = (expected); \ +#define BC_ASSERT_EQUAL_WITH_TYPE(actual, expected, type, type_format) { \ + type cactual = (actual), cexpected = (expected); \ if (! BC_ASSERT_EQUAL(cactual, cexpected)) { \ - bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " = " #expected " but was %d != %d\n", __FILE__, __LINE__, cactual, cexpected); \ + bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " = " #expected " but was " type_format " != " type_format "\n", __FILE__, __LINE__, cactual, cexpected); \ } \ } -#define BC_ASSERT_GREATER_INT(actual, expected) { \ - int cactual = (actual), cexpected = (expected); \ +#define BC_ASSERT_GREATER_WITH_TYPE(actual, expected, type, type_format) { \ + type cactual = (actual), cexpected = (expected); \ if (! BC_ASSERT_GREATER(cactual, cexpected)) { \ - bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " >= " #expected " but was %d < %d\n", __FILE__, __LINE__, cactual, cexpected); \ + bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " >= " #expected " but was " type_format " < " type_format "\n", __FILE__, __LINE__, cactual, cexpected); \ } \ } -#define BC_ASSERT_LOWER_INT(actual, expected) { \ - int cactual = (actual), cexpected = (expected); \ +#define BC_ASSERT_LOWER_WITH_TYPE(actual, expected, type, type_format) { \ + type cactual = (actual), cexpected = (expected); \ if (! BC_ASSERT_LOWER(cactual, cexpected)) { \ - bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " <= " #expected " but was %d > %d\n", __FILE__, __LINE__, cactual, cexpected); \ + bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " <= " #expected " but was " type_format " > " type_format "\n", __FILE__, __LINE__, cactual, cexpected); \ } \ } -#define BC_ASSERT_GREATER_UINT64_T(actual, expected) { \ - uint64_t cactual = (actual), cexpected = (expected); \ - if (! BC_ASSERT_GREATER(cactual, cexpected)) { \ - bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " >= " #expected " but was %lu < %lu\n", __FILE__, __LINE__, (long unsigned)cactual, (long unsigned)cexpected); \ - } \ -} -#define BC_ASSERT_LOWER_UINT64_T(actual, expected) { \ - uint64_t cactual = (actual), cexpected = (expected); \ - if (! BC_ASSERT_LOWER(cactual, cexpected)) { \ - bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " <= " #expected " but was %lu > %lu\n", __FILE__, __LINE__, (long unsigned)cactual, (long unsigned)cexpected); \ - } \ -} - #ifdef __cplusplus }