]> Repos - portaudio/commitdiff
wasapi: improved paFramesPerBufferUnspecified handling in case device does not provid...
authordmitrykos <dmitrykos@0f58301d-fd10-0410-b4af-bbb618454e57>
Sat, 20 Feb 2010 12:03:57 +0000 (12:03 +0000)
committerdmitrykos <dmitrykos@0f58301d-fd10-0410-b4af-bbb618454e57>
Sat, 20 Feb 2010 12:03:57 +0000 (12:03 +0000)
src/hostapi/wasapi/pa_win_wasapi.cpp

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