Changeset 1486


Ignore:
Timestamp:
Oct 7, 2007 7:42:04 AM (17 years ago)
Author:
bennylp
Message:

Ticket #395: Added configuration to control maximum PortAudio? sound buffer latency, and change default sound backend back to WMME

Location:
pjproject/trunk/pjmedia
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/config.h

    r1483 r1486  
    7676 * Specify whether we prefer to use DirectSound on Windows. 
    7777 * 
    78  * Say yes! 
     78 * Default: 0 
    7979 */ 
    8080#ifndef PJMEDIA_PREFER_DIRECT_SOUND 
    81 #   define PJMEDIA_PREFER_DIRECT_SOUND      1 
     81#   define PJMEDIA_PREFER_DIRECT_SOUND      0 
     82#endif 
     83 
     84 
     85/** 
     86 * Specify PortAudio maximum buffering latency, in milliseconds. 
     87 */ 
     88#ifndef PJMEDIA_PASOUND_MAX_LATENCY 
     89#   define PJMEDIA_PASOUND_MAX_LATENCY      60 
    8290#endif 
    8391 
  • pjproject/trunk/pjmedia/src/pjmedia/pasound.c

    r1456 r1486  
    2929#define THIS_FILE       "pasound.c" 
    3030 
     31#define MAX_LATENCY     (PJMEDIA_PASOUND_MAX_LATENCY / 1000.0) 
     32 
    3133static int snd_init_count; 
    3234 
     
    442444    inputParam.sampleFormat = sampleFormat; 
    443445    inputParam.suggestedLatency = paDevInfo->defaultLowInputLatency; 
     446    if (inputParam.suggestedLatency > MAX_LATENCY) 
     447        inputParam.suggestedLatency = MAX_LATENCY; 
    444448 
    445449    paHostApiInfo = Pa_GetHostApiInfo(paDevInfo->hostApi); 
     
    537541    outputParam.hostApiSpecificStreamInfo = NULL; 
    538542    outputParam.sampleFormat = sampleFormat; 
    539     outputParam.suggestedLatency = 1.0 * samples_per_frame / clock_rate;; 
     543    outputParam.suggestedLatency = paDevInfo->defaultLowOutputLatency; 
     544    if (outputParam.suggestedLatency > MAX_LATENCY) 
     545        outputParam.suggestedLatency = MAX_LATENCY; 
    540546 
    541547    paHostApiInfo = Pa_GetHostApiInfo(paDevInfo->hostApi); 
     
    659665    inputParam.sampleFormat = sampleFormat; 
    660666    inputParam.suggestedLatency = paRecDevInfo->defaultLowInputLatency; 
     667    if (inputParam.suggestedLatency > MAX_LATENCY) 
     668        inputParam.suggestedLatency = MAX_LATENCY; 
    661669 
    662670    paRecHostApiInfo = Pa_GetHostApiInfo(paRecDevInfo->hostApi); 
     
    668676    outputParam.sampleFormat = sampleFormat; 
    669677    outputParam.suggestedLatency = paPlayDevInfo->defaultLowOutputLatency; 
     678    if (outputParam.suggestedLatency > MAX_LATENCY) 
     679        outputParam.suggestedLatency = MAX_LATENCY; 
    670680 
    671681    paPlayHostApiInfo = Pa_GetHostApiInfo(paPlayDevInfo->hostApi); 
Note: See TracChangeset for help on using the changeset viewer.