Ignore:
Timestamp:
Jun 29, 2006 9:51:09 AM (18 years ago)
Author:
bennylp
Message:

Minor bug fix and enhancements: (1) fixed bug that caused out-of-order status to be raised when incoming sequence number is random, (2) changed RTCP to only calculate jitter when the RTP timestamp of the packet is different than previous one, and (3) change RTP to randomize initial sequence number

File:
1 edited

Legend:

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

    r537 r567  
    141141    sess->avg_jitter = 0; 
    142142 
     143    /* Last RX timestamp in RTP packet */ 
     144    sess->rtp_last_ts = (unsigned)-1; 
     145 
    143146    /* Name */ 
    144147    sess->name = name ? name : THIS_FILE, 
     
    198201    unsigned last_seq; 
    199202 
     203    if (sess->stat.rx.pkt == 0) { 
     204        /* Init sequence for the first time. */ 
     205        pjmedia_rtp_seq_init(&sess->seq_ctrl, (pj_uint16_t)seq); 
     206    }  
     207 
    200208    sess->stat.rx.pkt++; 
    201209    sess->stat.rx.bytes += payload; 
    202210 
    203     /* Update sequence numbers. */ 
     211    /* Process the RTP packet. */ 
    204212    last_seq = sess->seq_ctrl.max_seq; 
    205213    pjmedia_rtp_seq_update(&sess->seq_ctrl, (pj_uint16_t)seq, &seq_st); 
     214 
    206215    if (seq_st.status.flag.restart) { 
    207216        rtcp_init_seq(sess); 
     
    213222    } 
    214223 
    215     if (seq_st.status.flag.outorder) { 
     224    if (seq_st.status.flag.outorder && !seq_st.status.flag.probation) { 
    216225        sess->stat.rx.reorder++; 
    217226        TRACE_((sess->name, "Out-of-order packet detected")); 
     
    259268 
    260269    /* 
    261      * Calculate jitter only when sequence is good (see RFC 3550 section A.8) 
     270     * Calculate jitter only when sequence is good (see RFC 3550 section A.8), 
     271     * AND only when the timestamp is different than the last packet 
     272     * (see RTP FAQ). 
    262273     */ 
    263     if (seq_st.diff == 1) { 
     274    if (seq_st.diff == 1 && rtp_ts != sess->rtp_last_ts) { 
    264275        /* Get arrival time and convert timestamp to samples */ 
    265276        pj_get_timestamp(&ts); 
     
    310321        } 
    311322    } 
     323 
     324    /* Update timestamp of last RX RTP packet */ 
     325    sess->rtp_last_ts = rtp_ts; 
    312326} 
    313327 
Note: See TracChangeset for help on using the changeset viewer.