]> sjero.net Git - linphone/commitdiff
add config entry to finely select audio stream features
authorSimon Morlat <simon.morlat@linphone.org>
Thu, 9 Aug 2012 14:07:43 +0000 (16:07 +0200)
committerSimon Morlat <simon.morlat@linphone.org>
Thu, 9 Aug 2012 14:08:21 +0000 (16:08 +0200)
coreapi/linphonecall.c
coreapi/linphonecore.c
coreapi/misc.c
coreapi/private.h

index 3793cb32b1f9329117a43b8bef4fb577d41cfd32..77fd9e20f003cec8cc1bff31f8a9745d508abff4 100644 (file)
@@ -933,6 +933,8 @@ void linphone_call_init_media_streams(LinphoneCall *call){
                audio_stream_enable_noise_gate(audiostream,enabled);
        }
 
+       audio_stream_set_features(audiostream,linphone_core_get_audio_features(lc));
+
        if (lc->rtptf){
                RtpTransport *artp=lc->rtptf->audio_rtp_func(lc->rtptf->audio_rtp_func_data, call->audio_port);
                RtpTransport *artcp=lc->rtptf->audio_rtcp_func(lc->rtptf->audio_rtcp_func_data, call->audio_port+1);
index 40b2a647d933056c869c57f702ba1fe042879f64..62942726a2c66f5352dddfaf5a6bcb8e7bb3fac8 100644 (file)
@@ -485,6 +485,9 @@ static void sound_config_read(LinphoneCore *lc)
        linphone_core_set_playback_gain_db (lc,gain);
 
        linphone_core_set_remote_ringback_tone (lc,lp_config_get_string(lc->config,"sound","ringback_tone",NULL));
+
+       /*just parse requested stream feature once at start to print out eventual errors*/
+       linphone_core_get_audio_features(lc);
 }
 
 static void sip_config_read(LinphoneCore *lc)
index a749bf2793ba5f2a54867d0d4bed878073980b44..786347d630af9c8016d7710bd208ee00e066d4d1 100644 (file)
@@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 
 #include "private.h"
+#include "lpconfig.h"
 #include "mediastreamer2/mediastream.h"
 #include <stdlib.h>
 #include <stdio.h>
@@ -574,6 +575,37 @@ LinphoneProxyConfig * is_a_linphone_proxy_config(void *user_pointer){
        return cfg->magic==linphone_proxy_config_magic ? cfg : NULL;
 }
 
+unsigned int linphone_core_get_audio_features(LinphoneCore *lc){
+       unsigned int ret=0;
+       const char *features=lp_config_get_string(lc->config,"sound","features",NULL);
+       if (features){
+               char tmp[256]={0};
+               char name[256];
+               char *p,*n;
+               strncpy(tmp,features,sizeof(tmp)-1);
+               for(p=tmp;*p!='\0';p++){
+                       if (*p==' ') continue;
+                       n=strchr(p,'|');
+                       if (n) *n='\0';
+                       sscanf(p,"%s",name);
+                       ms_message("Found audio feature %s",name);
+                       if (strcasecmp(name,"PLC")==0) ret|=AUDIO_STREAM_FEATURE_PLC;
+                       else if (strcasecmp(name,"EC")==0) ret|=AUDIO_STREAM_FEATURE_EC;
+                       else if (strcasecmp(name,"EQUALIZER")==0) ret|=AUDIO_STREAM_FEATURE_EQUALIZER;
+                       else if (strcasecmp(name,"VOL_SND")==0) ret|=AUDIO_STREAM_FEATURE_VOL_SND;
+                       else if (strcasecmp(name,"VOL_RCV")==0) ret|=AUDIO_STREAM_FEATURE_VOL_RCV;
+                       else if (strcasecmp(name,"DTMF")==0) ret|=AUDIO_STREAM_FEATURE_DTMF;
+                       else if (strcasecmp(name,"DTMF_ECHO")==0) ret|=AUDIO_STREAM_FEATURE_DTMF_ECHO;
+                       else if (strcasecmp(name,"ALL")==0) ret|=AUDIO_STREAM_FEATURE_ALL;
+                       else if (strcasecmp(name,"NONE")==0) ret=0;
+                       else ms_error("Unsupported audio feature %s requested in config file.",name);
+                       if (!n) break;
+                       p=n;
+               }
+       }else ret=AUDIO_STREAM_FEATURE_ALL;
+       return ret;
+}
+
 
 #ifdef HAVE_GETIFADDRS
 
@@ -697,7 +729,6 @@ int linphone_core_get_local_ip_for(int type, const char *dest, char *result){
 
 
 
-
 void _linphone_core_configure_resolver(){
 /*bionic declares _res but does not define nor export it !!*/
 #ifdef ANDROID
index bc035f215d44b2f81655acd549cfaceb158aaed0..24ee7f8992c7215eb8874bc631f3f75c186582e8 100644 (file)
@@ -567,6 +567,7 @@ void linphone_call_remove_from_conf(LinphoneCall *call);
 void linphone_core_conference_check_uninit(LinphoneCore *lc);
 bool_t linphone_core_sound_resources_available(LinphoneCore *lc);
 void linphone_core_notify_refer_state(LinphoneCore *lc, LinphoneCall *referer, LinphoneCall *newcall);
+unsigned int linphone_core_get_audio_features(LinphoneCore *lc);
 
 void __linphone_core_invalidate_registers(LinphoneCore* lc);
 void _linphone_core_codec_config_write(LinphoneCore *lc);