From 3fb0ef9e30345688e1480eec9bdfe1dcf2296b5e Mon Sep 17 00:00:00 2001 From: dmitrykos Date: Mon, 21 Feb 2011 22:41:06 +0000 Subject: [PATCH] wasapi: fixed the bug when on stream stop/start/stop/start sequence callback could be called with number of samples smaller than requested by user in Pa_OpenStream --- src/hostapi/wasapi/pa_win_wasapi.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/hostapi/wasapi/pa_win_wasapi.c b/src/hostapi/wasapi/pa_win_wasapi.c index a61ce54..180f924 100644 --- a/src/hostapi/wasapi/pa_win_wasapi.c +++ b/src/hostapi/wasapi/pa_win_wasapi.c @@ -4733,16 +4733,25 @@ PA_THREAD_FUNC ProcThreadPoll(void *param) if (stream->bufferMode == paUtilFixedHostBufferSize) { if (frames >= stream->out.framesPerBuffer) + { frames = stream->out.framesPerBuffer; - } - if (frames != 0) - { - if ((hr = ProcessOutputBuffer(stream, processor, frames)) != S_OK) - { - LogHostError(hr); // not fatal, just log - } - } + if ((hr = ProcessOutputBuffer(stream, processor, frames)) != S_OK) + { + LogHostError(hr); // not fatal, just log + } + } + } + else + { + if (frames != 0) + { + if ((hr = ProcessOutputBuffer(stream, processor, frames)) != S_OK) + { + LogHostError(hr); // not fatal, just log + } + } + } } else { -- 2.43.0