[PATCH 3/5] quartz/vmr9: Signal state change completion only after PresentImage() has been called.

Zebediah Figura z.figura12 at gmail.com
Mon Jul 20 17:49:08 CDT 2020


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/qedit/nullrenderer.c   | 5 +++++
 dlls/quartz/tests/vmr9.c    | 5 +++++
 dlls/quartz/videorenderer.c | 1 +
 dlls/quartz/vmr9.c          | 1 +
 dlls/strmbase/renderer.c    | 2 --
 5 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/dlls/qedit/nullrenderer.c b/dlls/qedit/nullrenderer.c
index e703ea24305..c64d5e2987c 100644
--- a/dlls/qedit/nullrenderer.c
+++ b/dlls/qedit/nullrenderer.c
@@ -38,6 +38,11 @@ static struct null_renderer *impl_from_strmbase_renderer(struct strmbase_rendere
 
 static HRESULT WINAPI NullRenderer_DoRenderSample(struct strmbase_renderer *iface, IMediaSample *sample)
 {
+    struct null_renderer *filter = impl_from_strmbase_renderer(iface);
+
+    if (filter->renderer.filter.state == State_Paused)
+        SetEvent(filter->renderer.state_event);
+
     return S_OK;
 }
 
diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c
index e630deb8d74..a2fd5b76861 100644
--- a/dlls/quartz/tests/vmr9.c
+++ b/dlls/quartz/tests/vmr9.c
@@ -2943,6 +2943,11 @@ static void test_renderless_present(IFilterGraph2 *graph, IMemInputPin *input)
     thread = send_frame(input);
     hr = IMediaControl_GetState(control, 1000, &state);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
+    /* Atelier Sophie uses the VMR in renderless mode, calls
+     * IMediaControl::Run() from a stopped state and expects that
+     * IMediaControl::GetState() returns S_OK only after PresentImage() has
+     * been called. */
+    ok(allocator_got_PresentImage == 1, "Got %u calls to PresentImage().\n", allocator_got_PresentImage);
 
     hr = IMediaControl_Run(control);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c
index eb6accf2d34..2ad479a6301 100644
--- a/dlls/quartz/videorenderer.c
+++ b/dlls/quartz/videorenderer.c
@@ -111,6 +111,7 @@ static HRESULT WINAPI VideoRenderer_DoRenderSample(struct strmbase_renderer *ifa
 
         filter->current_sample = pSample;
 
+        SetEvent(filter->renderer.state_event);
         LeaveCriticalSection(&filter->renderer.csRenderLock);
         WaitForMultipleObjects(2, events, FALSE, INFINITE);
         EnterCriticalSection(&filter->renderer.csRenderLock);
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c
index a3f55011062..00cd6bbce84 100644
--- a/dlls/quartz/vmr9.c
+++ b/dlls/quartz/vmr9.c
@@ -315,6 +315,7 @@ static HRESULT WINAPI VMR9_DoRenderSample(struct strmbase_renderer *iface, IMedi
 
     if (filter->renderer.filter.state == State_Paused)
     {
+        SetEvent(filter->renderer.state_event);
         LeaveCriticalSection(&filter->renderer.csRenderLock);
         WaitForMultipleObjects(2, events, FALSE, INFINITE);
         EnterCriticalSection(&filter->renderer.csRenderLock);
diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c
index b6d552b3b0a..dde56b7a346 100644
--- a/dlls/strmbase/renderer.c
+++ b/dlls/strmbase/renderer.c
@@ -193,8 +193,6 @@ static HRESULT WINAPI BaseRenderer_Receive(struct strmbase_sink *pin, IMediaSamp
     }
 
     EnterCriticalSection(&filter->csRenderLock);
-    if (filter->filter.state == State_Paused)
-        SetEvent(filter->state_event);
 
     if (filter->filter.clock && SUCCEEDED(IMediaSample_GetTime(sample, &start, &stop)))
     {
-- 
2.27.0




More information about the wine-devel mailing list