Ignore:
Timestamp:
Jul 18, 2009 9:21:09 AM (10 years ago)
Author:
bennylp
Message:

Misc (#915): added WAVE_FORMAT_DIRECT flag when opening waveIn/Out in WMME audio dev, hopefully it can reduce latency

File:
1 edited

Legend:

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

    r2557 r2841  
    516516    WAVEFORMATEX wfx;  
    517517    unsigned i, ptime; 
     518    DWORD flag; 
    518519    pj_status_t status; 
    519520 
     
    538539    parent->bytes_per_frame = wfx.nAvgBytesPerSec * ptime / 1000; 
    539540 
     541    flag = CALLBACK_EVENT; 
     542    if (prm->ext_fmt.id == PJMEDIA_FORMAT_L16) 
     543        flag |= WAVE_FORMAT_DIRECT; 
     544 
    540545    /* 
    541546     * Open wave device. 
     
    543548    mr = waveOutOpen(&wmme_strm->hWave.Out,  
    544549                     wf->dev_info[prm->play_id].deviceId, 
    545                      &wfx, (DWORD)wmme_strm->hEvent, 0, CALLBACK_EVENT); 
     550                     &wfx, (DWORD)wmme_strm->hEvent, 0, flag); 
    546551    if (mr != MMSYSERR_NOERROR) { 
    547552        return PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_OUT(mr); 
     
    604609    MMRESULT mr; 
    605610    WAVEFORMATEX wfx;  
     611    DWORD flag; 
    606612    unsigned i, ptime; 
    607613 
     
    624630    parent->bytes_per_frame = wfx.nAvgBytesPerSec * ptime / 1000; 
    625631 
     632    flag = CALLBACK_EVENT; 
     633    if (prm->ext_fmt.id == PJMEDIA_FORMAT_L16) 
     634        flag |= WAVE_FORMAT_DIRECT; 
     635 
    626636    /* 
    627637     * Open wave device. 
     
    629639    mr = waveInOpen(&wmme_strm->hWave.In,  
    630640                    wf->dev_info[prm->rec_id].deviceId,  
    631                     &wfx, (DWORD)wmme_strm->hEvent, 0, CALLBACK_EVENT); 
     641                    &wfx, (DWORD)wmme_strm->hEvent, 0, flag); 
    632642    if (mr != MMSYSERR_NOERROR) { 
    633643        return PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_IN(mr); 
Note: See TracChangeset for help on using the changeset viewer.