Ignore:
Timestamp:
Feb 25, 2006 9:15:49 PM (18 years ago)
Author:
bennylp
Message:

Fixed echo in conference, and add ability to shrink buffer in jitter buffer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/jbuf.c

    r228 r229  
    2424#include <pj/pool.h> 
    2525#include <pj/assert.h> 
     26#include <pj/log.h> 
    2627#include <pj/string.h> 
    2728 
     29 
     30#define THIS_FILE   "jbuf.c" 
    2831 
    2932 
     
    5558    int             jb_max_hist_jitter;   // max jitter during the last jitter calculations 
    5659    int             jb_stable_hist;       // num of times the delay has been lower then the prefetch num 
     60    unsigned        jb_op_count;          // of of operations. 
    5761    int             jb_last_op;           // last operation executed on the framelist->flist_buffer (put/get) 
    5862    int             jb_last_seq_no;       // seq no. of the last frame inserted to the framelist->flist_buffer 
     
    293297    jb->jb_last_level = jb->jb_level; 
    294298    jb->jb_max_hist_jitter = PJ_MAX(jb->jb_max_hist_jitter,jb->jb_last_jitter); 
    295      
    296     if (jb->jb_last_jitter< jb->jb_prefetch) { 
     299    jb->jb_op_count++; 
     300 
     301    if (jb->jb_last_jitter < jb->jb_prefetch) { 
    297302        jb->jb_stable_hist += jb->jb_last_jitter; 
    298303        if (jb->jb_stable_hist > STABLE_HISTORY_LIMIT) { 
     
    305310            jb->jb_stable_hist = 0; 
    306311            jb->jb_max_hist_jitter = 0; 
     312 
     313            if (jb->jb_op_count >= 100 && 
     314                (int)jb_framelist_size(&jb->jb_framelist) > jb->jb_prefetch+2)  
     315            { 
     316                jb_framelist_remove_head(&jb->jb_framelist,1); 
     317 
     318                PJ_LOG(5,(THIS_FILE, "jbuf prefetch: %d, size=%d",  
     319                                 jb->jb_prefetch, 
     320                                 jb_framelist_size(&jb->jb_framelist))); 
     321                jb->jb_op_count = 0; 
     322            } 
     323 
    307324        } 
    308325    } else { 
     
    310327        jb->jb_stable_hist = 0; 
    311328        jb->jb_max_hist_jitter = 0; 
     329 
     330        if (jb->jb_op_count >= 100) { 
     331            if ((int)jb_framelist_size(&jb->jb_framelist) > jb->jb_prefetch+2) { 
     332                jb_framelist_remove_head(&jb->jb_framelist,1); 
     333 
     334                PJ_LOG(5,(THIS_FILE, "jbuf prefetch: %d, size=%d",  
     335                                 jb->jb_prefetch, 
     336                                 jb_framelist_size(&jb->jb_framelist))); 
     337            } 
     338 
     339            jb->jb_op_count = 0; 
     340        } 
    312341    } 
    313342} 
Note: See TracChangeset for help on using the changeset viewer.