Skip to content

Commit

Permalink
WDM-KS: don't request a zero buffer size
Browse files Browse the repository at this point in the history
This fixes an issue where Pa_OpenStream() would fail on WDM-KS WinRT
devices if suggestedLatency is zero.

Fixes #761
  • Loading branch information
dechamps committed Jan 21, 2023
1 parent bbe2b5a commit 9cc1d17
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/hostapi/wdmks/pa_win_wdmks.c
Original file line number Diff line number Diff line change
Expand Up @@ -4734,6 +4734,10 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
{
stream->capture.framesPerBuffer = stream->capture.pPin->frameSize;
}
else if(stream->capture.framesPerBuffer == 0) {
/* WinRT devices will reject a zero RequestedBufferSize. See https://github.com/PortAudio/portaudio/issues/761 */
stream->capture.framesPerBuffer = 1;
}
PA_DEBUG(("Input frames chosen:%ld\n",stream->capture.framesPerBuffer));

/* Setup number of packets to use */
Expand Down Expand Up @@ -4763,6 +4767,10 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
{
stream->render.framesPerBuffer = stream->render.pPin->frameSize;
}
else if(stream->render.framesPerBuffer == 0) {
/* WinRT devices will reject a zero RequestedBufferSize. See https://github.com/PortAudio/portaudio/issues/761 */
stream->render.framesPerBuffer = 1;
}
PA_DEBUG(("Output frames chosen:%ld\n",stream->render.framesPerBuffer));

/* Setup number of packets to use */
Expand Down

0 comments on commit 9cc1d17

Please sign in to comment.