winmm: Don't process audio data during waveOutWrite while playing.

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Andrew Eikum 2022-01-27 10:23:21 -06:00 committed by Alexandre Julliard
parent bf65b96b01
commit 362e39a4a7
2 changed files with 11 additions and 6 deletions

View File

@ -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();

View File

@ -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);