Changeset 3416 for pjproject/trunk
- Timestamp:
- Feb 18, 2011 9:34:28 AM (14 years ago)
- Location:
- pjproject/trunk/pjmedia/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-codec/g722.c
r3250 r3416 39 39 40 40 /* Defines */ 41 #define PTIME ( 20)41 #define PTIME (10) 42 42 #define SAMPLES_PER_FRAME (16000 * PTIME /1000) 43 #define FRAME_LEN ( 160)43 #define FRAME_LEN (80) 44 44 #define PLC_DISABLED 0 45 45 … … 292 292 attr->info.pt = PJMEDIA_RTP_PT_G722; 293 293 294 attr->setting.frm_per_pkt = 1;294 attr->setting.frm_per_pkt = 2; 295 295 attr->setting.vad = 1; 296 296 attr->setting.plc = 1; -
pjproject/trunk/pjmedia/src/pjmedia/stream.c
r3414 r3416 1719 1719 { 1720 1720 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 */ 1722 1729 peer_frm_ts_diff = 1723 1730 ((pj_uint32_t)ts.u64-stream->rtp_rx_last_ts) / 1724 1731 stream->rtp_rx_last_cnt; 1725 1732 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. 1729 1737 */ 1730 1738 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))) 1734 1741 { 1735 1742 if (peer_frm_ts_diff < stream->rtp_rx_ts_len_per_frame) … … 1752 1759 1753 1760 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 } 1754 1766 1755 1767 } else { … … 2141 2153 stream->rtp_tx_ts_len_per_pkt = stream->enc_samples_per_pkt / 2142 2154 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; 2145 2158 2146 2159 if (info->fmt.pt == PJMEDIA_RTP_PT_G722) {
Note: See TracChangeset
for help on using the changeset viewer.