Changeset 399


Ignore:
Timestamp:
Apr 9, 2006 5:12:05 PM (19 years ago)
Author:
bennylp
Message:

Added loss period for rx stream implementation

Location:
pjproject/trunk/pjmedia
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/rtcp.h

    r397 r399  
    161161 
    162162    struct { 
     163        unsigned    count;      /**< Number of period samples(to calc avg)  */ 
    163164        unsigned    min;        /**< Minimum loss period (in usec)          */ 
    164165        unsigned    avg;        /**< Average loss period (in usec)          */ 
  • pjproject/trunk/pjmedia/src/pjmedia/rtcp.c

    r397 r399  
    206206    } 
    207207 
     208    /* Calculate loss periods. */ 
     209    if (seq_st.diff > 1) { 
     210        unsigned count = seq_st.diff - 1; 
     211        unsigned period; 
     212 
     213        period = count * sess->pkt_size * 1000 / sess->clock_rate; 
     214        period *= 1000; 
     215 
     216        /* Update loss period stat */ 
     217        if (sess->stat.rx.loss_period.count == 0 || 
     218            period < sess->stat.rx.loss_period.min) 
     219        { 
     220            sess->stat.rx.loss_period.min = period; 
     221        } 
     222        if (period > sess->stat.rx.loss_period.max) 
     223            sess->stat.rx.loss_period.max = period; 
     224        sess->stat.rx.loss_period.avg =  
     225            (sess->stat.rx.loss_period.avg * sess->stat.rx.loss_period.count + 
     226             period) / (sess->stat.rx.loss_period.count + 1); 
     227        sess->stat.rx.loss_period.last = period; 
     228        ++sess->stat.rx.loss_period.count; 
     229    } 
     230 
    208231 
    209232    /* Only mark "good" packets */ 
Note: See TracChangeset for help on using the changeset viewer.