Changeset 4474
- Timestamp:
- Apr 16, 2013 9:12:59 AM (12 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/endpoint.h
r3999 r4474 150 150 PJ_DECL(pj_thread_t*) pjmedia_endpt_get_thread(pjmedia_endpt *endpt, 151 151 unsigned index); 152 153 /** 154 * Stop and destroy the worker threads of the media endpoint 155 * 156 * @param endpt The media endpoint instance. 157 * 158 * @return PJ_SUCCESS on success. 159 */ 160 PJ_DECL(pj_status_t) pjmedia_endpt_stop_threads(pjmedia_endpt *endpt); 152 161 153 162 -
pjproject/trunk/pjmedia/src/pjmedia/endpoint.c
r4240 r4474 210 210 { 211 211 exit_cb *ecb; 212 213 pjmedia_endpt_stop_threads(endpt); 214 215 /* Destroy internal ioqueue */ 216 if (endpt->ioqueue && endpt->own_ioqueue) { 217 pj_ioqueue_destroy(endpt->ioqueue); 218 endpt->ioqueue = NULL; 219 } 220 221 endpt->pf = NULL; 222 223 pjmedia_codec_mgr_destroy(&endpt->codec_mgr); 224 pjmedia_aud_subsys_shutdown(); 225 226 /* Call all registered exit callbacks */ 227 ecb = endpt->exit_cb_list.next; 228 while (ecb != &endpt->exit_cb_list) { 229 (*ecb->func)(endpt); 230 ecb = ecb->next; 231 } 232 233 pj_pool_release (endpt->pool); 234 235 return PJ_SUCCESS; 236 } 237 238 PJ_DEF(pj_status_t) pjmedia_endpt_set_flag( pjmedia_endpt *endpt, 239 pjmedia_endpt_flag flag, 240 const void *value) 241 { 242 PJ_ASSERT_RETURN(endpt, PJ_EINVAL); 243 244 switch (flag) { 245 case PJMEDIA_ENDPT_HAS_TELEPHONE_EVENT_FLAG: 246 endpt->has_telephone_event = *(pj_bool_t*)value; 247 break; 248 default: 249 return PJ_EINVAL; 250 } 251 252 return PJ_SUCCESS; 253 } 254 255 PJ_DEF(pj_status_t) pjmedia_endpt_get_flag( pjmedia_endpt *endpt, 256 pjmedia_endpt_flag flag, 257 void *value) 258 { 259 PJ_ASSERT_RETURN(endpt, PJ_EINVAL); 260 261 switch (flag) { 262 case PJMEDIA_ENDPT_HAS_TELEPHONE_EVENT_FLAG: 263 *(pj_bool_t*)value = endpt->has_telephone_event; 264 break; 265 default: 266 return PJ_EINVAL; 267 } 268 269 return PJ_SUCCESS; 270 } 271 272 /** 273 * Get the ioqueue instance of the media endpoint. 274 */ 275 PJ_DEF(pj_ioqueue_t*) pjmedia_endpt_get_ioqueue(pjmedia_endpt *endpt) 276 { 277 PJ_ASSERT_RETURN(endpt, NULL); 278 return endpt->ioqueue; 279 } 280 281 /** 282 * Get the number of worker threads in media endpoint. 283 */ 284 PJ_DEF(unsigned) pjmedia_endpt_get_thread_count(pjmedia_endpt *endpt) 285 { 286 PJ_ASSERT_RETURN(endpt, 0); 287 return endpt->thread_cnt; 288 } 289 290 /** 291 * Get a reference to one of the worker threads of the media endpoint 292 */ 293 PJ_DEF(pj_thread_t*) pjmedia_endpt_get_thread(pjmedia_endpt *endpt, 294 unsigned index) 295 { 296 PJ_ASSERT_RETURN(endpt, NULL); 297 PJ_ASSERT_RETURN(index < endpt->thread_cnt, NULL); 298 299 /* here should be an assert on index >= 0 < endpt->thread_cnt */ 300 301 return endpt->thread[index]; 302 } 303 304 /** 305 * Stop and destroy the worker threads of the media endpoint 306 */ 307 PJ_DEF(pj_status_t) pjmedia_endpt_stop_threads(pjmedia_endpt *endpt) 308 { 212 309 unsigned i; 213 310 … … 225 322 } 226 323 227 /* Destroy internal ioqueue */ 228 if (endpt->ioqueue && endpt->own_ioqueue) { 229 pj_ioqueue_destroy(endpt->ioqueue); 230 endpt->ioqueue = NULL; 231 } 232 233 endpt->pf = NULL; 234 235 pjmedia_codec_mgr_destroy(&endpt->codec_mgr); 236 pjmedia_aud_subsys_shutdown(); 237 238 /* Call all registered exit callbacks */ 239 ecb = endpt->exit_cb_list.next; 240 while (ecb != &endpt->exit_cb_list) { 241 (*ecb->func)(endpt); 242 ecb = ecb->next; 243 } 244 245 pj_pool_release (endpt->pool); 246 247 return PJ_SUCCESS; 248 } 249 250 PJ_DEF(pj_status_t) pjmedia_endpt_set_flag( pjmedia_endpt *endpt, 251 pjmedia_endpt_flag flag, 252 const void *value) 253 { 254 PJ_ASSERT_RETURN(endpt, PJ_EINVAL); 255 256 switch (flag) { 257 case PJMEDIA_ENDPT_HAS_TELEPHONE_EVENT_FLAG: 258 endpt->has_telephone_event = *(pj_bool_t*)value; 259 break; 260 default: 261 return PJ_EINVAL; 262 } 263 264 return PJ_SUCCESS; 265 } 266 267 PJ_DEF(pj_status_t) pjmedia_endpt_get_flag( pjmedia_endpt *endpt, 268 pjmedia_endpt_flag flag, 269 void *value) 270 { 271 PJ_ASSERT_RETURN(endpt, PJ_EINVAL); 272 273 switch (flag) { 274 case PJMEDIA_ENDPT_HAS_TELEPHONE_EVENT_FLAG: 275 *(pj_bool_t*)value = endpt->has_telephone_event; 276 break; 277 default: 278 return PJ_EINVAL; 279 } 280 281 return PJ_SUCCESS; 282 } 283 284 /** 285 * Get the ioqueue instance of the media endpoint. 286 */ 287 PJ_DEF(pj_ioqueue_t*) pjmedia_endpt_get_ioqueue(pjmedia_endpt *endpt) 288 { 289 PJ_ASSERT_RETURN(endpt, NULL); 290 return endpt->ioqueue; 291 } 292 293 /** 294 * Get the number of worker threads in media endpoint. 295 */ 296 PJ_DEF(unsigned) pjmedia_endpt_get_thread_count(pjmedia_endpt *endpt) 297 { 298 PJ_ASSERT_RETURN(endpt, 0); 299 return endpt->thread_cnt; 300 } 301 302 /** 303 * Get a reference to one of the worker threads of the media endpoint 304 */ 305 PJ_DEF(pj_thread_t*) pjmedia_endpt_get_thread(pjmedia_endpt *endpt, 306 unsigned index) 307 { 308 PJ_ASSERT_RETURN(endpt, NULL); 309 PJ_ASSERT_RETURN(index < endpt->thread_cnt, NULL); 310 311 /* here should be an assert on index >= 0 < endpt->thread_cnt */ 312 313 return endpt->thread[index]; 324 return PJ_SUCCESS; 314 325 } 315 326 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r4433 r4474 189 189 190 190 if (pjsua_var.med_endpt) { 191 /* Wait for media endpoint's worker threads to quit. */ 192 pjmedia_endpt_stop_threads(pjsua_var.med_endpt); 193 191 194 pjsua_aud_subsys_destroy(); 192 195 }
Note: See TracChangeset
for help on using the changeset viewer.