Changeset 2758 for pjproject


Ignore:
Timestamp:
Jun 12, 2009 11:15:08 AM (15 years ago)
Author:
nanang
Message:

Ticket #882: Added check of active call count before auto-close sound device.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c

    r2742 r2758  
    496496static void check_snd_dev_idle() 
    497497{ 
     498    unsigned call_cnt; 
     499 
     500    /* Get the call count, we shouldn't close the sound device when there is 
     501     * any calls active. 
     502     */ 
     503    call_cnt = pjsua_call_get_count(); 
     504 
     505    /* When this function is called from pjsua_media_channel_deinit() upon 
     506     * disconnecting call, actually the call count hasn't been updated/ 
     507     * decreased. So we put additional check here, if there is only one 
     508     * call and it's in DISCONNECTED state, there is actually no active 
     509     * call. 
     510     */ 
     511    if (call_cnt == 1) { 
     512        pjsua_call_id call_id; 
     513        pj_status_t status; 
     514 
     515        status = pjsua_enum_calls(&call_id, &call_cnt); 
     516        if (status == PJ_SUCCESS && call_cnt > 0 && 
     517            !pjsua_call_is_active(call_id)) 
     518        { 
     519            call_cnt = 0; 
     520        } 
     521    } 
    498522 
    499523    /* Activate sound device auto-close timer if sound device is idle. 
    500      * It is idle when there is no port connection in the bridge. 
     524     * It is idle when there is no port connection in the bridge and 
     525     * there is no active call. 
    501526     */ 
    502527    if ((pjsua_var.snd_port!=NULL || pjsua_var.null_snd!=NULL) &&  
    503528        pjsua_var.snd_idle_timer.id == PJ_FALSE && 
    504529        pjmedia_conf_get_connect_count(pjsua_var.mconf) == 0 && 
     530        call_cnt == 0 && 
    505531        pjsua_var.media_cfg.snd_auto_close_time >= 0) 
    506532    { 
Note: See TracChangeset for help on using the changeset viewer.