From 362e39a4a7154807c9707331cb5c707ff6c718d9 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Thu, 27 Jan 2022 10:23:21 -0600 Subject: [PATCH] winmm: Don't process audio data during waveOutWrite while playing. Signed-off-by: Andrew Eikum Signed-off-by: Alexandre Julliard --- dlls/winmm/tests/wave.c | 1 - dlls/winmm/waveform.c | 16 +++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/dlls/winmm/tests/wave.c b/dlls/winmm/tests/wave.c index 56501367190..5e46a2f46e5 100644 --- a/dlls/winmm/tests/wave.c +++ b/dlls/winmm/tests/wave.c @@ -1640,7 +1640,6 @@ static void CALLBACK test_reentrant_callback_func(HWAVEOUT hwo, UINT uMsg, case WOM_DONE: /* verify that WOM_DONE is not sent during the following waveOutWrite */ - todo_wine_if(wom_done_count == 1) ok(g_tid == 0, "callback called reentrantly\n"); g_tid = GetCurrentThreadId(); diff --git a/dlls/winmm/waveform.c b/dlls/winmm/waveform.c index 1159b48b483..ecffa700662 100644 --- a/dlls/winmm/waveform.c +++ b/dlls/winmm/waveform.c @@ -191,6 +191,7 @@ static LRESULT WOD_Close(HWAVEOUT hwave); static LRESULT WID_Open(WINMM_OpenInfo *info); static LRESULT WID_Close(HWAVEIN hwave); static MMRESULT WINMM_BeginPlaying(WINMM_Device *device); +static void WOD_PushData(WINMM_Device *device); void WINMM_DeleteWaveform(void) { @@ -775,8 +776,11 @@ static HRESULT reroute_mapper_device(WINMM_Device *device, BOOL is_out) HeapFree(GetProcessHeap(), 0, info.format); - if(!stopped) + if(!stopped){ + if(is_out) + WOD_PushData(device); WINMM_BeginPlaying(device); + } LeaveCriticalSection(&device->lock); @@ -1948,10 +1952,6 @@ static MMRESULT WINMM_BeginPlaying(WINMM_Device *device) TRACE("(%p)\n", device->handle); - if(device->render) - /* prebuffer data before starting */ - WOD_PushData(device); - if(device->stopped){ device->stopped = FALSE; @@ -2893,6 +2893,9 @@ UINT WINAPI waveOutWrite(HWAVEOUT hWaveOut, WAVEHDR *header, UINT uSize) header->dwFlags &= ~WHDR_DONE; header->dwFlags |= WHDR_INQUEUE; + if(device->stopped) + WOD_PushData(device); + mr = WINMM_BeginPlaying(device); LeaveCriticalSection(&device->lock); @@ -2970,6 +2973,9 @@ UINT WINAPI waveOutRestart(HWAVEOUT hWaveOut) device->stopped = TRUE; + if(device->render) + WOD_PushData(device); + mr = WINMM_BeginPlaying(device); LeaveCriticalSection(&device->lock); -- 2.11.4.GIT