Changeset 3999 for pjproject/trunk/pjmedia/src/pjmedia/endpoint.c
- Timestamp:
- Mar 30, 2012 7:10:13 AM (12 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk
-
pjproject/trunk/pjmedia/src/pjmedia/endpoint.c
r3945 r3999 25 25 #include <pj/assert.h> 26 26 #include <pj/ioqueue.h> 27 #include <pj/lock.h> 27 28 #include <pj/log.h> 28 29 #include <pj/os.h> … … 58 59 59 60 61 /* List of media endpoint exit callback. */ 62 typedef struct exit_cb 63 { 64 PJ_DECL_LIST_MEMBER (struct exit_cb); 65 pjmedia_endpt_exit_callback func; 66 } exit_cb; 67 68 60 69 /** Concrete declaration of media endpoint. */ 61 70 struct pjmedia_endpt … … 87 96 /** Is telephone-event enable */ 88 97 pj_bool_t has_telephone_event; 98 99 /** List of exit callback. */ 100 exit_cb exit_cb_list; 89 101 }; 90 102 … … 130 142 goto on_error; 131 143 144 /* Initialize exit callback list. */ 145 pj_list_init(&endpt->exit_cb_list); 146 132 147 /* Create ioqueue if none is specified. */ 133 148 if (endpt->ioqueue == NULL) { … … 190 205 PJ_DEF(pj_status_t) pjmedia_endpt_destroy (pjmedia_endpt *endpt) 191 206 { 207 exit_cb *ecb; 192 208 unsigned i; 193 209 … … 215 231 pjmedia_codec_mgr_destroy(&endpt->codec_mgr); 216 232 pjmedia_aud_subsys_shutdown(); 233 234 /* Call all registered exit callbacks */ 235 ecb = endpt->exit_cb_list.next; 236 while (ecb != &endpt->exit_cb_list) { 237 (*ecb->func)(endpt); 238 ecb = ecb->next; 239 } 240 217 241 pj_pool_release (endpt->pool); 218 242 … … 435 459 436 460 } else { 437 rtpmap.param.ptr = NULL;461 rtpmap.param.ptr = ""; 438 462 rtpmap.param.slen = 0; 439 463 } … … 897 921 return PJ_SUCCESS; 898 922 } 923 924 PJ_DEF(pj_status_t) pjmedia_endpt_atexit( pjmedia_endpt *endpt, 925 pjmedia_endpt_exit_callback func) 926 { 927 exit_cb *new_cb; 928 929 PJ_ASSERT_RETURN(endpt && func, PJ_EINVAL); 930 931 if (endpt->quit_flag) 932 return PJ_EINVALIDOP; 933 934 new_cb = PJ_POOL_ZALLOC_T(endpt->pool, exit_cb); 935 new_cb->func = func; 936 937 pj_enter_critical_section(); 938 pj_list_push_back(&endpt->exit_cb_list, new_cb); 939 pj_leave_critical_section(); 940 941 return PJ_SUCCESS; 942 }
Note: See TracChangeset
for help on using the changeset viewer.