Ignore:
Timestamp:
Jul 16, 2014 4:21:54 AM (10 years ago)
Author:
nanang
Message:

Fix #1777: Problem in audio device list refresh after unregistering an audio device factory.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia-audiodev/audiodev.c

    r4435 r4879  
    276276    pj_status_t status; 
    277277 
    278     if (!refresh) { 
     278    if (!refresh && drv->create) { 
    279279        /* Create the factory */ 
    280280        f = (*drv->create)(aud_subsys.pf); 
     
    291291        f = drv->f; 
    292292    } 
     293 
     294    if (!f) 
     295        return PJ_EUNKNOWN; 
    293296 
    294297    /* Get number of devices */ 
     
    312315 
    313316    /* Fill in default devices */ 
    314     drv->play_dev_idx = drv->rec_dev_idx = drv->dev_idx = -1; 
     317    drv->play_dev_idx = drv->rec_dev_idx = 
     318                        drv->dev_idx = PJMEDIA_AUD_INVALID_DEV; 
    315319    for (i=0; i<dev_cnt; ++i) { 
    316320        pjmedia_aud_dev_info info; 
     
    375379    } 
    376380 
    377     drv->dev_cnt = 0; 
    378     drv->play_dev_idx = drv->rec_dev_idx = drv->dev_idx = -1; 
     381    pj_bzero(drv, sizeof(*drv)); 
     382    drv->play_dev_idx = drv->rec_dev_idx =  
     383                        drv->dev_idx = PJMEDIA_AUD_INVALID_DEV; 
    379384} 
    380385 
     
    492497 
    493498            deinit_driver(i); 
    494             pj_bzero(drv, sizeof(*drv)); 
    495499            return PJ_SUCCESS; 
    496500        } 
Note: See TracChangeset for help on using the changeset viewer.