Changeset 1034:c82afd5c2522 in mediastreamer2


Ignore:
Timestamp:
Jun 30, 2010 10:11:37 AM (3 years ago)
Author:
Simon Morlat <simon.morlat@…>
Branch:
default
Message:

add possibility to dump echo and ref streams

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/speexec.c

    r1031 r1034  
    3131#endif 
    3232 
     33//#define EC_DUMP 1 
     34 
     35#define EC_DUMP_PREFIX "/sdcard" 
     36 
    3337static const int framesize=128; 
    34 static const int ref_max_delay=80; 
    35  
    36 #if 0 
    37 typedef struct _BufferSizeEstimator{ 
    38         float mean; 
    39         float jitter; 
    40 }BufferSizeEstimator; 
    41  
    42 void buffer_size_estimator_update(BufferSizeEstimator *bse, int size){ 
    43         static const float smooth=0.04; 
    44 } 
    45  
    46 #endif 
     38static const int ref_max_delay=60; 
     39 
    4740 
    4841typedef struct SpeexECState{ 
     
    5851        int delay_ms; 
    5952        int tail_length_ms; 
     53#ifdef EC_DUMP 
     54        FILE *echofile; 
     55        FILE *reffile; 
     56#endif 
    6057        bool_t using_silence; 
    6158        bool_t echostarted; 
     
    7774        s->echostarted=FALSE; 
    7875 
     76#ifdef EC_DUMP 
     77        { 
     78                char *fname=ms_strdup_printf("%s/msspeexec-%p-echo.raw", EC_DUMP_PREFIX,f); 
     79                s->echofile=fopen(fname,"w"); 
     80                ms_free(fname); 
     81                fname=ms_strdup_printf("%s/msspeexec-%p-ref.raw", EC_DUMP_PREFIX,f); 
     82                s->reffile=fopen(fname,"w"); 
     83                ms_free(fname); 
     84        } 
     85#endif 
     86         
    7987        f->data=s; 
    8088} 
     
    8492        ms_bufferizer_uninit(&s->ref); 
    8593        ms_bufferizer_uninit(&s->delayed_ref); 
     94#ifdef EC_DUMP 
     95        if (s->echofile) 
     96                fclose(s->echofile); 
     97        if (s->reffile) 
     98                fclose(s->reffile); 
     99#endif 
    86100        ms_free(s); 
    87101} 
     
    166180                oref->b_wptr+=nbytes; 
    167181                ms_queue_put(f->outputs[0],oref); 
     182#ifdef EC_DUMP 
     183                if (s->reffile) 
     184                        fwrite(ref,nbytes,1,s->reffile); 
     185                if (s->echofile) 
     186                        fwrite(echo,nbytes,1,s->echofile); 
     187#endif 
    168188                speex_echo_cancellation(s->ecstate,(short*)echo,(short*)ref,(short*)oecho->b_wptr); 
    169189                speex_preprocess_run(s->den, (short*)oecho->b_wptr); 
Note: See TracChangeset for help on using the changeset viewer.