Changeset 2144
- Timestamp:
- Jul 14, 2008 6:36:50 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c
r2099 r2144 34 34 35 35 /* Maximum size of packet */ 36 #define MAX_BUFFER_LEN 1500 37 #define MAX_KEY_LEN 32 38 #define DEACTIVATE_MEDIA(pool, m) pjmedia_sdp_media_deactivate(pool, m) 36 #define MAX_RTP_BUFFER_LEN 1500 37 #define MAX_RTCP_BUFFER_LEN 1500 38 #define MAX_KEY_LEN 32 39 #define DEACTIVATE_MEDIA(pool, m) pjmedia_sdp_media_deactivate(pool, m) 39 40 40 41 static const pj_str_t ID_RTP_AVP = { "RTP/AVP", 7 }; … … 79 80 pj_pool_t *pool; 80 81 pj_lock_t *mutex; 81 char tx_buffer[MAX_BUFFER_LEN]; 82 char rtp_tx_buffer[MAX_RTP_BUFFER_LEN]; 83 char rtcp_tx_buffer[MAX_RTCP_BUFFER_LEN]; 82 84 pjmedia_srtp_setting setting; 83 85 unsigned media_option; … … 657 659 return PJ_SUCCESS; 658 660 659 if (size > sizeof(srtp-> tx_buffer))661 if (size > sizeof(srtp->rtp_tx_buffer)) 660 662 return PJ_ETOOBIG; 661 663 664 pj_memcpy(srtp->rtp_tx_buffer, pkt, size); 665 662 666 pj_lock_acquire(srtp->mutex); 663 pj_memcpy(srtp->tx_buffer, pkt, size);664 665 err = srtp_protect(srtp->srtp_tx_ctx, srtp->tx_buffer, &len); 667 err = srtp_protect(srtp->srtp_tx_ctx, srtp->rtp_tx_buffer, &len); 668 pj_lock_release(srtp->mutex); 669 666 670 if (err == err_status_ok) { 667 status = pjmedia_transport_send_rtp(srtp->member_tp, srtp-> tx_buffer, len);671 status = pjmedia_transport_send_rtp(srtp->member_tp, srtp->rtp_tx_buffer, len); 668 672 } else { 669 673 status = PJMEDIA_ERRNO_FROM_LIBSRTP(err); 670 674 } 671 675 672 pj_lock_release(srtp->mutex);673 674 676 return status; 675 677 } … … 701 703 return PJ_SUCCESS; 702 704 703 if (size > sizeof(srtp-> tx_buffer))705 if (size > sizeof(srtp->rtcp_tx_buffer)) 704 706 return PJ_ETOOBIG; 705 707 708 pj_memcpy(srtp->rtcp_tx_buffer, pkt, size); 709 706 710 pj_lock_acquire(srtp->mutex); 707 pj_memcpy(srtp->tx_buffer, pkt, size); 708 709 err = srtp_protect_rtcp(srtp->srtp_tx_ctx, srtp->tx_buffer, &len); 710 711 err = srtp_protect_rtcp(srtp->srtp_tx_ctx, srtp->rtcp_tx_buffer, &len); 712 pj_lock_release(srtp->mutex); 713 711 714 if (err == err_status_ok) { 712 715 status = pjmedia_transport_send_rtcp2(srtp->member_tp, addr, addr_len, 713 srtp-> tx_buffer, len);716 srtp->rtcp_tx_buffer, len); 714 717 } else { 715 718 status = PJMEDIA_ERRNO_FROM_LIBSRTP(err); 716 719 } 717 718 pj_lock_release(srtp->mutex);719 720 720 721 return status;
Note: See TracChangeset
for help on using the changeset viewer.