wineoss.drv: Fix DeleteTimerQueueTimer usage.

This commit is contained in:
Andrew Eikum 2012-02-23 09:44:20 -06:00 committed by Alexandre Julliard
parent 4d2ea61a21
commit 7437eb63fc
1 changed files with 19 additions and 11 deletions

View File

@ -1335,13 +1335,15 @@ static void CALLBACK oss_period_callback(void *user, BOOLEAN timer)
EnterCriticalSection(&This->lock); EnterCriticalSection(&This->lock);
if(This->dataflow == eRender && This->held_frames) if(This->playing){
oss_write_data(This); if(This->dataflow == eRender && This->held_frames)
else if(This->dataflow == eCapture) oss_write_data(This);
oss_read_data(This); else if(This->dataflow == eCapture)
oss_read_data(This);
if(This->event) if(This->event)
SetEvent(This->event); SetEvent(This->event);
}
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
} }
@ -1384,6 +1386,8 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient *iface)
static HRESULT WINAPI AudioClient_Stop(IAudioClient *iface) static HRESULT WINAPI AudioClient_Stop(IAudioClient *iface)
{ {
ACImpl *This = impl_from_IAudioClient(iface); ACImpl *This = impl_from_IAudioClient(iface);
HANDLE event;
DWORD wait;
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
@ -1399,16 +1403,20 @@ static HRESULT WINAPI AudioClient_Stop(IAudioClient *iface)
return S_FALSE; return S_FALSE;
} }
if(This->timer && This->timer != INVALID_HANDLE_VALUE){ event = CreateEventW(NULL, TRUE, FALSE, NULL);
DeleteTimerQueueTimer(g_timer_q, This->timer, wait = !DeleteTimerQueueTimer(g_timer_q, This->timer, event);
INVALID_HANDLE_VALUE); if(wait)
This->timer = NULL; WARN("DeleteTimerQueueTimer error %u\n", GetLastError());
} wait = wait && GetLastError() == ERROR_IO_PENDING;
This->playing = FALSE; This->playing = FALSE;
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
if(event && wait)
WaitForSingleObject(event, INFINITE);
CloseHandle(event);
return S_OK; return S_OK;
} }