Changeset 3841 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
- Timestamp:
- Oct 24, 2011 9:28:13 AM (13 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk
- Property svn:mergeinfo changed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r3796 r3841 397 397 * Destroy pjsua media subsystem. 398 398 */ 399 pj_status_t pjsua_media_subsys_destroy( void)399 pj_status_t pjsua_media_subsys_destroy(unsigned flags) 400 400 { 401 401 unsigned i; … … 442 442 } 443 443 if (call_med->tp && call_med->tp_auto_del) { 444 /* TODO: check if we're not allowed to send to network in the 445 * "flags", and if so do not do TURN allocation... 446 */ 447 PJ_UNUSED_ARG(flags); 444 448 pjmedia_transport_close(call_med->tp); 445 449 } … … 1295 1299 set_media_tp_state(call_med, PJSUA_MED_TP_IDLE); 1296 1300 1301 if (!call_med->tp_orig && 1302 pjsua_var.ua_cfg.cb.on_create_media_transport) 1303 { 1304 call_med->use_custom_med_tp = PJ_TRUE; 1305 } else 1306 call_med->use_custom_med_tp = PJ_FALSE; 1307 1297 1308 #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 1298 1309 /* This function may be called when SRTP transport already exists 1299 1310 * (e.g: in re-invite, update), don't need to destroy/re-create. 1300 1311 */ 1301 if (!call_med->tp_orig || call_med->tp == call_med->tp_orig) {1312 if (!call_med->tp_orig) { 1302 1313 pjmedia_srtp_setting srtp_opt; 1303 1314 pjmedia_transport *srtp = NULL; … … 1315 1326 pjmedia_srtp_setting_default(&srtp_opt); 1316 1327 srtp_opt.close_member_tp = PJ_TRUE; 1317 /* If media session has been ever established, let's use remote's 1328 /* If media session has been ever established, let's use remote's 1318 1329 * preference in SRTP usage policy, especially when it is stricter. 1319 1330 */ … … 1520 1531 } 1521 1532 1522 status = pjmedia_transport_media_create( 1523 call_med->tp, tmp_pool, 1524 0, call->async_call.rem_sdp, mi); 1533 if (call_med->use_custom_med_tp) { 1534 unsigned custom_med_tp_flags = 0; 1535 1536 /* Use custom media transport returned by the application */ 1537 call_med->tp = 1538 (*pjsua_var.ua_cfg.cb.on_create_media_transport) 1539 (call_id, mi, call_med->tp, 1540 custom_med_tp_flags); 1541 if (!call_med->tp) { 1542 status = 1543 PJSIP_ERRNO_FROM_SIP_STATUS(PJSIP_SC_NOT_ACCEPTABLE); 1544 } 1545 } 1546 1547 if (call_med->tp) { 1548 status = pjmedia_transport_media_create( 1549 call_med->tp, tmp_pool, 1550 0, call->async_call.rem_sdp, mi); 1551 } 1525 1552 if (status != PJ_SUCCESS) { 1526 1553 call->med_ch_info.status = status; … … 2105 2132 PJ_LOG(4,(THIS_FILE, "Media session call%02d:%d is destroyed", 2106 2133 call_id, mi)); 2134 call_med->prev_state = call_med->state; 2107 2135 call_med->state = PJSUA_CALL_MEDIA_NONE; 2108 2136 } … … 2134 2162 pj_log_push_indent(); 2135 2163 2136 stop_media_session(call_id);2137 2138 2164 for (mi=0; mi<call->med_cnt; ++mi) { 2139 2165 pjsua_call_media *call_med = &call->media[mi]; 2140 2166 2141 if (call_med->tp_st > PJSUA_MED_TP_IDLE) { 2167 if (call_med->type == PJMEDIA_TYPE_AUDIO && call_med->strm.a.stream) 2168 pjmedia_stream_send_rtcp_bye(call_med->strm.a.stream); 2169 } 2170 2171 stop_media_session(call_id); 2172 2173 for (mi=0; mi<call->med_cnt; ++mi) { 2174 pjsua_call_media *call_med = &call->media[mi]; 2175 2176 if (call_med->tp_st > PJSUA_MED_TP_IDLE) { 2142 2177 pjmedia_transport_media_stop(call_med->tp); 2143 2178 set_media_tp_state(call_med, PJSUA_MED_TP_IDLE); … … 2154 2189 call_med->tp = call_med->tp_orig = NULL; 2155 2190 } 2191 call_med->tp_orig = NULL; 2156 2192 } 2157 2193 … … 2206 2242 if (status != PJ_SUCCESS) 2207 2243 goto on_return; 2244 2245 si->rtcp_sdes_bye_disabled = PJ_TRUE; 2208 2246 2209 2247 /* Check if no media is active */ … … 2296 2334 goto on_return; 2297 2335 } 2336 2337 if (call_med->prev_state == PJSUA_CALL_MEDIA_NONE) 2338 pjmedia_stream_send_rtcp_sdes(call_med->strm.a.stream); 2298 2339 2299 2340 /* If DTMF callback is installed by application, install our
Note: See TracChangeset
for help on using the changeset viewer.