Changeset 3440


Ignore:
Timestamp:
Mar 15, 2011 3:16:33 AM (11 years ago)
Author:
ming
Message:

Re #1204:

  • Update audio device's list after refreshing the device.
  • Fixed WMME macro.
Location:
pjproject/trunk/pjmedia/src/pjmedia-audiodev
Files:
2 edited

Legend:

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

    r3438 r3440  
    251251 
    252252/* Internal: init driver */ 
    253 static pj_status_t init_driver(unsigned drv_idx) 
     253static pj_status_t init_driver(unsigned drv_idx, pj_bool_t refresh) 
    254254{ 
    255255    struct driver *drv = &aud_subsys.drv[drv_idx]; 
     
    258258    pj_status_t status; 
    259259 
    260     /* Create the factory */ 
    261     f = (*drv->create)(aud_subsys.pf); 
    262     if (!f) 
    263         return PJ_EUNKNOWN; 
    264  
    265     /* Call factory->init() */ 
    266     status = f->op->init(f); 
    267     if (status != PJ_SUCCESS) { 
    268         f->op->destroy(f); 
    269         return status; 
     260    if (!refresh) { 
     261        /* Create the factory */ 
     262        f = (*drv->create)(aud_subsys.pf); 
     263        if (!f) 
     264            return PJ_EUNKNOWN; 
     265 
     266        /* Call factory->init() */ 
     267        status = f->op->init(f); 
     268        if (status != PJ_SUCCESS) { 
     269            f->op->destroy(f); 
     270            return status; 
     271        } 
     272    } else { 
     273        f = drv->f; 
    270274    } 
    271275 
     
    408412    /* Initialize each factory and build the device ID list */ 
    409413    for (i=0; i<aud_subsys.drv_cnt; ++i) { 
    410         status = init_driver(i); 
     414        status = init_driver(i, PJ_FALSE); 
    411415        if (status != PJ_SUCCESS) { 
    412416            deinit_driver(i); 
     
    428432 
    429433    aud_subsys.drv[aud_subsys.drv_cnt].create = adf; 
    430     status = init_driver(aud_subsys.drv_cnt); 
     434    status = init_driver(aud_subsys.drv_cnt, PJ_FALSE); 
    431435    if (status == PJ_SUCCESS) { 
    432436        aud_subsys.drv_cnt++; 
     
    497501    unsigned i; 
    498502     
     503    aud_subsys.dev_cnt = 0; 
    499504    for (i=0; i<aud_subsys.drv_cnt; ++i) { 
    500505        struct driver *drv = &aud_subsys.drv[i]; 
     
    507512            } 
    508513        } 
     514        init_driver(i, PJ_TRUE); 
    509515    } 
    510516    return PJ_SUCCESS; 
  • pjproject/trunk/pjmedia/src/pjmedia-audiodev/wmme_dev.c

    r3438 r3440  
    4040 
    4141#ifndef PJMEDIA_WMME_DEV_USE_MMDEVICE_API 
    42 #   define PJMEDIAWMME_DEV_USE_MMDEVICE_API \ 
     42#   define PJMEDIA_WMME_DEV_USE_MMDEVICE_API \ 
    4343           (defined(_WIN32_WINNT) && (_WIN32_WINNT>=0x0600)) 
    4444#endif 
Note: See TracChangeset for help on using the changeset viewer.