[PATCH 5/5] strmbase: Don't hold the streaming lock in IPin::BeginFlush().

Zebediah Figura z.figura12 at gmail.com
Wed Nov 27 19:27:18 CST 2019

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
There's no need to do this.

Moreover, not holding the stream lock in BeginFlush() means that we no longer
need to temporarily drop it in IMemInputPin::Receive(), even while waiting,
since there is no longer a risk of deadlock.

The DirectX SDK documentation prescribes that BeginFlush() may take the stream
lock, but can only do so after signalling the streaming thread to stop waiting
(see the page "Flushing Data"). It also prescribes that the streaming thread
hold the streaming lock even while waiting for any necessary events (see the
page "Receiving and Delivering Samples").

 dlls/strmbase/renderer.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c
index 50bd33715d..0ef9c5b225 100644
--- a/dlls/strmbase/renderer.c
+++ b/dlls/strmbase/renderer.c
@@ -115,7 +115,6 @@ static HRESULT WINAPI BaseRenderer_InputPin_BeginFlush(IPin * iface)
     TRACE("iface %p.\n", iface);
-    EnterCriticalSection(&pFilter->csRenderLock);
     hr = BaseInputPinImpl_BeginFlush(iface);
     if (SUCCEEDED(hr))
@@ -124,7 +123,6 @@ static HRESULT WINAPI BaseRenderer_InputPin_BeginFlush(IPin * iface)
-    LeaveCriticalSection(&pFilter->csRenderLock);
     return hr;

More information about the wine-devel mailing list