Changeset 355:87138af50068 in mediastreamer2


Ignore:
Timestamp:
Mar 23, 2009 3:09:10 PM (4 years ago)
Author:
smorlat <smorlat@…>
Branch:
default
Message:

tuning of echo limiter

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@358 3f6dc0c8-ddfe-455d-9043-3cd528dc4637

Location:
linphone
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • linphone/coreapi/exevents.c

    r342 r355  
    705705        if (!linphone_core_video_enabled(lc)) return -1; 
    706706 
     707        if (payload->remoteport==0) { 
     708                ms_message("Video stream refused by remote."); 
     709                return 0; 
     710        } 
     711 
    707712        params=&call->video_params; 
    708713        remote_profile=call->profile; 
  • linphone/coreapi/linphonecore.c

    r354 r355  
    14371437                float thres=lp_config_get_float(lc->config,"sound","el_thres",-1); 
    14381438                if (speed!=-1) 
    1439                         ms_filter_call_method(st->volsend,MS_VOLUME_SET_EA_SPEED,&speed); 
     1439                        ms_filter_call_method(st->volrecv,MS_VOLUME_SET_EA_SPEED,&speed); 
    14401440                if (thres!=-1) 
    14411441                        ms_filter_call_method(st->volrecv,MS_VOLUME_SET_EA_THRESHOLD,&thres); 
     
    24072407void linphone_core_uninit(LinphoneCore *lc) 
    24082408{ 
     2409        if (lc->call){ 
     2410                int i; 
     2411                linphone_core_terminate_call(lc,NULL); 
     2412                for(i=0;i<10;++i){ 
     2413#ifndef WIN32 
     2414                        usleep(50000); 
     2415#else 
     2416                        Sleep(50); 
     2417#endif 
     2418                        linphone_core_iterate(lc); 
     2419                } 
     2420        } 
    24092421        gstate_new_state(lc, GSTATE_POWER_SHUTDOWN, NULL); 
    24102422#ifdef VIDEO_ENABLED 
  • linphone/coreapi/lpconfig.c

    r354 r355  
    293293float lp_config_get_float(LpConfig *lpconfig,const char *section, const char *key, float default_value){ 
    294294        const char *str=lp_config_get_string(lpconfig,section,key,NULL); 
    295         float ret; 
     295        float ret=default_value; 
    296296        if (str==NULL) return default_value; 
    297297        sscanf(str,"%f",&ret); 
  • linphone/coreapi/proxy.c

    r342 r355  
    2626#include "private.h" 
    2727 
     28void linphone_proxy_config_write_all_to_config_file(LinphoneCore *lc){ 
     29        MSList *elem; 
     30        int i; 
     31        for(elem=lc->sip_conf.proxies,i=0;elem!=NULL;elem=ms_list_next(elem),i++){ 
     32                LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data; 
     33                linphone_proxy_config_write_to_config_file(lc->config,cfg,i); 
     34        } 
     35} 
    2836 
    2937void linphone_proxy_config_init(LinphoneProxyConfig *obj){ 
     
    232240} 
    233241 
    234 int linphone_proxy_config_done(LinphoneProxyConfig *obj) 
    235 { 
     242static void linphone_proxy_config_register(LinphoneProxyConfig *obj){ 
    236243        const char *id_str; 
    237         if (!linphone_proxy_config_check(obj->lc,obj)) return -1; 
    238244        if (obj->reg_identity!=NULL) id_str=obj->reg_identity; 
    239245        else id_str=linphone_core_get_primary_contact(obj->lc); 
    240         obj->frozen=FALSE; 
    241246        if (obj->reg_sendregister){ 
    242247                char *ct=NULL; 
     
    246251                if (ct!=NULL) osip_free(ct); 
    247252        } 
     253} 
     254 
     255int linphone_proxy_config_done(LinphoneProxyConfig *obj) 
     256{ 
     257        if (!linphone_proxy_config_check(obj->lc,obj)) return -1; 
     258        obj->frozen=FALSE; 
     259        linphone_proxy_config_register(obj); 
     260        linphone_proxy_config_write_all_to_config_file(obj->lc); 
    248261        return 0; 
    249262} 
     
    503516        LinphoneProxyConfig *cfg=linphone_core_get_proxy_config_from_rid(lc, ev->rid); 
    504517        if (cfg){ 
    505                         cfg->auth_failures++; 
    506                         /*restart a new register */ 
    507                         if (cfg->auth_failures==1){ 
    508                                 linphone_proxy_config_done(cfg); 
    509                         } 
    510         } 
    511 } 
    512  
     518                cfg->auth_failures++; 
     519                /*restart a new register */ 
     520                if (cfg->auth_failures==1){ 
     521                        linphone_proxy_config_register(cfg); 
     522                } 
     523        } 
     524} 
    513525 
    514526void linphone_proxy_config_write_to_config_file(LpConfig *config, LinphoneProxyConfig *obj, int index) 
     
    537549        lp_config_set_int(config,key,"publish",obj->publish); 
    538550} 
     551 
     552 
    539553 
    540554LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LpConfig *config, int index) 
  • linphone/mediastreamer2/src/ice.c

    r353 r355  
    166166                /* prepare ONCE tie-break value */ 
    167167                if (checklist->tiebreak_value==0) { 
    168                         checklist->tiebreak_value = random() * (0x7fffffffffffffff/0x7fff); 
     168                        checklist->tiebreak_value = random() * (0x7fffffffffffffffLL /0x7fff); 
    169169                } 
    170170 
     
    514514        /* prepare ONCE tie-break value */ 
    515515        if (checklist->tiebreak_value==0) { 
    516                 checklist->tiebreak_value = random() * (0x7fffffffffffffff/0x7fff); 
     516                checklist->tiebreak_value = random() * (0x7fffffffffffffffLL/0x7fff); 
    517517        } 
    518518 
     
    948948                        struct in_addr inaddr; 
    949949                        char mapped_addr[64]; 
    950                         struct CandidatePair *cand_pair; 
     950                        struct CandidatePair *cand_pair=NULL; 
    951951                        int pos; 
    952952                        inaddr.s_addr = htonl (mappedAddr.addr); 
  • linphone/mediastreamer2/src/msvolume.c

    r354 r355  
    2323static const float max_e=32767*32767; 
    2424static const float coef=0.1; 
    25 static const float gain_k=0.2; 
    26  
     25static const float gain_k=0.03; 
     26static const float en_weight=4.0; 
    2727static const float noise_thres=0.1; 
    2828 
     
    4747        v->gain_k=gain_k; 
    4848        v->thres=noise_thres; 
     49        v->peer=NULL; 
    4950        f->data=v; 
    5051} 
     
    6667        *farg=(v->energy+1)/max_e; 
    6768        return 0; 
     69} 
     70 
     71static inline float compute_gain(float static_gain, float energy, float weight){ 
     72        float ret=static_gain*(1 - (energy*weight)); 
     73        if (ret<0) ret=0; 
     74        return ret; 
    6875} 
    6976 
     
    7178        float peer_e; 
    7279        float gain; 
     80        float gain_k2; 
    7381        ms_filter_call_method(v->peer,MS_VOLUME_GET_LINEAR,&peer_e); 
     82        peer_e=sqrt(peer_e); 
    7483        if (v->ea_active){ 
    7584                if (peer_e>v->thres){ 
    7685                        /*lower our output*/ 
    77                         gain=v->static_gain*(1-peer_e); 
     86                        gain=compute_gain(v->static_gain,peer_e,en_weight); 
    7887                }else { 
    7988                        gain=v->static_gain; 
     
    8594                if (peer_e>v->thres && ! peer_active){ 
    8695                        /*lower our output*/ 
    87                         gain=v->static_gain*(1-peer_e); 
     96                        gain=compute_gain(v->static_gain,peer_e,en_weight); 
    8897                        v->ea_active=TRUE; 
    8998                }else gain=v->static_gain; 
    9099        } 
    91         v->gain=(v->gain*(1-v->gain_k)) + (v->gain_k*v->gain); 
     100        if (v->ea_active){ 
     101                gain_k2=5*v->gain_k; 
     102        }else gain_k2=v->gain_k; 
     103        v->gain=(v->gain*(1-gain_k2)) + (gain_k2*gain); 
     104        ms_message("ea_active=%i, peer_e=%f gain=%f gain_k=%f",v->ea_active,peer_e,v->gain, v->gain_k); 
    92105} 
    93106 
     
    209222}; 
    210223#endif 
     224 
     225MS_FILTER_DESC_EXPORT(ms_volume_desc) 
     226 
     227 
Note: See TracChangeset for help on using the changeset viewer.