Changeset 4255 for pjproject/trunk
- Timestamp:
- Sep 14, 2012 1:18:57 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/stream.c
r4254 r4255 877 877 static void create_dtmf_payload(pjmedia_stream *stream, 878 878 struct pjmedia_frame *frame_out, 879 879 int forced_last, int *first, int *last) 880 880 { 881 881 pjmedia_rtp_dtmf_event *event; … … 903 903 904 904 905 if ( digit->duration >= PJMEDIA_DTMF_DURATION) {905 if (forced_last || digit->duration >= PJMEDIA_DTMF_DURATION) { 906 906 907 907 event->e_vol |= 0x80; … … 1218 1218 int first=0, last=0; 1219 1219 1220 create_dtmf_payload(stream, &frame_out, &first, &last);1220 create_dtmf_payload(stream, &frame_out, 0, &first, &last); 1221 1221 1222 1222 /* Encapsulate into RTP packet. Note that: … … 2416 2416 PJ_DEF(pj_status_t) pjmedia_stream_destroy( pjmedia_stream *stream ) 2417 2417 { 2418 pj_status_t status; 2419 2418 2420 PJ_ASSERT_RETURN(stream != NULL, PJ_EINVAL); 2419 2421 … … 2421 2423 if (!stream->rtcp_sdes_bye_disabled) { 2422 2424 send_rtcp(stream, PJ_TRUE, PJ_TRUE, PJ_TRUE); 2425 } 2426 2427 /* If we're in the middle of transmitting DTMF digit, send one last 2428 * RFC 2833 RTP packet with 'End' flag set. 2429 */ 2430 if (stream->tx_dtmf_count && stream->tx_dtmf_buf[0].duration != 0) { 2431 pjmedia_frame frame_out; 2432 pjmedia_channel *channel = stream->enc; 2433 int first=0, last=0; 2434 void *rtphdr; 2435 int rtphdrlen; 2436 2437 pj_bzero(&frame_out, sizeof(frame_out)); 2438 frame_out.buf = ((char*)channel->out_pkt) + sizeof(pjmedia_rtp_hdr); 2439 frame_out.size = 0; 2440 2441 create_dtmf_payload(stream, &frame_out, 1, &first, &last); 2442 2443 /* Encapsulate into RTP packet. Note that: 2444 * - RTP marker should be set on the beginning of a new event 2445 * - RTP timestamp is constant for the same packet. 2446 */ 2447 status = pjmedia_rtp_encode_rtp( &channel->rtp, 2448 stream->tx_event_pt, first, 2449 frame_out.size, 0, 2450 (const void**)&rtphdr, 2451 &rtphdrlen); 2452 if (status == PJ_SUCCESS) { 2453 /* Copy RTP header to the beginning of packet */ 2454 pj_memcpy(channel->out_pkt, rtphdr, sizeof(pjmedia_rtp_hdr)); 2455 2456 /* Send the RTP packet to the transport. */ 2457 status = pjmedia_transport_send_rtp(stream->transport, 2458 channel->out_pkt, 2459 frame_out.size + 2460 sizeof(pjmedia_rtp_hdr)); 2461 } 2462 2463 if (status != PJ_SUCCESS) { 2464 PJ_PERROR(4,(stream->port.info.name.ptr, status, 2465 "Error sending RTP/DTMF end packet")); 2466 } 2423 2467 } 2424 2468
Note: See TracChangeset
for help on using the changeset viewer.