Changeset 2840 for pjproject


Ignore:
Timestamp:
Jul 18, 2009 9:18:26 AM (15 years ago)
Author:
bennylp
Message:

More ticket #920: fixed wrong latency calculation when there is loud noise in the start of recording

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsystest/systest.c

    r2839 r2840  
    616616    unsigned i, samples_per_frame, read, len; 
    617617    unsigned start_pos; 
     618    pj_bool_t first; 
    618619    pj_status_t status; 
    619620 
     
    645646    } 
    646647 
     648    /* Zero the first 500ms to remove loud click noises  
     649     * (keypad press, etc.) 
     650     */ 
     651    pjmedia_zero_samples(buf, wav->info.clock_rate / 2); 
     652 
    647653    /* Loop to calculate latency */ 
    648654    start_pos = 0; 
     655    first = PJ_TRUE; 
    649656    while (start_pos < len/2 - wav->info.clock_rate) { 
    650657        int max_signal = 0; 
     
    692699 
    693700        /* Advance next loop */ 
    694         if (start_pos == 0) { 
     701        if (first) { 
    695702            start_pos = max_signal_pos + wav->info.clock_rate * 9 / 10; 
     703            first = PJ_FALSE; 
    696704        } else { 
    697705            start_pos += wav->info.clock_rate; 
Note: See TracChangeset for help on using the changeset viewer.