Commit eca7b245 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

quartz/videorenderer: Get rid of hEvent.

This event was at various times used for several different purposes. The only current use is apparently to prevent stale samples from being rendered after IPin::EndFlush() completes, but in practice there's actually no foolproof way to prevent this race in the video renderer. On the other hand, as long as the filter driving the graph can ensure this, there's no need to do so. Signed-off-by: 's avatarZebediah Figura <z.figura12@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 132ce049
......@@ -46,7 +46,6 @@ typedef struct VideoRendererImpl
BOOL init;
HANDLE hEvent;
RECT SourceRect;
RECT DestRect;
RECT WindowPos;
......@@ -218,11 +217,9 @@ static HRESULT WINAPI VideoRenderer_DoRenderSample(BaseRenderer* iface, IMediaSa
}
#endif
SetEvent(This->hEvent);
if (This->renderer.filter.state == State_Paused)
{
VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
SetEvent(This->hEvent);
if (This->renderer.filter.state == State_Paused)
{
/* Flushing */
......@@ -287,34 +284,12 @@ static HRESULT WINAPI VideoRenderer_CheckMediaType(BaseRenderer *iface, const AM
return S_FALSE;
}
static HRESULT WINAPI VideoRenderer_EndFlush(BaseRenderer* iface)
{
VideoRendererImpl *This = impl_from_BaseRenderer(iface);
TRACE("(%p)->()\n", iface);
if (This->renderer.pMediaSample) {
ResetEvent(This->hEvent);
LeaveCriticalSection(&iface->filter.csFilter);
LeaveCriticalSection(&iface->csRenderLock);
WaitForSingleObject(This->hEvent, INFINITE);
EnterCriticalSection(&iface->csRenderLock);
EnterCriticalSection(&iface->filter.csFilter);
}
if (This->renderer.filter.state == State_Paused) {
ResetEvent(This->hEvent);
}
return BaseRendererImpl_EndFlush(iface);
}
static void video_renderer_destroy(BaseRenderer *iface)
{
VideoRendererImpl *filter = impl_from_BaseRenderer(iface);
BaseControlWindow_Destroy(&filter->baseControlWindow);
BaseControlVideo_Destroy(&filter->baseControlVideo);
CloseHandle(filter->hEvent);
strmbase_renderer_cleanup(&filter->renderer);
CoTaskMemFree(filter);
......@@ -354,7 +329,6 @@ static void video_renderer_stop_stream(BaseRenderer *iface)
TRACE("(%p)->()\n", This);
SetEvent(This->hEvent);
if (This->baseControlWindow.AutoShow)
/* Black it out */
RedrawWindow(This->baseControlWindow.baseWindow.hWnd, NULL, NULL, RDW_INVALIDATE|RDW_ERASE);
......@@ -370,11 +344,8 @@ static void video_renderer_start_stream(BaseRenderer *iface)
&& (This->renderer.filter.state == State_Stopped || !This->renderer.sink.end_of_stream))
{
if (This->renderer.filter.state == State_Stopped)
{
ResetEvent(This->hEvent);
VideoRenderer_AutoShowWindow(This);
}
}
}
static RECT WINAPI VideoRenderer_GetDefaultRect(BaseWindow *iface)
......@@ -409,7 +380,6 @@ static const BaseRendererFuncTable BaseFuncTable =
.renderer_start_stream = video_renderer_start_stream,
.renderer_stop_stream = video_renderer_stop_stream,
.pfnShouldDrawSampleNow = VideoRenderer_ShouldDrawSampleNow,
.pfnEndFlush = VideoRenderer_EndFlush,
.renderer_destroy = video_renderer_destroy,
.renderer_query_interface = video_renderer_query_interface,
.renderer_pin_query_interface = video_renderer_pin_query_interface,
......@@ -594,7 +564,6 @@ static HRESULT WINAPI VideoRenderer_Pause(IBaseFilter * iface)
if (This->renderer.filter.state == State_Stopped)
{
This->renderer.sink.end_of_stream = 0;
ResetEvent(This->hEvent);
VideoRenderer_AutoShowWindow(This);
}
......@@ -858,13 +827,8 @@ HRESULT VideoRenderer_create(IUnknown *outer, void **out)
if (FAILED(hr))
goto fail;
pVideoRenderer->hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
if (FAILED(hr = BaseWindowImpl_PrepareWindow(&pVideoRenderer->baseControlWindow.baseWindow)))
{
CloseHandle(pVideoRenderer->hEvent);
goto fail;
}
*out = &pVideoRenderer->renderer.filter.IUnknown_inner;
return S_OK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment