[PATCH 2/5] quartz: Fix a race condition in videorenderer endflush

Maarten Lankhorst m.b.lankhorst at gmail.com
Fri Dec 10 09:06:56 CST 2010


---
 dlls/quartz/videorenderer.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c
index 6f2a860..86b9f2a 100644
--- a/dlls/quartz/videorenderer.c
+++ b/dlls/quartz/videorenderer.c
@@ -432,6 +432,7 @@ static HRESULT WINAPI VideoRenderer_Receive(BaseInputPin* pin, IMediaSample * pS
         LeaveCriticalSection(&This->filter.csFilter);
         WaitForSingleObject(This->blocked, INFINITE);
         EnterCriticalSection(&This->filter.csFilter);
+        SetEvent(This->hEvent);
         This->sample_held = NULL;
         if (This->filter.state == State_Paused)
         {
@@ -959,6 +960,15 @@ static HRESULT WINAPI VideoRenderer_InputPin_EndFlush(IPin * iface)
     TRACE("(%p/%p)->()\n", This, iface);
 
     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) {
         ResetEvent(pVideoRenderer->blocked);
         ResetEvent(pVideoRenderer->hEvent);
-- 
1.7.1




More information about the wine-patches mailing list