Changeset 5618 for pjproject/trunk/pjsip-apps/src/samples/vid_streamutil.c
- Timestamp:
- Jul 4, 2017 1:00:42 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/samples/vid_streamutil.c
r5311 r5618 109 109 const pjmedia_vid_codec_param *codec_param); 110 110 111 /* Prototype for LIBSRTP utility in file datatypes.c */ 112 int hex_string_to_octet_string(char *raw, char *hex, int len); 111 /* Hexa string to octet array */ 112 int my_hex_string_to_octet_string(char *raw, char *hex, int len) 113 { 114 int i; 115 for (i = 0; i < len; i+=2) { 116 int tmp; 117 if (i+1 >= len || !pj_isxdigit(hex[i]) || !pj_isxdigit(hex[i+1])) 118 return i; 119 tmp = pj_hex_digit_to_val((unsigned char)hex[i]) << 4; 120 tmp |= pj_hex_digit_to_val((unsigned char)hex[i+1]); 121 raw[i/2] = (char)(tmp & 0xFF); 122 } 123 return len; 124 } 113 125 114 126 /* … … 506 518 507 519 case OPT_SRTP_TX_KEY: 508 tmp_key_len = hex_string_to_octet_string(tmp_tx_key, pj_optarg,509 (int)strlen(pj_optarg));520 tmp_key_len = my_hex_string_to_octet_string(tmp_tx_key, pj_optarg, 521 (int)strlen(pj_optarg)); 510 522 pj_strset(&srtp_tx_key, tmp_tx_key, tmp_key_len/2); 511 523 break; 512 524 513 525 case OPT_SRTP_RX_KEY: 514 tmp_key_len = hex_string_to_octet_string(tmp_rx_key, pj_optarg,515 (int)strlen(pj_optarg));526 tmp_key_len = my_hex_string_to_octet_string(tmp_rx_key, pj_optarg, 527 (int)strlen(pj_optarg)); 516 528 pj_strset(&srtp_rx_key, tmp_rx_key, tmp_key_len/2); 517 529 break;
Note: See TracChangeset
for help on using the changeset viewer.