Ignore:
Timestamp:
Feb 18, 2011 9:34:28 AM (13 years ago)
Author:
nanang
Message:

Fix #1199:

  • Modified G722 frame time to 10ms (was 20ms) and frame per packet to 2 (was 1).
  • Updated the detection mechanism of remote G722 frame-length in the stream to be flexible to any G722 frame length setting (was assumed to be always 20ms).
File:
1 edited

Legend:

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

    r3414 r3416  
    17191719                { 
    17201720                    unsigned peer_frm_ts_diff; 
    1721  
     1721                    unsigned frm_ts_span; 
     1722 
     1723                    /* Calculate actual frame timestamp span */ 
     1724                    frm_ts_span = stream->port.info.samples_per_frame / 
     1725                                  stream->codec_param.setting.frm_per_pkt/ 
     1726                                  stream->port.info.channel_count; 
     1727 
     1728                    /* Get remote frame timestamp span */ 
    17221729                    peer_frm_ts_diff =  
    17231730                        ((pj_uint32_t)ts.u64-stream->rtp_rx_last_ts) /  
    17241731                        stream->rtp_rx_last_cnt; 
    17251732 
    1726                     /* Possibilities remote's samples per frame for G.722  
    1727                      * are only 160 and 320, this validation is needed 
    1728                      * to avoid wrong decision because of silence frames. 
     1733                    /* Possibilities remote's samples per frame for G.722 
     1734                     * are only (frm_ts_span) and (frm_ts_span/2), this 
     1735                     * validation is needed to avoid wrong decision because 
     1736                     * of silence frames. 
    17291737                     */ 
    17301738                    if (stream->codec_param.info.pt == PJMEDIA_RTP_PT_G722 && 
    1731                         (peer_frm_ts_diff==stream->port.info.samples_per_frame 
    1732                          || peer_frm_ts_diff ==  
    1733                                     stream->port.info.samples_per_frame >> 1)) 
     1739                        (peer_frm_ts_diff == frm_ts_span ||  
     1740                         peer_frm_ts_diff == (frm_ts_span>>1))) 
    17341741                    { 
    17351742                        if (peer_frm_ts_diff < stream->rtp_rx_ts_len_per_frame) 
     
    17521759 
    17531760            ts_span = stream->rtp_rx_ts_len_per_frame; 
     1761 
     1762            /* Adjust the timestamp of the parsed frames */ 
     1763            for (i=0; i<count; ++i) { 
     1764                frames[i].timestamp.u64 = ts.u64 + ts_span * i; 
     1765            } 
    17541766 
    17551767        } else { 
     
    21412153    stream->rtp_tx_ts_len_per_pkt = stream->enc_samples_per_pkt / 
    21422154                                     stream->codec_param.info.channel_cnt; 
    2143     stream->rtp_rx_ts_len_per_frame = stream->port.info.samples_per_frame /  
    2144                                        stream->codec_param.info.channel_cnt; 
     2155    stream->rtp_rx_ts_len_per_frame = stream->port.info.samples_per_frame / 
     2156                                      stream->codec_param.setting.frm_per_pkt / 
     2157                                      stream->codec_param.info.channel_cnt; 
    21452158 
    21462159    if (info->fmt.pt == PJMEDIA_RTP_PT_G722) { 
Note: See TracChangeset for help on using the changeset viewer.