Changeset 3632
- Timestamp:
- Jul 13, 2011 3:05:22 AM (13 years ago)
- Location:
- pjproject/branches/projects/2.0-dev
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjsip-apps/src/pjsua/pjsua_app.c
r3629 r3632 3135 3135 3136 3136 /* 3137 * Notification on sound device operation. 3138 */ 3139 static pj_status_t on_snd_dev_operation(int operation) 3140 { 3141 PJ_LOG(3,(THIS_FILE, "Turning sound device %s", (operation? "ON":"OFF"))); 3142 return PJ_SUCCESS; 3143 } 3144 3145 /* 3137 3146 * Print buddy list. 3138 3147 */ … … 5052 5061 app_config.cfg.cb.on_transport_state = &on_transport_state; 5053 5062 app_config.cfg.cb.on_ice_transport_error = &on_ice_transport_error; 5063 app_config.cfg.cb.on_snd_dev_operation = &on_snd_dev_operation; 5054 5064 app_config.log_cfg.cb = log_cb; 5055 5065 -
pjproject/branches/projects/2.0-dev/pjsip/include/pjsua-lib/pjsua.h
r3609 r3632 962 962 pj_status_t status, void *param); 963 963 964 /** 965 * Callback when the sound device is about to be opened or closed. 966 * This callback will be called even when null sound device or no 967 * sound device is configured by the application (i.e. the 968 * #pjsua_set_null_snd_dev() and #pjsua_set_no_snd_dev() APIs). 969 * This API is mostly useful when the application wants to manage 970 * the sound device by itself (i.e. with #pjsua_set_no_snd_dev()), 971 * to get notified when it should open or close the sound device. 972 * 973 * @param operation The value will be set to 0 to signal that sound 974 * device is about to be closed, and 1 to be opened. 975 * 976 * @return The callback must return PJ_SUCCESS at the moment. 977 */ 978 pj_status_t (*on_snd_dev_operation)(int operation); 979 980 964 981 } pjsua_callback; 965 982 -
pjproject/branches/projects/2.0-dev/pjsip/include/pjsua-lib/pjsua_internal.h
r3629 r3632 401 401 pjmedia_master_port *null_snd; /**< Master port for null sound. */ 402 402 pjmedia_port *null_port; /**< Null port. */ 403 403 pj_bool_t snd_is_on; /**< Media flow is currently active */ 404 404 405 405 /* Video device */ -
pjproject/branches/projects/2.0-dev/pjsip/src/pjsua-lib/pjsua_media.c
r3629 r3632 377 377 * It is idle when there is no port connection in the bridge and 378 378 * there is no active call. 379 * 380 * Note: this block is now valid if no snd dev is used because of #1299 379 381 */ 380 if ((pjsua_var.snd_port!=NULL || pjsua_var.null_snd!=NULL) && 382 if ((pjsua_var.snd_port!=NULL || pjsua_var.null_snd!=NULL || 383 pjsua_var.no_snd) && 381 384 pjsua_var.snd_idle_timer.id == PJ_FALSE && 382 385 pjmedia_conf_get_connect_count(pjsua_var.mconf) == 0 && … … 2422 2425 } 2423 2426 } 2427 } else if (pjsua_var.no_snd) { 2428 if (!pjsua_var.snd_is_on) { 2429 pjsua_var.snd_is_on = PJ_TRUE; 2430 /* Notify app */ 2431 if (pjsua_var.ua_cfg.cb.on_snd_dev_operation) { 2432 (*pjsua_var.ua_cfg.cb.on_snd_dev_operation)(1); 2433 } 2434 } 2424 2435 } 2425 2436 … … 2438 2449 return status; 2439 2450 } 2440 } 2441 2451 } else if (pjsua_var.no_snd && !pjsua_var.snd_is_on) { 2452 pjsua_var.snd_is_on = PJ_TRUE; 2453 /* Notify app */ 2454 if (pjsua_var.ua_cfg.cb.on_snd_dev_operation) { 2455 (*pjsua_var.ua_cfg.cb.on_snd_dev_operation)(1); 2456 } 2457 } 2442 2458 } 2443 2459 … … 3093 3109 /* Close existing sound port */ 3094 3110 close_snd_dev(); 3111 3112 /* Notify app */ 3113 if (pjsua_var.ua_cfg.cb.on_snd_dev_operation) { 3114 (*pjsua_var.ua_cfg.cb.on_snd_dev_operation)(1); 3115 } 3095 3116 3096 3117 /* Create memory pool for sound device. */ … … 3230 3251 static void close_snd_dev(void) 3231 3252 { 3253 /* Notify app */ 3254 if (pjsua_var.snd_is_on && pjsua_var.ua_cfg.cb.on_snd_dev_operation) { 3255 (*pjsua_var.ua_cfg.cb.on_snd_dev_operation)(0); 3256 } 3257 3232 3258 /* Close sound device */ 3233 3259 if (pjsua_var.snd_port) { … … 3263 3289 pj_pool_release(pjsua_var.snd_pool); 3264 3290 pjsua_var.snd_pool = NULL; 3291 pjsua_var.snd_is_on = PJ_FALSE; 3265 3292 } 3266 3293 … … 3325 3352 3326 3353 pjsua_var.no_snd = PJ_FALSE; 3354 pjsua_var.snd_is_on = PJ_TRUE; 3327 3355 3328 3356 return PJ_SUCCESS; … … 3359 3387 /* Close existing sound device */ 3360 3388 close_snd_dev(); 3389 3390 /* Notify app */ 3391 if (pjsua_var.ua_cfg.cb.on_snd_dev_operation) { 3392 (*pjsua_var.ua_cfg.cb.on_snd_dev_operation)(1); 3393 } 3361 3394 3362 3395 /* Create memory pool for sound device. */ … … 3389 3422 3390 3423 pjsua_var.no_snd = PJ_FALSE; 3424 pjsua_var.snd_is_on = PJ_TRUE; 3391 3425 3392 3426 return PJ_SUCCESS;
Note: See TracChangeset
for help on using the changeset viewer.