From da03334a731ad25c0c048c0df7aa757e7dd2ecdd Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Tue, 18 Nov 2014 06:59:26 -0800 Subject: [PATCH] ao/wasapi: keep bufferPeriod in sync on retry Without this, the retry will fail if they are not equal or bufferPeriod is zero. --- audio/out/ao_wasapi_utils.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c index 3c78bb9b98..657a98aae3 100755 --- a/audio/out/ao_wasapi_utils.c +++ b/audio/out/ao_wasapi_utils.c @@ -489,9 +489,12 @@ reinit: EXIT_ON_ERROR(hr); } IAudioClient_GetBufferSize(state->pAudioClient, &state->bufferFrameCount); - bufferDuration = + bufferPeriod = bufferDuration = (REFERENCE_TIME)((10000.0 * 1000 / state->format.Format.nSamplesPerSec * state->bufferFrameCount) + offset); + if (state->share_mode == AUDCLNT_SHAREMODE_SHARED) + bufferPeriod = 0; + offset += 0.5; IAudioClient_Release(state->pAudioClient); state->pAudioClient = NULL;