- Timestamp:
- Jul 15, 2011 6:37:07 AM (13 years ago)
- Location:
- pjproject/branches/projects/2.0-dev/pjmedia
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/event.h
r3642 r3653 261 261 /** User data for this subscription */ 262 262 void *user_data; 263 264 /** Current publisher it is subscribed to */ 265 pjmedia_event_publisher *subscribe_to; 263 266 }; 264 267 … … 335 338 336 339 /** 337 * Unsubscribe from the specified publisher. 338 * 339 * @param epub The event publisher. 340 * Unsubscribe the specified subscription object from publisher it is 341 * currently subscribed to. If the subscription object is not currently 342 * subscribed to anything, the function will do nothing. 343 * 340 344 * @param esub The event subscription object, which must be the same 341 345 * object that was given to #pjmedia_event_subscribe(). … … 343 347 * @return PJ_SUCCESS on success or the appropriate error code. 344 348 */ 345 PJ_DECL(pj_status_t) pjmedia_event_unsubscribe(pjmedia_event_publisher *epub,346 349 PJ_DECL(pj_status_t) 350 pjmedia_event_unsubscribe(pjmedia_event_subscription *esub); 347 351 348 352 /** -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/event.c
r3648 r3653 74 74 { 75 75 PJ_ASSERT_RETURN(epub && esub && esub->cb, PJ_EINVAL); 76 /* Must not currently subscribe to anything */ 77 PJ_ASSERT_RETURN(esub->subscribe_to == NULL, PJ_EINVALIDOP); 78 76 79 pj_list_push_back(&epub->subscription_list, esub); 80 esub->subscribe_to = epub; 77 81 return PJ_SUCCESS; 78 82 } 79 83 80 PJ_DEF(pj_status_t) pjmedia_event_unsubscribe( pjmedia_event_publisher *epub, 81 pjmedia_event_subscription *esub) 84 PJ_DEF(pj_status_t) pjmedia_event_unsubscribe(pjmedia_event_subscription *esub) 82 85 { 83 PJ_ASSERT_RETURN(epub && esub, PJ_EINVAL); 84 PJ_ASSERT_RETURN(pj_list_find_node(&epub->subscription_list, esub)==esub, 85 PJ_ENOTFOUND); 86 pj_list_erase(esub); 86 PJ_ASSERT_RETURN(esub, PJ_EINVAL); 87 if (esub->subscribe_to) { 88 PJ_ASSERT_RETURN( 89 pj_list_find_node(&esub->subscribe_to->subscription_list, 90 esub)==esub, PJ_ENOTFOUND); 91 pj_list_erase(esub); 92 esub->subscribe_to = NULL; 93 } 87 94 return PJ_SUCCESS; 88 95 } -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/vid_port.c
r3640 r3653 439 439 440 440 if (vp->client_port) { 441 pjmedia_event_publisher *epub; 442 443 /* Unsubscribe event */ 444 epub = pjmedia_port_get_event_publisher(vp->client_port); 445 if (epub && vp->esub_client_port.user_data) { 446 pjmedia_event_unsubscribe(epub, &vp->esub_client_port); 447 pj_bzero(&vp->esub_client_port, sizeof(vp->esub_client_port)); 448 } 441 pjmedia_event_unsubscribe(&vp->esub_client_port); 449 442 vp->client_port = NULL; 450 443 }
Note: See TracChangeset
for help on using the changeset viewer.