]> sjero.net Git - linphone/commitdiff
implement echo canceller save and restore
authorSimon Morlat <simon.morlat@linphone.org>
Fri, 1 Apr 2011 10:56:35 +0000 (10:56 +0000)
committerSimon Morlat <simon.morlat@linphone.org>
Fri, 1 Apr 2011 10:56:35 +0000 (10:56 +0000)
console/linphonec.c
coreapi/linphonecall.c
coreapi/lpconfig.c
mediastreamer2

index c3eb8ace26d2871c91dfac38fc0ce615e5b7668f..de3ce9e44c740d509d6c8d5b8fb75f8bdcdfff1d 100644 (file)
@@ -107,7 +107,7 @@ static int copy_file(const char *from, const char *to);
 #endif /*_WIN32_WCE*/
 static int linphonec_parse_cmdline(int argc, char **argv);
 static int linphonec_init(int argc, char **argv);
-static int linphonec_main_loop (LinphoneCore * opm, char * sipAddr);
+static int linphonec_main_loop (LinphoneCore * opm);
 static int linphonec_idle_call (void);
 #ifdef HAVE_READLINE
 static int linphonec_initialize_readline(void);
@@ -161,7 +161,7 @@ static int trace_level = 0;
 static char *logfile_name = NULL;
 static char configfile_name[PATH_MAX];
 static const char *factory_configfile_name=NULL;
-static char *sipAddr = NULL; /* for autocall */
+static char *sip_addr_to_call = NULL; /* for autocall */
 static int window_id = 0; /* 0=standalone window, or window id for embedding video */
 #if !defined(_WIN32_WCE)
 static ortp_pipe_t client_sock=ORTP_PIPE_INVALID;
@@ -630,7 +630,7 @@ main (int argc, char *argv[]) {
        
        if (! linphonec_init(argc, argv) ) exit(EXIT_FAILURE);
 
-       linphonec_main_loop (linphonec, sipAddr);
+       linphonec_main_loop (linphonec);
 
        linphonec_finish(EXIT_SUCCESS);
 
@@ -985,6 +985,14 @@ linphonec_idle_call ()
                linphone_core_accept_call(opm,NULL);
                answer_call=FALSE;
        }
+       /* auto call handling */
+       if (sip_addr_to_call != NULL )
+       {
+               char buf[512];
+               snprintf (buf, sizeof(buf),"call %s", sip_addr_to_call);
+               sip_addr_to_call=NULL;
+               linphonec_parse_command_line(linphonec, buf);
+       }
 
        if ( auth_stack.nitems )
        {
@@ -1073,21 +1081,13 @@ static void print_prompt(LinphoneCore *opm){
 }
 
 static int
-linphonec_main_loop (LinphoneCore * opm, char * sipAddr)
+linphonec_main_loop (LinphoneCore * opm)
 {
-       char buf[LINE_MAX_LEN]; /* auto call handling */
        char *input;
 
        print_prompt(opm);
 
 
-       /* auto call handling */
-       if (sipAddr != NULL )
-       {
-               snprintf (buf, sizeof(buf),"call %s", sipAddr);
-               linphonec_parse_command_line(linphonec, buf);
-       }
-
        while (linphonec_running && (input=linphonec_readline(prompt)))
        {
                char *iptr; /* input and input pointer */
@@ -1195,7 +1195,7 @@ linphonec_parse_cmdline(int argc, char **argv)
                {
                        arg_num++;
                        if (arg_num < argc)
-                               sipAddr = argv[arg_num];
+                               sip_addr_to_call = argv[arg_num];
                }
                 else if (strncmp ("-a", argv[arg_num], 2) == 0)
                 {
index c3264d99bbdb7203ca4b864c701857e55fb39a14..3640345fa82517f272ba8d6047981d19ba8a2009 100644 (file)
@@ -649,10 +649,14 @@ void linphone_call_init_media_streams(LinphoneCall *call){
        audio_stream_enable_gain_control(audiostream,TRUE);
        if (linphone_core_echo_cancellation_enabled(lc)){
                int len,delay,framesize;
+               const char *statestr=lp_config_get_string(lc->config,"sound","ec_state",NULL);
                len=lp_config_get_int(lc->config,"sound","ec_tail_len",0);
                delay=lp_config_get_int(lc->config,"sound","ec_delay",0);
                framesize=lp_config_get_int(lc->config,"sound","ec_framesize",0);
                audio_stream_set_echo_canceller_params(audiostream,len,delay,framesize);
+               if (statestr && audiostream->ec){
+                       ms_filter_call_method(audiostream->ec,MS_ECHO_CANCELLER_SET_STATE_STRING,(void*)statestr);
+               }
        }
        audio_stream_enable_automatic_gain_control(audiostream,linphone_core_agc_enabled(lc));
        {
@@ -1009,6 +1013,14 @@ static void linphone_call_log_fill_stats(LinphoneCallLog *log, AudioStream *st){
 
 void linphone_call_stop_media_streams(LinphoneCall *call){
        if (call->audiostream!=NULL) {
+               if (call->audiostream->ec){
+                       const char *state_str=NULL;
+                       ms_filter_call_method(call->audiostream->ec,MS_ECHO_CANCELLER_GET_STATE_STRING,&state_str);
+                       if (state_str){
+                               ms_message("Writing echo canceller state, %i bytes",strlen(state_str));
+                               lp_config_set_string(call->core->config,"sound","ec_state",state_str);
+                       }
+               }
                linphone_call_log_fill_stats (call->log,call->audiostream);
                audio_stream_stop(call->audiostream);
                call->audiostream=NULL;
index a7dbac214af4c666aeb08a2814aa4df665b8e111..ce093cbaf6831ef5a11ba8d0ad499c0f03eed96f 100644 (file)
@@ -22,7 +22,7 @@
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#define MAX_LEN 1024
+#define MAX_LEN 32768
 
 #include "linphonecore.h"
 
index 5c2fe943251c5af493d18133251abf91e0ce5e83..66ca17758ae34aad009f6f737ffd1fb744525818 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 5c2fe943251c5af493d18133251abf91e0ce5e83
+Subproject commit 66ca17758ae34aad009f6f737ffd1fb744525818