summaryrefslogtreecommitdiff
path: root/pjsip/src/pjsua-lib/pjsua_call.c
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2012-04-24 05:40:32 +0000
committerNanang Izzuddin <nanang@teluu.com>2012-04-24 05:40:32 +0000
commit603594518c4cbe3c564df98e3cd86f34b89e5971 (patch)
tree37acdb3307a94d23e1d834b304570a7cad3b4757 /pjsip/src/pjsua-lib/pjsua_call.c
parentd73368a020b5723e58b529f0ed6401459b7750b3 (diff)
Fix #1423:
- Added provisional media in call for generating initial and subsequent SDP offer/answer. If a reoffer is rejected by peer, the main call media will remain unchanged and the provisional media will be cleaned up (the cleanup is currently delayed until call gets destroyed or another reoffer/answer occurs). - Reenabled media transport dump in pjsua_core.c. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4071 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib/pjsua_call.c')
-rw-r--r--pjsip/src/pjsua-lib/pjsua_call.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index b8cf6b37..6dc49fdf 100644
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -544,9 +544,12 @@ static pj_status_t apply_call_setting(pjsua_call *call,
old_opt = call->opt;
call->opt = *opt;
- /* Reinit media channel when media count is changed */
- if (opt->aud_cnt != old_opt.aud_cnt ||
- opt->vid_cnt != old_opt.vid_cnt)
+ /* Reinit media channel when media count is changed or we are the
+ * answerer (as remote offer may 'extremely' modify the existing
+ * media session, e.g: media type order).
+ */
+ if (rem_sdp ||
+ opt->aud_cnt!=old_opt.aud_cnt || opt->vid_cnt!=old_opt.vid_cnt)
{
pjsip_role_e role = rem_sdp? PJSIP_ROLE_UAS : PJSIP_ROLE_UAC;
status = pjsua_media_channel_init(call->index, role,
@@ -1198,7 +1201,6 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata)
/* Can't terminate dialog because transaction is in progress.
pjsip_dlg_terminate(dlg);
*/
- pjsua_media_channel_deinit(call->index);
goto on_return;
}
@@ -1317,6 +1319,7 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata)
status = pjsip_inv_send_msg(inv, response);
if (status != PJ_SUCCESS) {
pjsua_perror(THIS_FILE, "Unable to send 100 response", status);
+ pjsua_media_channel_deinit(call->index);
goto on_return;
}
}
@@ -3224,6 +3227,9 @@ static void pjsua_call_on_media_update(pjsip_inv_session *inv,
pjsua_perror(THIS_FILE, "SDP negotiation has failed", status);
+ /* Clean up provisional media */
+ pjsua_media_prov_clean_up(call->index);
+
/* Do not deinitialize media since this may be a re-INVITE or
* UPDATE (which in this case the media should not get affected
* by the failed re-INVITE/UPDATE). The media will be shutdown
@@ -3427,17 +3433,11 @@ static void pjsua_call_on_rx_offer(pjsip_inv_session *inv,
call->opt = opt;
}
-
+
/* Re-init media for the new remote offer before creating SDP */
- status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAS,
- call->secure_level,
- call->inv->pool_prov,
- offer, NULL,
- PJ_FALSE, NULL);
- if (status != PJ_SUCCESS) {
- pjsua_perror(THIS_FILE, "Error re-initializing media channel", status);
+ status = apply_call_setting(call, &call->opt, offer);
+ if (status != PJ_SUCCESS)
goto on_return;
- }
status = pjsua_media_channel_create_sdp(call->index,
call->inv->pool_prov,