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: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-10-22 18:30:04 -05:00 committed by Alexandre Julliard
parent 132ce049e6
commit eca7b245f0
1 changed files with 0 additions and 36 deletions

View File

@ -46,7 +46,6 @@ typedef struct VideoRendererImpl
BOOL init; BOOL init;
HANDLE hEvent;
RECT SourceRect; RECT SourceRect;
RECT DestRect; RECT DestRect;
RECT WindowPos; RECT WindowPos;
@ -218,11 +217,9 @@ static HRESULT WINAPI VideoRenderer_DoRenderSample(BaseRenderer* iface, IMediaSa
} }
#endif #endif
SetEvent(This->hEvent);
if (This->renderer.filter.state == State_Paused) if (This->renderer.filter.state == State_Paused)
{ {
VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream); VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
SetEvent(This->hEvent);
if (This->renderer.filter.state == State_Paused) if (This->renderer.filter.state == State_Paused)
{ {
/* Flushing */ /* Flushing */
@ -287,34 +284,12 @@ static HRESULT WINAPI VideoRenderer_CheckMediaType(BaseRenderer *iface, const AM
return S_FALSE; 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) static void video_renderer_destroy(BaseRenderer *iface)
{ {
VideoRendererImpl *filter = impl_from_BaseRenderer(iface); VideoRendererImpl *filter = impl_from_BaseRenderer(iface);
BaseControlWindow_Destroy(&filter->baseControlWindow); BaseControlWindow_Destroy(&filter->baseControlWindow);
BaseControlVideo_Destroy(&filter->baseControlVideo); BaseControlVideo_Destroy(&filter->baseControlVideo);
CloseHandle(filter->hEvent);
strmbase_renderer_cleanup(&filter->renderer); strmbase_renderer_cleanup(&filter->renderer);
CoTaskMemFree(filter); CoTaskMemFree(filter);
@ -354,7 +329,6 @@ static void video_renderer_stop_stream(BaseRenderer *iface)
TRACE("(%p)->()\n", This); TRACE("(%p)->()\n", This);
SetEvent(This->hEvent);
if (This->baseControlWindow.AutoShow) if (This->baseControlWindow.AutoShow)
/* Black it out */ /* Black it out */
RedrawWindow(This->baseControlWindow.baseWindow.hWnd, NULL, NULL, RDW_INVALIDATE|RDW_ERASE); RedrawWindow(This->baseControlWindow.baseWindow.hWnd, NULL, NULL, RDW_INVALIDATE|RDW_ERASE);
@ -370,10 +344,7 @@ static void video_renderer_start_stream(BaseRenderer *iface)
&& (This->renderer.filter.state == State_Stopped || !This->renderer.sink.end_of_stream)) && (This->renderer.filter.state == State_Stopped || !This->renderer.sink.end_of_stream))
{ {
if (This->renderer.filter.state == State_Stopped) if (This->renderer.filter.state == State_Stopped)
{
ResetEvent(This->hEvent);
VideoRenderer_AutoShowWindow(This); VideoRenderer_AutoShowWindow(This);
}
} }
} }
@ -409,7 +380,6 @@ static const BaseRendererFuncTable BaseFuncTable =
.renderer_start_stream = video_renderer_start_stream, .renderer_start_stream = video_renderer_start_stream,
.renderer_stop_stream = video_renderer_stop_stream, .renderer_stop_stream = video_renderer_stop_stream,
.pfnShouldDrawSampleNow = VideoRenderer_ShouldDrawSampleNow, .pfnShouldDrawSampleNow = VideoRenderer_ShouldDrawSampleNow,
.pfnEndFlush = VideoRenderer_EndFlush,
.renderer_destroy = video_renderer_destroy, .renderer_destroy = video_renderer_destroy,
.renderer_query_interface = video_renderer_query_interface, .renderer_query_interface = video_renderer_query_interface,
.renderer_pin_query_interface = video_renderer_pin_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) if (This->renderer.filter.state == State_Stopped)
{ {
This->renderer.sink.end_of_stream = 0; This->renderer.sink.end_of_stream = 0;
ResetEvent(This->hEvent);
VideoRenderer_AutoShowWindow(This); VideoRenderer_AutoShowWindow(This);
} }
@ -858,13 +827,8 @@ HRESULT VideoRenderer_create(IUnknown *outer, void **out)
if (FAILED(hr)) if (FAILED(hr))
goto fail; goto fail;
pVideoRenderer->hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
if (FAILED(hr = BaseWindowImpl_PrepareWindow(&pVideoRenderer->baseControlWindow.baseWindow))) if (FAILED(hr = BaseWindowImpl_PrepareWindow(&pVideoRenderer->baseControlWindow.baseWindow)))
{
CloseHandle(pVideoRenderer->hEvent);
goto fail; goto fail;
}
*out = &pVideoRenderer->renderer.filter.IUnknown_inner; *out = &pVideoRenderer->renderer.filter.IUnknown_inner;
return S_OK; return S_OK;