wasapi: improved paFramesPerBufferUnspecified handling in case device does not provide default period, paInvalidSampleRate will be returned if sampleRate parameter is 0 for Pa_IsFormatSupported/Pa_OpenStream

This commit is contained in:
dmitrykos 2010-02-20 12:03:57 +00:00
commit d2e38acc08

View file

@ -1368,6 +1368,8 @@ static PaError IsStreamParamsValid(struct PaUtilHostApiRepresentation *hostApi,
{
if (hostApi == NULL)
return paHostApiNotFound;
if ((UINT32)sampleRate == 0)
return paInvalidSampleRate;
if (inputParameters != NULL)
{
@ -1686,6 +1688,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
// choosing maximum default size
framesPerBuffer = max(framesPerBufferIn, framesPerBufferOut);
}
if (framesPerBuffer == 0)
framesPerBuffer = ((UINT32)sampleRate / 100) * 2;
// Try create device: Input
if (inputParameters != NULL)