Changeset 357:54cd98ca13fd in mediastreamer2


Ignore:
Timestamp:
Mar 24, 2009 9:28:34 PM (4 years ago)
Author:
smorlat <smorlat@…>
Branch:
default
Message:

enable echo limiter in the other side (control mic)

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

Location:
linphone
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • linphone/coreapi/linphonecore.c

    r355 r357  
    14151415        lc->audiostream=audio_stream_new(linphone_core_get_audio_port(lc),linphone_core_ipv6_enabled(lc)); 
    14161416        if (linphone_core_echo_limiter_enabled(lc)){ 
    1417                 audio_stream_enable_echo_limiter(lc->audiostream,TRUE); 
     1417                const char * type=lp_config_get_string(lc->config,"sound","el_type","mic"); 
     1418                if (strcasecmp(type,"mic")==0) 
     1419                        audio_stream_enable_echo_limiter(lc->audiostream,ELControlMic); 
     1420                else if (strcasecmp(type,"speaker")==0) 
     1421                        audio_stream_enable_echo_limiter(lc->audiostream,ELControlSpeaker); 
    14181422        } 
    14191423#ifdef VIDEO_ENABLED 
     
    14361440                float speed=lp_config_get_float(lc->config,"sound","el_speed",-1); 
    14371441                float thres=lp_config_get_float(lc->config,"sound","el_thres",-1); 
     1442                MSFilter *f; 
     1443                if (st->el_type==ELControlMic) 
     1444                        f=st->volrecv; 
     1445                else f=st->volsend; 
    14381446                if (speed!=-1) 
    1439                         ms_filter_call_method(st->volrecv,MS_VOLUME_SET_EA_SPEED,&speed); 
     1447                        ms_filter_call_method(f,MS_VOLUME_SET_EA_SPEED,&speed); 
    14401448                if (thres!=-1) 
    1441                         ms_filter_call_method(st->volrecv,MS_VOLUME_SET_EA_THRESHOLD,&thres); 
     1449                        ms_filter_call_method(f,MS_VOLUME_SET_EA_THRESHOLD,&thres); 
    14421450        } 
    14431451        if (lc->vtable.dtmf_received!=NULL){ 
  • linphone/mediastreamer2/include/mediastreamer2/mediastream.h

    r354 r357  
    3030#include "ortp/event.h" 
    3131 
     32typedef enum EchoLimiterType{ 
     33        ELInactive, 
     34        ELControlMic, 
     35        ELControlSpeaker 
     36} EchoLimiterType; 
     37 
    3238struct _AudioStream 
    3339{ 
     
    4551        unsigned int last_packet_count; 
    4652        time_t last_packet_time; 
     53        EchoLimiterType el_type; /*use echo limiter: two MSVolume, measured input level controlling local output level*/ 
    4754        bool_t play_dtmfs; 
    48         bool_t use_ea; /*use echo limiter: two MSVolume, measured input level controlling local output level*/ 
    4955}; 
    5056 
     
    94100 
    95101/*enable echo-limiter dispositve: one MSVolume in input branch controls a MSVolume in the output branch*/ 
    96 void audio_stream_enable_echo_limiter(AudioStream *stream, bool_t enabled); 
     102void audio_stream_enable_echo_limiter(AudioStream *stream, EchoLimiterType type); 
    97103 
    98104/* stop the above process*/ 
  • linphone/mediastreamer2/src/audiostream.c

    r354 r357  
    248248        } 
    249249 
    250         if (stream->use_ea){ 
     250        if (stream->el_type!=ELInactive){ 
    251251                stream->volsend=ms_filter_new(MS_VOLUME_ID); 
    252252                stream->volrecv=ms_filter_new(MS_VOLUME_ID); 
    253                 ms_filter_call_method(stream->volrecv,MS_VOLUME_SET_PEER,stream->volsend); 
     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); 
    254256        } 
    255257 
     
    394396} 
    395397 
    396 void audio_stream_enable_echo_limiter(AudioStream *stream, bool_t enabled){ 
    397         stream->use_ea=enabled; 
     398void audio_stream_enable_echo_limiter(AudioStream *stream, EchoLimiterType type){ 
     399        stream->el_type=type; 
    398400} 
    399401 
Note: See TracChangeset for help on using the changeset viewer.