From ca35d13e6b2018cf6c5423bda2c0c59122aac7f0 Mon Sep 17 00:00:00 2001 From: Liong Sauw Ming Date: Mon, 9 Jan 2012 11:51:56 +0000 Subject: 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 --- pjsip/include/pjsua-lib/pjsua.h | 16 +++++++++++++++- pjsip/include/pjsua-lib/pjsua_internal.h | 11 +++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) (limited to 'pjsip/include') diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h index c9f4eb6d..698dde3d 100644 --- a/pjsip/include/pjsua-lib/pjsua.h +++ b/pjsip/include/pjsua-lib/pjsua.h @@ -1996,7 +1996,7 @@ PJ_DECL(pj_status_t) pjsua_verify_url(const char *url); * not. * * @param entry Timer heap entry. - * @param delay The interval to expire. + * @param delay The interval to expire. * * @return PJ_SUCCESS on success, or the appropriate error code. * @@ -2005,6 +2005,20 @@ PJ_DECL(pj_status_t) pjsua_verify_url(const char *url); PJ_DECL(pj_status_t) pjsua_schedule_timer(pj_timer_entry *entry, const pj_time_val *delay); +/** + * Schedule a callback function to be called after a specified time interval. + * Note that the callback may be executed by different thread, depending on + * whether worker thread is enabled or not. + * + * @param cb The callback function. + * @param user_data The user data. + * @param msec_delay The time interval in msec. + * + * @return PJ_SUCCESS on success, or the appropriate error code. + */ +PJ_DECL(pj_status_t) pjsua_schedule_timer2(void (*cb)(void *user_data), + void *user_data, + unsigned msec_delay); /** * Cancel the previously scheduled timer. diff --git a/pjsip/include/pjsua-lib/pjsua_internal.h b/pjsip/include/pjsua-lib/pjsua_internal.h index ec236197..99937d3e 100644 --- a/pjsip/include/pjsua-lib/pjsua_internal.h +++ b/pjsip/include/pjsua-lib/pjsua_internal.h @@ -76,6 +76,7 @@ struct pjsua_call_media pjmedia_transport *tp; /**< Current media transport (can be 0) */ pj_status_t tp_ready; /**< Media transport status. */ + pj_status_t tp_result; /**< Media transport creation result. */ pjmedia_transport *tp_orig; /**< Original media transport */ pj_bool_t tp_auto_del; /**< May delete media transport */ pjsua_med_tp_st tp_st; /**< Media transport state */ @@ -456,6 +457,16 @@ struct pjsua_data #if PJSUA_HAS_VIDEO pjsua_vid_win win[PJSUA_MAX_VID_WINS]; /**< Array of windows */ #endif + + /* Timer entry list */ + struct timer_list + { + PJ_DECL_LIST_MEMBER(struct timer_list); + pj_timer_entry entry; + void (*cb)(void *user_data); + void *user_data; + } timer_list; + pj_mutex_t *timer_mutex; }; -- cgit v1.2.3