quartz/dsoundrender: Use flush_event instead of reimplementing it.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-07-02 22:25:43 -05:00 committed by Alexandre Julliard
parent 436fb03a87
commit 221a0cdb94
1 changed files with 3 additions and 36 deletions

View File

@ -64,8 +64,6 @@ typedef struct DSoundRenderImpl
REFERENCE_TIME play_time;
HANDLE blocked;
LONG volume;
LONG pan;
@ -245,7 +243,7 @@ static HRESULT DSoundRender_HandleEndOfStream(DSoundRenderImpl *This)
This->in_loop = 1;
LeaveCriticalSection(&This->renderer.filter.csFilter);
LeaveCriticalSection(&This->renderer.csRenderLock);
WaitForSingleObject(This->blocked, 10);
WaitForSingleObject(This->renderer.flush_event, 10);
EnterCriticalSection(&This->renderer.csRenderLock);
EnterCriticalSection(&This->renderer.filter.csFilter);
This->in_loop = 0;
@ -270,7 +268,7 @@ static HRESULT DSoundRender_SendSampleData(DSoundRenderImpl* This, REFERENCE_TIM
if (hr != S_OK) {
This->in_loop = 1;
LeaveCriticalSection(&This->renderer.csRenderLock);
ret = WaitForSingleObject(This->blocked, 10);
ret = WaitForSingleObject(This->renderer.flush_event, 10);
EnterCriticalSection(&This->renderer.csRenderLock);
This->in_loop = 0;
if (This->renderer.sink.flushing || This->renderer.filter.state == State_Stopped)
@ -434,7 +432,6 @@ static VOID WINAPI DSoundRender_OnStopStreaming(BaseRenderer * iface)
IDirectSoundBuffer_Stop(This->dsbuffer);
This->writepos = This->buf_size;
SetEvent(This->blocked);
}
static VOID WINAPI DSoundRender_OnStartStreaming(BaseRenderer * iface)
@ -445,13 +442,7 @@ static VOID WINAPI DSoundRender_OnStartStreaming(BaseRenderer * iface)
if (This->renderer.sink.pin.pConnectedTo)
{
if (This->renderer.filter.state == State_Paused)
{
/* Unblock our thread, state changing from paused to running doesn't need a reset for state change */
SetEvent(This->blocked);
}
IDirectSoundBuffer_Play(This->dsbuffer, 0, 0, DSBPLAY_LOOPING);
ResetEvent(This->blocked);
}
}
@ -548,17 +539,6 @@ static HRESULT WINAPI DSoundRender_EndOfStream(BaseRenderer* iface)
return hr;
}
static HRESULT WINAPI DSoundRender_BeginFlush(BaseRenderer* iface)
{
DSoundRenderImpl *This = impl_from_BaseRenderer(iface);
TRACE("\n");
BaseRendererImpl_BeginFlush(iface);
SetEvent(This->blocked);
return S_OK;
}
static HRESULT WINAPI DSoundRender_EndFlush(BaseRenderer* iface)
{
DSoundRenderImpl *This = impl_from_BaseRenderer(iface);
@ -566,8 +546,6 @@ static HRESULT WINAPI DSoundRender_EndFlush(BaseRenderer* iface)
TRACE("\n");
BaseRendererImpl_EndFlush(iface);
if (This->renderer.filter.state != State_Stopped)
ResetEvent(This->blocked);
if (This->dsbuffer)
{
@ -602,8 +580,6 @@ static void dsound_render_destroy(BaseRenderer *iface)
IDirectSound8_Release(filter->dsound);
filter->dsound = NULL;
CloseHandle(filter->blocked);
strmbase_renderer_cleanup(&filter->renderer);
CoTaskMemFree(filter);
}
@ -643,7 +619,7 @@ static const BaseRendererFuncTable BaseFuncTable = {
DSoundRender_CompleteConnect,
DSoundRender_BreakConnect,
DSoundRender_EndOfStream,
DSoundRender_BeginFlush,
NULL,
DSoundRender_EndFlush,
dsound_render_destroy,
dsound_render_query_interface,
@ -695,14 +671,6 @@ HRESULT DSoundRender_create(IUnknown *outer, void **out)
if (SUCCEEDED(hr))
{
pDSoundRender->blocked = CreateEventW(NULL, TRUE, TRUE, NULL);
if (!pDSoundRender->blocked || FAILED(hr))
{
IBaseFilter_Release(&pDSoundRender->renderer.filter.IBaseFilter_iface);
return HRESULT_FROM_WIN32(GetLastError());
}
*out = &pDSoundRender->renderer.filter.IUnknown_inner;
}
else
@ -735,7 +703,6 @@ static HRESULT WINAPI DSoundRender_Pause(IBaseFilter * iface)
if (SUCCEEDED(hr))
This->renderer.filter.state = State_Paused;
ResetEvent(This->blocked);
ResetEvent(This->renderer.flush_event);
}
LeaveCriticalSection(&This->renderer.csRenderLock);