Changeset 1332:71e753387e4c in mediastreamer2


Ignore:
Timestamp:
Mar 30, 2011 5:42:41 PM (2 years ago)
Author:
Simon Morlat <simon.morlat@…>
Branch:
default
Message:

echo canceller improvements

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • include/mediastreamer2/msinterfaces.h

    r1276 r1332  
    101101        MS_FILTER_METHOD(MSFilterEchoCancellerInterface,2,int) 
    102102 
    103  
    104 /** Interface definitions for video decoders */ 
    105 #define MS_VIDEO_DECODER_DECODING_ERRORS \ 
    106                 MS_FILTER_EVENT_NO_ARG(MSFilterVideoDecoderInterface,0) 
    107  
    108103/** put filter in bypass mode */ 
    109104#define MS_ECHO_CANCELLER_SET_BYPASS_MODE \ 
     
    112107#define MS_ECHO_CANCELLER_GET_BYPASS_MODE \ 
    113108        MS_FILTER_METHOD(MSFilterEchoCancellerInterface,4,bool_t) 
     109 
     110 
     111 
     112/** Interface definitions for video decoders */ 
     113#define MS_VIDEO_DECODER_DECODING_ERRORS \ 
     114                MS_FILTER_EVENT_NO_ARG(MSFilterVideoDecoderInterface,0) 
    114115#endif 
    115116 
  • src/speexec.c

    r1331 r1332  
    3333 
    3434//#define EC_DUMP 1 
    35  
     35#ifdef ANDROID 
    3636#define EC_DUMP_PREFIX "/sdcard" 
     37#else 
     38#define EC_DUMP_PREFIX "/dynamic/tests" 
     39#endif 
    3740 
    3841static const float smooth_factor=0.05; 
     
    5558        FILE *echofile; 
    5659        FILE *reffile; 
     60        FILE *cleanfile; 
    5761#endif 
    5862        bool_t echostarted; 
     
    8488                s->reffile=fopen(fname,"w"); 
    8589                ms_free(fname); 
     90                fname=ms_strdup_printf("%s/msspeexec-%p-clean.raw", EC_DUMP_PREFIX,f); 
     91                s->cleanfile=fopen(fname,"w"); 
     92                ms_free(fname); 
    8693        } 
    8794#endif 
     
    123130        ms_bufferizer_put (&s->delayed_ref,m); 
    124131        s->min_ref_samples=-1; 
     132        s->nominal_ref_samples=delay_samples; 
    125133} 
    126134 
     
    194202                speex_echo_cancellation(s->ecstate,(short*)echo,(short*)ref,(short*)oecho->b_wptr); 
    195203                speex_preprocess_run(s->den, (short*)oecho->b_wptr); 
     204#ifdef EC_DUMP 
     205                if (s->cleanfile) 
     206                        fwrite(oecho->b_wptr,nbytes,1,s->cleanfile); 
     207#endif 
    196208                oecho->b_wptr+=nbytes; 
    197209                ms_queue_put(f->outputs[1],oecho); 
     
    202214                int diff=s->min_ref_samples-s->nominal_ref_samples; 
    203215                if (diff>nbytes){ 
    204                         ms_warning("echo canceller: we are accumulating too much reference signal, purging now %i bytes",nbytes); 
    205                         ms_bufferizer_skip_bytes(&s->delayed_ref,nbytes); 
     216                        int purge=diff-(nbytes/2); 
     217                        ms_warning("echo canceller: we are accumulating too much reference signal, purging now %i bytes",purge); 
     218                        ms_bufferizer_skip_bytes(&s->delayed_ref,purge); 
    206219                } 
    207220                s->min_ref_samples=-1; 
     
    262275        {       MS_ECHO_CANCELLER_SET_TAIL_LENGTH       ,       speex_ec_set_tail_length        }, 
    263276        {       MS_ECHO_CANCELLER_SET_DELAY             ,       speex_ec_set_delay              }, 
    264         {       MS_ECHO_CANCELLER_SET_FRAMESIZE ,       speex_ec_set_framesize          }, 
     277        {       MS_ECHO_CANCELLER_SET_FRAMESIZE         ,       speex_ec_set_framesize          }, 
    265278        {       MS_ECHO_CANCELLER_SET_BYPASS_MODE       ,       speex_ec_set_bypass_mode                }, 
    266279        {       MS_ECHO_CANCELLER_GET_BYPASS_MODE       ,       speex_ec_get_bypass_mode                }, 
Note: See TracChangeset for help on using the changeset viewer.