Changeset 1798


Ignore:
Timestamp:
Feb 14, 2008 7:45:47 PM (16 years ago)
Author:
bennylp
Message:

Ticket #478: Handle duplicated/misordered incoming DTMF packets

Location:
pjproject/trunk/pjmedia
Files:
3 edited

Legend:

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

    r1114 r1798  
    302302 
    303303 
     304/** 
     305 * Call this function everytime an RTP packet is received to check whether  
     306 * the packet can be received and to let the RTP session performs its internal 
     307 * calculations. 
     308 * 
     309 * @param ses       The session. 
     310 * @param hdr       The RTP header of the incoming packet. The header must 
     311 *                  be given with fields in network byte order. 
     312 * @param seq_st    Optional structure to receive the status of the RTP packet 
     313 *                  processing. 
     314 * @param check_pt  Flag to indicate whether payload type needs to be validate. 
     315 * 
     316 * @see pjmedia_rtp_session_update() 
     317 */ 
     318PJ_DECL(void) pjmedia_rtp_session_update2(pjmedia_rtp_session *ses,  
     319                                          const pjmedia_rtp_hdr *hdr, 
     320                                          pjmedia_rtp_status *seq_st, 
     321                                          pj_bool_t check_pt); 
     322 
     323 
    304324/* 
    305325 * INTERNAL: 
  • pjproject/trunk/pjmedia/src/pjmedia/rtp.c

    r1481 r1798  
    162162                                         pjmedia_rtp_status *p_seq_st) 
    163163{ 
     164    pjmedia_rtp_session_update2(ses, hdr, p_seq_st, PJ_TRUE); 
     165} 
     166 
     167PJ_DEF(void) pjmedia_rtp_session_update2( pjmedia_rtp_session *ses,  
     168                                          const pjmedia_rtp_hdr *hdr, 
     169                                          pjmedia_rtp_status *p_seq_st, 
     170                                          pj_bool_t check_pt) 
     171{ 
    164172    pjmedia_rtp_status seq_st; 
     173 
     174    /* for now check_pt MUST be either PJ_TRUE or PJ_FALSE. 
     175     * In the future we might change check_pt from boolean to  
     176     * unsigned integer to accommodate more flags. 
     177     */ 
     178    pj_assert(check_pt==PJ_TRUE || check_pt==PJ_FALSE); 
    165179 
    166180    /* Init status */ 
     
    177191 
    178192    /* Check payload type. */ 
    179     if (hdr->pt != ses->out_pt) { 
     193    if (check_pt && hdr->pt != ses->out_pt) { 
    180194        if (p_seq_st) { 
    181195            p_seq_st->status.value = seq_st.status.value; 
     
    204218    } 
    205219} 
     220 
    206221 
    207222 
  • pjproject/trunk/pjmedia/src/pjmedia/stream.c

    r1790 r1798  
    961961        return; 
    962962 
    963     /* Handle incoming DTMF. */ 
    964     if (hdr->pt == stream->rx_event_pt) { 
    965         handle_incoming_dtmf(stream, payload, payloadlen); 
    966         return; 
    967     } 
    968  
    969963    /* Update RTP session (also checks if RTP session can accept 
    970964     * the incoming packet. 
    971965     */ 
    972     pjmedia_rtp_session_update(&channel->rtp, hdr, &seq_st); 
     966    pjmedia_rtp_session_update2(&channel->rtp, hdr, &seq_st, 
     967                                hdr->pt != stream->rx_event_pt); 
    973968    if (seq_st.status.value) { 
    974969        TRC_  ((stream->port.info.name.ptr,  
     
    996991    if (payloadlen == 0) 
    997992        return; 
     993 
     994    /* Handle incoming DTMF. */ 
     995    if (hdr->pt == stream->rx_event_pt) { 
     996        /* Ignore out-of-order packet as it will be detected as new 
     997         * digit. Also ignore duplicate packet as it serves no use. 
     998         */ 
     999        if (seq_st.status.flag.outorder || seq_st.status.flag.dup) { 
     1000            return; 
     1001        } 
     1002 
     1003        handle_incoming_dtmf(stream, payload, payloadlen); 
     1004        return; 
     1005    } 
    9981006 
    9991007    /* Put "good" packet to jitter buffer, or reset the jitter buffer 
Note: See TracChangeset for help on using the changeset viewer.