[PATCH 2/2] quartz/tests: Fix some test failures related to thread timing.

Zebediah Figura z.figura12 at gmail.com
Sun May 16 22:24:12 CDT 2021


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/quartz/tests/videorenderer.c | 9 +++++++--
 dlls/quartz/tests/vmr9.c          | 6 +++++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c
index b6d91f86859..b9c7a2eb5dc 100644
--- a/dlls/quartz/tests/videorenderer.c
+++ b/dlls/quartz/tests/videorenderer.c
@@ -971,7 +971,7 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control
     thread = send_frame(input);
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
-    hr = IMediaControl_GetState(control, 0, &state);
+    hr = IMediaControl_GetState(control, 1000, &state);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
 
     hr = IPin_BeginFlush(pin);
@@ -1083,13 +1083,18 @@ static void test_sample_time(IBaseFilter *filter, IPin *pin, IMemInputPin *input
     hr = IPin_BeginFlush(pin);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    /* If the frame makes it to Receive() in time to be rendered, we get S_OK. */
+    ok(hr == S_OK || hr == S_FALSE, "Got hr %#x.\n", hr);
     hr = IPin_EndFlush(pin);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
 
     thread = send_frame_time(input, 1000000, 0xff);
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
+    /* wait for the sample to actually reach Receive() */
+    hr = IMediaControl_GetState(control, 1000, &state);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
     hr = IMediaControl_Stop(control);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     hr = join_thread(thread);
diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c
index f3365bd02d0..eb2c5bc47cc 100644
--- a/dlls/quartz/tests/vmr9.c
+++ b/dlls/quartz/tests/vmr9.c
@@ -1199,7 +1199,7 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control
     thread = send_frame(input);
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
-    hr = IMediaControl_GetState(control, 0, &state);
+    hr = IMediaControl_GetState(control, 1000, &state);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
 
     hr = IPin_BeginFlush(pin);
@@ -1450,6 +1450,10 @@ static void test_sample_time(IPin *pin, IMemInputPin *input, IMediaControl *cont
     thread = send_frame_time(input, 1000000, 0x00ffff00); /* yellow */
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
+    /* wait for the sample to actually reach Receive() */
+    hr = IMediaControl_GetState(control, 1000, &state);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
     hr = IMediaControl_Stop(control);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     hr = join_thread(thread);
-- 
2.30.2




More information about the wine-devel mailing list