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:
parent
15aeb7c1c0
commit
d2e38acc08
1 changed files with 4 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue