Changeset 2064 for pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c
- Timestamp:
- Jun 26, 2008 7:12:09 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c
r2039 r2064 112 112 pjmedia_transport *member_tp; /**< Underlying transport. */ 113 113 114 /* When in SRTP optional mode, instead of always offering RTP/AVP, 115 * we should create offer based on remote preference. At the first time, 116 * remote preference is unknown, it is known after media_start() called. 117 * So next time the same session need to create an offer, it will create 118 * SDP with transport type based on remote preference. 114 /* SRTP usage policy of peer. This field is updated when media is starting. 115 * This is useful when SRTP is in optional mode and peer is using mandatory 116 * mode, so when local is about to reinvite/update, it should offer 117 * RTP/SAVP instead of offering RTP/AVP. 119 118 */ 120 pj _bool_t remote_prefer_rtp_savp;119 pjmedia_srtp_use peer_use; 121 120 122 121 } transport_srtp; … … 349 348 srtp->session_inited = PJ_FALSE; 350 349 srtp->bypass_srtp = PJ_FALSE; 351 srtp-> remote_prefer_rtp_savp = PJ_FALSE;350 srtp->peer_use = opt->use; 352 351 353 352 if (opt) { … … 587 586 srtp_info.rx_policy = srtp->rx_policy; 588 587 srtp_info.tx_policy = srtp->tx_policy; 588 srtp_info.use = srtp->setting.use; 589 srtp_info.peer_use = srtp->peer_use; 589 590 590 591 spc_info_idx = info->specific_info_cnt++; … … 1077 1078 goto BYPASS_SRTP; 1078 1079 case PJMEDIA_SRTP_OPTIONAL: 1079 m_loc->desc.transport = srtp->remote_prefer_rtp_savp? 1080 ID_RTP_SAVP : ID_RTP_AVP; 1080 m_loc->desc.transport = 1081 (srtp->peer_use == PJMEDIA_SRTP_MANDATORY)? 1082 ID_RTP_SAVP : ID_RTP_AVP; 1081 1083 break; 1082 1084 case PJMEDIA_SRTP_MANDATORY: … … 1284 1286 m_loc = sdp_local->media[media_index]; 1285 1287 1286 srtp->remote_prefer_rtp_savp = (pj_stricmp(&m_rem->desc.transport, 1287 &ID_RTP_SAVP) == 0); 1288 if (pj_stricmp(&m_rem->desc.transport, &ID_RTP_SAVP) == 0) 1289 srtp->peer_use = PJMEDIA_SRTP_MANDATORY; 1290 else 1291 srtp->peer_use = PJMEDIA_SRTP_OPTIONAL; 1288 1292 1289 1293 /* For answerer side, this function will just have to start SRTP */ … … 1383 1387 BYPASS_SRTP: 1384 1388 srtp->bypass_srtp = PJ_TRUE; 1389 srtp->peer_use = PJMEDIA_SRTP_DISABLED; 1385 1390 1386 1391 PROPAGATE_MEDIA_START:
Note: See TracChangeset
for help on using the changeset viewer.