Commit 6f9b9458 authored by Simon Morlat's avatar Simon Morlat

add config entry to finely select audio stream features

parent dc5b821d
......@@ -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);
......
......@@ -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)
......
......@@ -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
......
......@@ -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);
......
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