Changeset 2019 for pjproject


Ignore:
Timestamp:
Jun 14, 2008 4:44:33 PM (16 years ago)
Author:
bennylp
Message:

More ticket #505: added constants to shrink the excess frames in jbuf even more slowly, default can only discard one excess frame per 200ms

File:
1 edited

Legend:

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

    r1983 r2019  
    3131#define THIS_FILE   "jbuf.c" 
    3232 
    33 #define SAFE_SHRINKING_DIFF     2 
     33#define SAFE_SHRINKING_DIFF     1 
     34#define MIN_SHRINK_GAP_MSEC     200 
    3435#define USE_PREFETCH_BUFFERING  0 
    3536 
     
    7071    int             jb_status;            // status is 'init' until the first 'put' operation 
    7172    pj_math_stat    jb_delay;             // Delay statistics of jitter buffer (in frame unit) 
     73 
     74    unsigned        jb_last_del_seq;      // Seq # of last frame deleted 
     75    unsigned        jb_min_shrink_gap;    // How often can we shrink 
    7276}; 
    7377 
     
    319323    jb->jb_max_hist_level = 0; 
    320324    jb->jb_max_count     = max_count; 
     325    jb->jb_min_shrink_gap= MIN_SHRINK_GAP_MSEC / ptime; 
    321326 
    322327    pj_math_stat_init(&jb->jb_delay); 
     
    458463    /* These code is used for shortening the delay in the jitter buffer. */ 
    459464    diff = cur_size - jb->jb_prefetch; 
    460     if (diff > SAFE_SHRINKING_DIFF) { 
     465    if (diff > SAFE_SHRINKING_DIFF &&  
     466        jb->jb_framelist.flist_origin-jb->jb_last_del_seq > jb->jb_min_shrink_gap) 
     467    { 
    461468        /* Shrink slowly */ 
    462469        diff = 1; 
     
    464471        /* Drop frame(s)! */ 
    465472        jb_framelist_remove_head(&jb->jb_framelist, diff); 
     473        jb->jb_last_del_seq = jb->jb_framelist.flist_origin; 
    466474 
    467475        pj_math_stat_update(&jb->jb_delay, cur_size - diff); 
Note: See TracChangeset for help on using the changeset viewer.