- Timestamp:
- Jan 22, 2008 10:31:13 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/users/nanang/pjmedia/src/pjmedia/transport_srtp.c
r1724 r1726 182 182 }; 183 183 184 char * octet_string_hex_string(const void *s, int length);185 186 187 184 const char* get_libsrtp_errstr(int err) 188 185 { … … 344 341 } 345 342 346 status = pj_lock_create_ null_mutex(pool, pool->obj_name, &srtp->mutex);343 status = pj_lock_create_recursive_mutex(pool, pool->obj_name, &srtp->mutex); 347 344 if (status != PJ_SUCCESS) { 348 345 pj_pool_release(pool); … … 634 631 635 632 if (srtp->bypass_srtp) 636 return pjmedia_transport_send_rt p(srtp->real_tp, pkt, size);633 return pjmedia_transport_send_rtcp(srtp->real_tp, pkt, size); 637 634 638 635 if (!srtp->session_inited) … … 673 670 pj_status_t status; 674 671 675 pj_lock_ destroy(srtp->mutex);672 pj_lock_acquire(srtp->mutex); 676 673 677 674 pjmedia_transport_detach(tp, NULL); … … 683 680 status = pjmedia_transport_srtp_stop(tp); 684 681 682 pj_lock_release(srtp->mutex); 683 684 pj_lock_destroy(srtp->mutex); 685 685 pj_pool_release(srtp->pool); 686 686 … … 714 714 srtp->rtp_cb(srtp->user_data, srtp->rx_buffer, len); 715 715 } else { 716 PJ_LOG(5, (THIS_FILE, "Failed to unprotect SRTP")); 716 PJ_LOG(5, (THIS_FILE, "Failed to unprotect SRTP size=%d, err=%d", 717 size, err)); 717 718 } 718 719 … … 746 747 srtp->rtcp_cb(srtp->user_data, srtp->rx_buffer, len); 747 748 } else { 748 PJ_LOG(5, (THIS_FILE, "Failed to unprotect SRTCP")); 749 PJ_LOG(5, (THIS_FILE, "Failed to unprotect SRTCP size=%d, err=%d", 750 size, err)); 749 751 } 750 752 … … 798 800 799 801 } while (!key_ok); 800 key[crypto_suites[cs_idx].cipher_key_len] = '\0'; 801 pj_strdup2(pool, &crypto->key, key); 802 crypto->key.ptr = pj_pool_zalloc(pool, 803 crypto_suites[cs_idx].cipher_key_len); 804 pj_memcpy(crypto->key.ptr, key, crypto_suites[cs_idx].cipher_key_len); 805 crypto->key.slen = crypto_suites[cs_idx].cipher_key_len; 802 806 } 803 807 … … 965 969 /* Offer crypto-suites based on setting. */ 966 970 buffer_len = MAXLEN; 967 status = generate_crypto_attr_value( pool, buffer, &buffer_len,971 status = generate_crypto_attr_value(srtp->pool, buffer, &buffer_len, 968 972 &srtp->setting.crypto[i], 969 973 i+1); … … 974 978 if (buffer_len) { 975 979 pj_strset(&attr_value, buffer, buffer_len); 976 attr = pjmedia_sdp_attr_create( pool, ID_CRYPTO.ptr,980 attr = pjmedia_sdp_attr_create(srtp->pool, ID_CRYPTO.ptr, 977 981 &attr_value); 978 982 m_loc->attr[m_loc->attr_count++] = attr; … … 1002 1006 has_crypto_attr = PJ_TRUE; 1003 1007 1004 status = parse_attr_crypto( pool, m_rem->attr[i],1008 status = parse_attr_crypto(srtp->pool, m_rem->attr[i], 1005 1009 &tmp_rx_crypto, &tags[cr_attr_count]); 1006 1010 if (status != PJ_SUCCESS) … … 1022 1026 { 1023 1027 int cs_idx = get_crypto_idx(&tmp_rx_crypto.name); 1028 1029 /* Force to use test key */ 1030 //char *hex_test_key = "58b29c5c8f42308120ce857e439f2d" 1031 // "7810a8b10ad0b1446be5470faea496"; 1032 //pj_str_t* test_key = &srtp->setting.crypto[j].key; 1033 //char *raw_test_key = pj_pool_zalloc(srtp->pool, 64); 1034 //hex_string_to_octet_string( 1035 // raw_test_key, 1036 // hex_test_key, 1037 // strlen(hex_test_key)); 1038 //pj_strset(test_key, raw_test_key, 1039 // crypto_suites[cs_idx].cipher_key_len); 1024 1040 1025 1041 if (tmp_rx_crypto.key.slen != … … 1070 1086 */ 1071 1087 buffer_len = MAXLEN; 1072 status = generate_crypto_attr_value( pool, buffer, &buffer_len,1088 status = generate_crypto_attr_value(srtp->pool, buffer, &buffer_len, 1073 1089 &srtp->tx_policy, 1074 1090 chosen_tag); … … 1079 1095 if (buffer_len) { 1080 1096 pj_strset(&attr_value, buffer, buffer_len); 1081 attr = pjmedia_sdp_attr_create(pool, ID_CRYPTO.ptr, &attr_value); 1097 attr = pjmedia_sdp_attr_create(srtp->pool, ID_CRYPTO.ptr, 1098 &attr_value); 1082 1099 m_loc->attr[m_loc->attr_count++] = attr; 1083 1100 } … … 1162 1179 has_crypto_attr = PJ_TRUE; 1163 1180 1164 status = parse_attr_crypto( pool, m_rem->attr[i],1181 status = parse_attr_crypto(srtp->pool, m_rem->attr[i], 1165 1182 &tmp_tx_crypto, &rem_tag); 1166 1183 if (status != PJ_SUCCESS)
Note: See TracChangeset
for help on using the changeset viewer.