Changeset 415:8d28c251c714 in mediastreamer2
- Timestamp:
- Apr 15, 2009 8:41:24 AM (4 years ago)
- Branch:
- default
- Location:
- linphone
- Files:
-
- 3 edited
-
coreapi/linphonecore.c (modified) (3 diffs)
-
mediastreamer2/include/mediastreamer2/mediastream.h (modified) (2 diffs)
-
mediastreamer2/src/audiostream.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
linphone/coreapi/linphonecore.c
r371 r415 1418 1418 lc->audiostream=audio_stream_new(linphone_core_get_audio_port(lc),linphone_core_ipv6_enabled(lc)); 1419 1419 if (linphone_core_echo_limiter_enabled(lc)){ 1420 const char * type=lp_config_get_string(lc->config,"sound","el_type","mic"); 1420 const char *type=lp_config_get_string(lc->config,"sound","el_type","mic"); 1421 float gain=lp_config_get_float(lc->config,"sound","mic_gain",-1); 1421 1422 if (strcasecmp(type,"mic")==0) 1422 1423 audio_stream_enable_echo_limiter(lc->audiostream,ELControlMic); 1423 1424 else if (strcasecmp(type,"speaker")==0) 1424 1425 audio_stream_enable_echo_limiter(lc->audiostream,ELControlSpeaker); 1426 if (gain>0){ 1427 audio_stream_enable_gain_control(lc->audiostream,TRUE); 1428 } 1429 1425 1430 } 1426 1431 #ifdef VIDEO_ENABLED … … 1444 1449 float thres=lp_config_get_float(lc->config,"sound","el_thres",-1); 1445 1450 float force=lp_config_get_float(lc->config,"sound","el_force",-1); 1451 float gain=lp_config_get_float(lc->config,"sound","mic_gain",-1); 1446 1452 MSFilter *f=NULL; 1447 1453 if (st->el_type==ELControlMic){ … … 1464 1470 if (force!=-1) 1465 1471 ms_filter_call_method(f,MS_VOLUME_SET_EA_FORCE,&force); 1472 if (gain!=-1) 1473 ms_filter_call_method(st->volsend,MS_VOLUME_SET_GAIN,&gain); 1466 1474 } 1467 1475 if (lc->vtable.dtmf_received!=NULL){ -
linphone/mediastreamer2/include/mediastreamer2/mediastream.h
r378 r415 53 53 EchoLimiterType el_type; /*use echo limiter: two MSVolume, measured input level controlling local output level*/ 54 54 bool_t play_dtmfs; 55 bool_t use_gc; 55 56 }; 56 57 … … 102 103 void audio_stream_enable_echo_limiter(AudioStream *stream, EchoLimiterType type); 103 104 104 /* stop the above process*/ 105 /*enable gain control, to be done before start() */ 106 void audio_stream_enable_gain_control(AudioStream *stream, bool_t val); 107 108 void audio_stream_set_mic_gain(AudioStream *stream, float gain); 109 110 /* stop the audio streaming thread and free everything*/ 105 111 void audio_stream_stop (AudioStream * stream); 106 112 -
linphone/mediastreamer2/src/audiostream.c
r357 r415 248 248 } 249 249 250 if (stream->el_type!=ELInactive ){250 if (stream->el_type!=ELInactive || stream->use_gc){ 251 251 stream->volsend=ms_filter_new(MS_VOLUME_ID); 252 252 stream->volrecv=ms_filter_new(MS_VOLUME_ID); 253 if (stream->el_type==ELControlSpeaker) 254 ms_filter_call_method(stream->volrecv,MS_VOLUME_SET_PEER,stream->volsend); 255 else ms_filter_call_method(stream->volsend,MS_VOLUME_SET_PEER,stream->volrecv); 253 if (stream->el_type!=ELInactive){ 254 if (stream->el_type==ELControlSpeaker) 255 ms_filter_call_method(stream->volrecv,MS_VOLUME_SET_PEER,stream->volsend); 256 else ms_filter_call_method(stream->volsend,MS_VOLUME_SET_PEER,stream->volrecv); 257 } 256 258 } 257 259 … … 380 382 stream->rtpsend=ms_filter_new(MS_RTP_SEND_ID); 381 383 stream->play_dtmfs=TRUE; 384 stream->use_gc=FALSE; 382 385 return stream; 383 386 } … … 398 401 void audio_stream_enable_echo_limiter(AudioStream *stream, EchoLimiterType type){ 399 402 stream->el_type=type; 403 } 404 405 void audio_stream_enable_gain_control(AudioStream *stream, bool_t val){ 406 stream->use_gc=val; 407 } 408 409 void audio_stream_set_mic_gain(AudioStream *stream, float gain){ 410 if (stream->volsend){ 411 ms_filter_call_method(stream->volsend,MS_VOLUME_SET_GAIN,&gain); 412 }else ms_warning("Could not apply gain: gain control wasn't activated. " 413 "Use audio_stream_enable_gain_control() before starting the stream."); 400 414 } 401 415
Note: See TracChangeset
for help on using the changeset viewer.
