Changeset 355:87138af50068 in mediastreamer2
- Timestamp:
- Mar 23, 2009 3:09:10 PM (4 years ago)
- Branch:
- default
- Location:
- linphone
- Files:
-
- 6 edited
-
coreapi/exevents.c (modified) (1 diff)
-
coreapi/linphonecore.c (modified) (2 diffs)
-
coreapi/lpconfig.c (modified) (1 diff)
-
coreapi/proxy.c (modified) (5 diffs)
-
mediastreamer2/src/ice.c (modified) (3 diffs)
-
mediastreamer2/src/msvolume.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
linphone/coreapi/exevents.c
r342 r355 705 705 if (!linphone_core_video_enabled(lc)) return -1; 706 706 707 if (payload->remoteport==0) { 708 ms_message("Video stream refused by remote."); 709 return 0; 710 } 711 707 712 params=&call->video_params; 708 713 remote_profile=call->profile; -
linphone/coreapi/linphonecore.c
r354 r355 1437 1437 float thres=lp_config_get_float(lc->config,"sound","el_thres",-1); 1438 1438 if (speed!=-1) 1439 ms_filter_call_method(st->vol send,MS_VOLUME_SET_EA_SPEED,&speed);1439 ms_filter_call_method(st->volrecv,MS_VOLUME_SET_EA_SPEED,&speed); 1440 1440 if (thres!=-1) 1441 1441 ms_filter_call_method(st->volrecv,MS_VOLUME_SET_EA_THRESHOLD,&thres); … … 2407 2407 void linphone_core_uninit(LinphoneCore *lc) 2408 2408 { 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 } 2409 2421 gstate_new_state(lc, GSTATE_POWER_SHUTDOWN, NULL); 2410 2422 #ifdef VIDEO_ENABLED -
linphone/coreapi/lpconfig.c
r354 r355 293 293 float lp_config_get_float(LpConfig *lpconfig,const char *section, const char *key, float default_value){ 294 294 const char *str=lp_config_get_string(lpconfig,section,key,NULL); 295 float ret ;295 float ret=default_value; 296 296 if (str==NULL) return default_value; 297 297 sscanf(str,"%f",&ret); -
linphone/coreapi/proxy.c
r342 r355 26 26 #include "private.h" 27 27 28 void 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 } 28 36 29 37 void linphone_proxy_config_init(LinphoneProxyConfig *obj){ … … 232 240 } 233 241 234 int linphone_proxy_config_done(LinphoneProxyConfig *obj) 235 { 242 static void linphone_proxy_config_register(LinphoneProxyConfig *obj){ 236 243 const char *id_str; 237 if (!linphone_proxy_config_check(obj->lc,obj)) return -1;238 244 if (obj->reg_identity!=NULL) id_str=obj->reg_identity; 239 245 else id_str=linphone_core_get_primary_contact(obj->lc); 240 obj->frozen=FALSE;241 246 if (obj->reg_sendregister){ 242 247 char *ct=NULL; … … 246 251 if (ct!=NULL) osip_free(ct); 247 252 } 253 } 254 255 int 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); 248 261 return 0; 249 262 } … … 503 516 LinphoneProxyConfig *cfg=linphone_core_get_proxy_config_from_rid(lc, ev->rid); 504 517 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 } 513 525 514 526 void linphone_proxy_config_write_to_config_file(LpConfig *config, LinphoneProxyConfig *obj, int index) … … 537 549 lp_config_set_int(config,key,"publish",obj->publish); 538 550 } 551 552 539 553 540 554 LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LpConfig *config, int index) -
linphone/mediastreamer2/src/ice.c
r353 r355 166 166 /* prepare ONCE tie-break value */ 167 167 if (checklist->tiebreak_value==0) { 168 checklist->tiebreak_value = random() * (0x7fffffffffffffff /0x7fff);168 checklist->tiebreak_value = random() * (0x7fffffffffffffffLL /0x7fff); 169 169 } 170 170 … … 514 514 /* prepare ONCE tie-break value */ 515 515 if (checklist->tiebreak_value==0) { 516 checklist->tiebreak_value = random() * (0x7fffffffffffffff /0x7fff);516 checklist->tiebreak_value = random() * (0x7fffffffffffffffLL/0x7fff); 517 517 } 518 518 … … 948 948 struct in_addr inaddr; 949 949 char mapped_addr[64]; 950 struct CandidatePair *cand_pair ;950 struct CandidatePair *cand_pair=NULL; 951 951 int pos; 952 952 inaddr.s_addr = htonl (mappedAddr.addr); -
linphone/mediastreamer2/src/msvolume.c
r354 r355 23 23 static const float max_e=32767*32767; 24 24 static const float coef=0.1; 25 static const float gain_k=0. 2;26 25 static const float gain_k=0.03; 26 static const float en_weight=4.0; 27 27 static const float noise_thres=0.1; 28 28 … … 47 47 v->gain_k=gain_k; 48 48 v->thres=noise_thres; 49 v->peer=NULL; 49 50 f->data=v; 50 51 } … … 66 67 *farg=(v->energy+1)/max_e; 67 68 return 0; 69 } 70 71 static 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; 68 75 } 69 76 … … 71 78 float peer_e; 72 79 float gain; 80 float gain_k2; 73 81 ms_filter_call_method(v->peer,MS_VOLUME_GET_LINEAR,&peer_e); 82 peer_e=sqrt(peer_e); 74 83 if (v->ea_active){ 75 84 if (peer_e>v->thres){ 76 85 /*lower our output*/ 77 gain= v->static_gain*(1-peer_e);86 gain=compute_gain(v->static_gain,peer_e,en_weight); 78 87 }else { 79 88 gain=v->static_gain; … … 85 94 if (peer_e>v->thres && ! peer_active){ 86 95 /*lower our output*/ 87 gain= v->static_gain*(1-peer_e);96 gain=compute_gain(v->static_gain,peer_e,en_weight); 88 97 v->ea_active=TRUE; 89 98 }else gain=v->static_gain; 90 99 } 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); 92 105 } 93 106 … … 209 222 }; 210 223 #endif 224 225 MS_FILTER_DESC_EXPORT(ms_volume_desc) 226 227
Note: See TracChangeset
for help on using the changeset viewer.
