summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2012-08-31 10:07:05 +0000
committerBenny Prijono <bennylp@teluu.com>2012-08-31 10:07:05 +0000
commit3817d543314d665fdf11a9aa6a120fb50ec34b93 (patch)
treed602297aeff4fd07af2dae60e156738b50e0aec2 /pjsip
parentdad923e5aeb73776b86e5f2ff7b6bc5cdad2ffd8 (diff)
Fixed #1578: Possible deadlock when call is adding new media with ICE and STUN enabled:
svn commit pjsip/src/pjsua-lib/pjsua_media.c -m Fixed git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4242 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/src/pjsua-lib/pjsua_media.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c
index 9dc944dd..c4504752 100644
--- a/pjsip/src/pjsua-lib/pjsua_media.c
+++ b/pjsip/src/pjsua-lib/pjsua_media.c
@@ -526,21 +526,29 @@ on_error:
static void med_tp_timer_cb(void *user_data)
{
pjsua_call_media *call_med = (pjsua_call_media*)user_data;
- pjsua_call *call = NULL;
- pjsip_dialog *dlg = NULL;
if (call_med->call == NULL)
return;
- acquire_call("med_tp_timer_cb", call_med->call->index, &call, &dlg);
-
+ /* No need to acquire_call() if we only change the tp_ready flag
+ * (i.e. transport is being created synchronously). Otherwise
+ * calling acquire_call() here may cause deadlock. See
+ * https://trac.pjsip.org/repos/ticket/1578
+ */
call_med->tp_ready = call_med->tp_result;
- if (call_med->med_create_cb)
+
+ if (call_med->med_create_cb) {
+ pjsua_call *call = NULL;
+ pjsip_dialog *dlg = NULL;
+
+ acquire_call("med_tp_timer_cb", call_med->call->index, &call, &dlg);
+
(*call_med->med_create_cb)(call_med, call_med->tp_ready,
call_med->call->secure_level, NULL);
- if (dlg)
- pjsip_dlg_dec_lock(dlg);
+ if (dlg)
+ pjsip_dlg_dec_lock(dlg);
+ }
}
/* This callback is called when ICE negotiation completes */