quartz: Fix a race condition in videorenderer endflush.

This commit is contained in:
Maarten Lankhorst 2010-12-10 16:06:56 +01:00 committed by Alexandre Julliard
parent b353f32453
commit 351165e30d
1 changed files with 10 additions and 0 deletions

View File

@ -432,6 +432,7 @@ static HRESULT WINAPI VideoRenderer_Receive(BaseInputPin* pin, IMediaSample * pS
LeaveCriticalSection(&This->filter.csFilter); LeaveCriticalSection(&This->filter.csFilter);
WaitForSingleObject(This->blocked, INFINITE); WaitForSingleObject(This->blocked, INFINITE);
EnterCriticalSection(&This->filter.csFilter); EnterCriticalSection(&This->filter.csFilter);
SetEvent(This->hEvent);
This->sample_held = NULL; This->sample_held = NULL;
if (This->filter.state == State_Paused) if (This->filter.state == State_Paused)
{ {
@ -959,6 +960,15 @@ static HRESULT WINAPI VideoRenderer_InputPin_EndFlush(IPin * iface)
TRACE("(%p/%p)->()\n", This, iface); TRACE("(%p/%p)->()\n", This, iface);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(This->pin.pCritSec);
if (pVideoRenderer->sample_held) {
SetEvent(pVideoRenderer->blocked);
ResetEvent(pVideoRenderer->hEvent);
LeaveCriticalSection(This->pin.pCritSec);
WaitForSingleObject(pVideoRenderer->hEvent, INFINITE);
EnterCriticalSection(This->pin.pCritSec);
ResetEvent(pVideoRenderer->blocked);
}
if (pVideoRenderer->filter.state == State_Paused) { if (pVideoRenderer->filter.state == State_Paused) {
ResetEvent(pVideoRenderer->blocked); ResetEvent(pVideoRenderer->blocked);
ResetEvent(pVideoRenderer->hEvent); ResetEvent(pVideoRenderer->hEvent);