Ticket #478: dtmf.patch
File dtmf.patch, 3.1 KB (added by nanang, 17 years ago) |
---|
-
pjmedia/include/pjmedia/rtp.h
301 301 pjmedia_rtp_status *seq_st); 302 302 303 303 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 */ 318 PJ_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 304 324 /* 305 325 * INTERNAL: 306 326 */ -
pjmedia/src/pjmedia/rtp.c
161 161 const pjmedia_rtp_hdr *hdr, 162 162 pjmedia_rtp_status *p_seq_st) 163 163 { 164 pjmedia_rtp_session_update2(ses, hdr, p_seq_st, PJ_TRUE); 165 } 166 167 PJ_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 { 164 172 pjmedia_rtp_status seq_st; 165 173 166 174 /* Init status */ … … 176 184 } 177 185 178 186 /* Check payload type. */ 179 if ( hdr->pt != ses->out_pt) {187 if (check_pt && hdr->pt != ses->out_pt) { 180 188 if (p_seq_st) { 181 189 p_seq_st->status.value = seq_st.status.value; 182 190 p_seq_st->status.flag.bad = 1; … … 205 213 } 206 214 207 215 216 208 217 void pjmedia_rtp_seq_restart(pjmedia_rtp_seq_session *sess, pj_uint16_t seq) 209 218 { 210 219 sess->base_seq = seq; -
pjmedia/src/pjmedia/stream.c
960 960 if (channel->paused) 961 961 return; 962 962 963 /* Handle incoming DTMF. */964 if (hdr->pt == stream->rx_event_pt) {965 handle_incoming_dtmf(stream, payload, payloadlen);966 return;967 }968 969 963 /* Update RTP session (also checks if RTP session can accept 970 964 * the incoming packet. 971 965 */ 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); 973 968 if (seq_st.status.value) { 974 969 TRC_ ((stream->port.info.name.ptr, 975 970 "RTP status: badpt=%d, badssrc=%d, dup=%d, " … … 996 991 if (payloadlen == 0) 997 992 return; 998 993 994 /* Handle incoming DTMF. */ 995 if (hdr->pt == stream->rx_event_pt) { 996 handle_incoming_dtmf(stream, payload, payloadlen); 997 return; 998 } 999 999 1000 /* Put "good" packet to jitter buffer, or reset the jitter buffer 1000 1001 * when RTP session is restarted. 1001 1002 */