wasapi: fixed full-duplex failure (when host sample types differ) due to incorrect check made on I/O host buffer sizes

This commit is contained in:
dmitrykos 2010-06-10 09:45:54 +00:00
commit 5444956b5c

View file

@ -2185,6 +2185,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
PaTime buffer_latency; PaTime buffer_latency;
ULONG framesPerHostCallback; ULONG framesPerHostCallback;
PaUtilHostBufferSizeMode bufferMode; PaUtilHostBufferSizeMode bufferMode;
const BOOL fullDuplex = ((inputParameters != NULL) && (outputParameters != NULL));
// validate PaStreamParameters // validate PaStreamParameters
if ((result = IsStreamParamsValid(hostApi, inputParameters, outputParameters, sampleRate)) != paNoError) if ((result = IsStreamParamsValid(hostApi, inputParameters, outputParameters, sampleRate)) != paNoError)
@ -2265,7 +2266,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
if ((inputStreamInfo != NULL) && (inputStreamInfo->flags & paWinWasapiPolling)) if ((inputStreamInfo != NULL) && (inputStreamInfo->flags & paWinWasapiPolling))
stream->in.streamFlags = 0; // polling interface stream->in.streamFlags = 0; // polling interface
else else
if (outputParameters != NULL) if (fullDuplex)
stream->in.streamFlags = 0; // polling interface is implemented for full-duplex mode also stream->in.streamFlags = 0; // polling interface is implemented for full-duplex mode also
// Create Audio client // Create Audio client
@ -2379,7 +2380,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
if ((outputStreamInfo != NULL) && (outputStreamInfo->flags & paWinWasapiPolling)) if ((outputStreamInfo != NULL) && (outputStreamInfo->flags & paWinWasapiPolling))
stream->out.streamFlags = 0; // polling interface stream->out.streamFlags = 0; // polling interface
else else
if (inputParameters != NULL) if (fullDuplex)
stream->out.streamFlags = 0; // polling interface is implemented for full-duplex mode also stream->out.streamFlags = 0; // polling interface is implemented for full-duplex mode also
// Create Audio client // Create Audio client
@ -2455,8 +2456,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
outputSampleFormat = hostOutputSampleFormat = paInt16; /* Surpress 'uninitialized var' warnings. */ outputSampleFormat = hostOutputSampleFormat = paInt16; /* Surpress 'uninitialized var' warnings. */
} }
// og full-duplex // log full-duplex
if ((inputParameters != NULL) && (outputParameters != NULL)) if (fullDuplex)
PRINT(("WASAPI::OpenStream: full-duplex mode\n")); PRINT(("WASAPI::OpenStream: full-duplex mode\n"));
// paWinWasapiPolling must be on/or not on both streams // paWinWasapiPolling must be on/or not on both streams
@ -2504,12 +2505,14 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
goto error; goto error;
} }
// serious problem #2 // serious problem #2 - No, Not a problem, as framesPerHostCallback take into account
if (stream->out.framesPerHostCallback != stream->in.framesPerHostCallback) // sample size while it is not a problem for PA full-duplex, we must care of
// preriod only!
/*if (stream->out.framesPerHostCallback != stream->in.framesPerHostCallback)
{ {
PRINT(("WASAPI: OpenStream: framesPerHostCallback discrepancy\n")); PRINT(("WASAPI: OpenStream: framesPerHostCallback discrepancy\n"));
goto error; goto error;
} }*/
} }
framesPerHostCallback = (outputParameters) ? stream->out.framesPerHostCallback: framesPerHostCallback = (outputParameters) ? stream->out.framesPerHostCallback: