Changeset 5978 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
- Timestamp:
- May 6, 2019 10:55:35 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r5944 r5978 1687 1687 1688 1688 on_return: 1689 if (status != PJ_SUCCESS && call_med->tp) { 1690 pjsua_set_media_tp_state(call_med, PJSUA_MED_TP_NULL); 1691 pjmedia_transport_close(call_med->tp); 1692 call_med->tp = NULL; 1693 } 1694 1695 if (sip_err_code) 1696 *sip_err_code = err_code; 1689 if (status != PJ_SUCCESS) { 1690 if (call_med->tp) { 1691 pjsua_set_media_tp_state(call_med, PJSUA_MED_TP_NULL); 1692 pjmedia_transport_close(call_med->tp); 1693 call_med->tp = NULL; 1694 } 1695 1696 if (err_code == 0) 1697 err_code = PJSIP_ERRNO_TO_SIP_STATUS(status); 1698 1699 if (sip_err_code) 1700 *sip_err_code = err_code; 1701 } 1697 1702 1698 1703 if (call_med->med_init_cb) { … … 1783 1788 1784 1789 if (status != PJ_SUCCESS) { 1790 if (sip_err_code) 1791 *sip_err_code = PJSIP_SC_INTERNAL_SERVER_ERROR; 1785 1792 call_med->tp_ready = status; 1786 1793 pjsua_set_media_tp_state(call_med, PJSUA_MED_TP_NULL); … … 1993 2000 1994 2001 if (pjsua_get_state() != PJSUA_STATE_RUNNING) { 1995 if (sip_err_code) *sip_err_code = PJSIP_SC_SERVICE_UNAVAILABLE; 2002 if (sip_err_code) 2003 *sip_err_code = PJSIP_SC_SERVICE_UNAVAILABLE; 1996 2004 return PJ_EBUSY; 1997 2005 } … … 2002 2010 2003 2011 status = pj_mutex_create_simple(tmppool, NULL, &call->med_ch_mutex); 2004 if (status != PJ_SUCCESS) 2012 if (status != PJ_SUCCESS) { 2013 if (sip_err_code) 2014 *sip_err_code = PJSIP_SC_INTERNAL_SERVER_ERROR; 2005 2015 return status; 2016 } 2006 2017 } 2007 2018 … … 2063 2074 if (maudcnt + mvidcnt == 0) { 2064 2075 /* Expecting audio or video in the offer */ 2065 if (sip_err_code) *sip_err_code = PJSIP_SC_NOT_ACCEPTABLE_HERE; 2076 if (sip_err_code) 2077 *sip_err_code = PJSIP_SC_NOT_ACCEPTABLE_HERE; 2066 2078 status = PJSIP_ERRNO_FROM_SIP_STATUS(PJSIP_SC_NOT_ACCEPTABLE_HERE); 2067 2079 goto on_error; … … 2179 2191 if (call->med_prov_cnt == 0) { 2180 2192 /* Expecting at least one media */ 2181 if (sip_err_code) *sip_err_code = PJSIP_SC_NOT_ACCEPTABLE_HERE; 2193 if (sip_err_code) 2194 *sip_err_code = PJSIP_SC_NOT_ACCEPTABLE_HERE; 2182 2195 status = PJSIP_ERRNO_FROM_SIP_STATUS(PJSIP_SC_NOT_ACCEPTABLE_HERE); 2183 2196 goto on_error; … … 2293 2306 2294 2307 status = media_channel_init_cb(call_id, NULL); 2295 if (status != PJ_SUCCESS && sip_err_code) 2296 *sip_err_code = call->med_ch_info.sip_err_code; 2308 if (status != PJ_SUCCESS && sip_err_code) { 2309 if (call->med_ch_info.sip_err_code) 2310 *sip_err_code = call->med_ch_info.sip_err_code; 2311 else 2312 *sip_err_code = PJSIP_ERRNO_TO_SIP_STATUS(status); 2313 } 2297 2314 2298 2315 pj_log_pop_indent(); … … 2304 2321 call->med_ch_mutex = NULL; 2305 2322 } 2323 2324 if (sip_err_code && *sip_err_code == 0) 2325 *sip_err_code = PJSIP_ERRNO_TO_SIP_STATUS(status); 2306 2326 2307 2327 pj_log_pop_indent(); … … 2331 2351 pj_status_t status; 2332 2352 2333 if (pjsua_get_state() != PJSUA_STATE_RUNNING) 2334 return PJ_EBUSY; 2353 if (pjsua_get_state() != PJSUA_STATE_RUNNING) { 2354 status = PJ_EBUSY; 2355 goto on_error; 2356 } 2335 2357 2336 2358 #if 0 … … 2397 2419 &origin, &sdp); 2398 2420 if (status != PJ_SUCCESS) 2399 return status;2421 goto on_error; 2400 2422 2401 2423 /* Process each media line */ … … 2512 2534 default: 2513 2535 pj_assert(!"Invalid call_med media type"); 2514 returnPJ_EBUG;2536 status = PJ_EBUG; 2515 2537 } 2516 2538 2517 2539 if (status != PJ_SUCCESS) 2518 return status;2540 goto on_error; 2519 2541 2520 2542 /* Add ssrc and cname attribute */ … … 2530 2552 if (status != PJ_SUCCESS) { 2531 2553 if (sip_err_code) *sip_err_code = PJSIP_SC_NOT_ACCEPTABLE; 2532 return status;2554 goto on_error; 2533 2555 } 2534 2556 … … 2674 2696 *p_sdp = sdp; 2675 2697 return PJ_SUCCESS; 2698 2699 on_error: 2700 if (sip_err_code && *sip_err_code == 0) 2701 *sip_err_code = PJSIP_SC_INTERNAL_SERVER_ERROR; 2702 2703 return status; 2676 2704 } 2677 2705
Note: See TracChangeset
for help on using the changeset viewer.