diff options
author | Liong Sauw Ming <ming@teluu.com> | 2012-01-09 11:51:56 +0000 |
---|---|---|
committer | Liong Sauw Ming <ming@teluu.com> | 2012-01-09 11:51:56 +0000 |
commit | ca35d13e6b2018cf6c5423bda2c0c59122aac7f0 (patch) | |
tree | a661020f7d3ababf80abf54c074cf324dc89ce31 /pjsip/src/pjsua-lib/pjsua_media.c | |
parent | 4e026426606ca3ac4d438284ca70326ed7ffc2fe (diff) |
Fixes #1442: Unable to make call if disabled media is included
Add an API pjsua_schedule_timer2() to allow application to schedule a callback function to be executed after a specified time interval. This enables app to post a delayed job which, in this case, allows the initialization of all media transport creations to finish first before we get the media transport creations result.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3938 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib/pjsua_media.c')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_media.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c index 7665e751..66cecf58 100644 --- a/pjsip/src/pjsua-lib/pjsua_media.c +++ b/pjsip/src/pjsua-lib/pjsua_media.c @@ -766,6 +766,20 @@ on_error: } #endif +static void med_tp_timer_cb(void *user_data) +{ + pjsua_call_media *call_med = (pjsua_call_media*)user_data; + + PJSUA_LOCK(); + + call_med->tp_ready = call_med->tp_result; + if (call_med->med_create_cb) + (*call_med->med_create_cb)(call_med, call_med->tp_ready, + call_med->call->secure_level, NULL); + + PJSUA_UNLOCK(); +} + /* This callback is called when ICE negotiation completes */ static void on_ice_complete(pjmedia_transport *tp, pj_ice_strans_op op, @@ -778,12 +792,8 @@ static void on_ice_complete(pjmedia_transport *tp, switch (op) { case PJ_ICE_STRANS_OP_INIT: - PJSUA_LOCK(); - call_med->tp_ready = result; - if (call_med->med_create_cb) - (*call_med->med_create_cb)(call_med, result, - call_med->call->secure_level, NULL); - PJSUA_UNLOCK(); + call_med->tp_result = result; + pjsua_schedule_timer2(&med_tp_timer_cb, call_med, 1); break; case PJ_ICE_STRANS_OP_NEGOTIATION: if (result != PJ_SUCCESS) { @@ -1538,9 +1548,7 @@ static pj_status_t media_channel_init_cb(pjsua_call_id call_id, for (mi=0; mi < call->med_cnt; ++mi) { pjsua_call_media *call_med = &call->media[mi]; - if (call_med->med_init_cb || - call_med->tp_st == PJSUA_MED_TP_NULL) - { + if (call_med->med_init_cb) { pj_mutex_unlock(call->med_ch_mutex); return PJ_SUCCESS; } |