Commit a1920739 authored by Simon Morlat's avatar Simon Morlat
Browse files

Merge branch 'master' of git.linphone.org:linphone

parents 1bdce811 a7bacc85
......@@ -84,3 +84,4 @@ po/linphone.pot
tester/linphone_log.gz.txt
tools/auto_answer
tools/lp-autoanswer
build/macos/pkg-distribution.xml
......@@ -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
......
......@@ -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);
......
......@@ -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);
......
......@@ -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
......
mediastreamer2 @ ceb0f52e
Subproject commit df8fdb8f4d4284b294fe5c0890ba89e2943050f5
Subproject commit ceb0f52e88084ceafbb43087c6742a04f4543f88
......@@ -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);
}
......
......@@ -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
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment