Ignore:
Timestamp:
Sep 20, 2012 11:26:16 AM (12 years ago)
Author:
bennylp
Message:

Fixed #1582: Transmit the last DTMF packet (containing the E bit) three times

File:
1 edited

Legend:

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

    r4255 r4263  
    7474#endif 
    7575 
     76/* Number of DTMF E bit transmissions */ 
     77#define DTMF_EBIT_RETRANSMIT_CNT        3 
    7678 
    7779/** 
     
    9597    int             event; 
    9698    pj_uint32_t     duration; 
     99    int             ebit_cnt;               /**< # of E bit transmissions   */ 
    97100}; 
    98101 
     
    897900 
    898901    digit->duration += PJMEDIA_PIA_SPF(&stream->port.info); 
     902    if (digit->duration >= PJMEDIA_DTMF_DURATION) 
     903        digit->duration = PJMEDIA_DTMF_DURATION; 
    899904 
    900905    event->event = (pj_uint8_t)digit->event; 
     
    902907    event->duration = pj_htons((pj_uint16_t)digit->duration); 
    903908 
    904  
    905     if (forced_last || digit->duration >= PJMEDIA_DTMF_DURATION) { 
     909    if (forced_last) { 
     910        digit->duration = PJMEDIA_DTMF_DURATION; 
     911    } 
     912 
     913    if (digit->duration >= PJMEDIA_DTMF_DURATION) { 
    906914 
    907915        event->e_vol |= 0x80; 
    908         *last = 1; 
    909  
    910         /* Prepare next digit. */ 
    911         pj_mutex_lock(stream->jb_mutex); 
    912  
    913         pj_array_erase(stream->tx_dtmf_buf, sizeof(stream->tx_dtmf_buf[0]), 
    914                        stream->tx_dtmf_count, 0); 
    915         --stream->tx_dtmf_count; 
    916  
    917         pj_mutex_unlock(stream->jb_mutex); 
     916 
     917        if (++digit->ebit_cnt >= DTMF_EBIT_RETRANSMIT_CNT) { 
     918            *last = 1; 
     919 
     920            /* Prepare next digit. */ 
     921            pj_mutex_lock(stream->jb_mutex); 
     922 
     923            pj_array_erase(stream->tx_dtmf_buf, sizeof(stream->tx_dtmf_buf[0]), 
     924                           stream->tx_dtmf_count, 0); 
     925            --stream->tx_dtmf_count; 
     926 
     927            pj_mutex_unlock(stream->jb_mutex); 
     928        } 
    918929    } 
    919930 
     
    12361247             * RTP packets. 
    12371248             */ 
    1238             inc_timestamp = PJMEDIA_DTMF_DURATION - rtp_ts_len; 
     1249            inc_timestamp = PJMEDIA_DTMF_DURATION + 
     1250                            ((DTMF_EBIT_RETRANSMIT_CNT-1) * samples_per_frame) 
     1251                            - rtp_ts_len; 
    12391252        } 
    12401253 
     
    27422755            stream->tx_dtmf_buf[stream->tx_dtmf_count+i].event = pt; 
    27432756            stream->tx_dtmf_buf[stream->tx_dtmf_count+i].duration = 0; 
     2757            stream->tx_dtmf_buf[stream->tx_dtmf_count+i].ebit_cnt = 0; 
    27442758        } 
    27452759 
Note: See TracChangeset for help on using the changeset viewer.