Zebediah Figura : qasf/tests: Test that the DMO wrapper (de)commits its source pins' allocators when changing state.

Alexandre Julliard julliard at winehq.org
Wed Dec 15 14:25:58 CST 2021


Module: wine
Branch: master
Commit: 617c9b4692a1e87e4b79dab71d8f1a7e702212ca
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=617c9b4692a1e87e4b79dab71d8f1a7e702212ca

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Wed Dec 15 11:50:49 2021 -0600

qasf/tests: Test that the DMO wrapper (de)commits its source pins' allocators when changing state.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/qasf/tests/dmowrapper.c | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/dlls/qasf/tests/dmowrapper.c b/dlls/qasf/tests/dmowrapper.c
index bd87a3494b2..9cebbda3af2 100644
--- a/dlls/qasf/tests/dmowrapper.c
+++ b/dlls/qasf/tests/dmowrapper.c
@@ -1375,10 +1375,12 @@ static void test_sink_allocator(IMemInputPin *input)
     IMemAllocator_Release(ret_allocator);
 }
 
-static void test_source_allocator(IFilterGraph2 *graph, IPin *source, struct testfilter *testsink)
+static void test_source_allocator(IFilterGraph2 *graph, IMediaControl *control,
+        IPin *source, struct testfilter *testsink)
 {
     ALLOCATOR_PROPERTIES props, req_props = {2, 30000, 32, 0};
     IMemAllocator *allocator;
+    IMediaSample *sample;
     HRESULT hr;
 
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.pin.IPin_iface, &mt2);
@@ -1392,6 +1394,22 @@ static void test_source_allocator(IFilterGraph2 *graph, IPin *source, struct tes
     ok(props.cbAlign == 1, "Got alignment %d.\n", props.cbAlign);
     ok(!props.cbPrefix, "Got prefix %d.\n", props.cbPrefix);
 
+    hr = IMemAllocator_GetBuffer(testsink->sink.pAllocator, &sample, NULL, NULL, 0);
+    ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#x.\n", hr);
+
+    hr = IMediaControl_Pause(control);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+    hr = IMemAllocator_GetBuffer(testsink->sink.pAllocator, &sample, NULL, NULL, 0);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    IMediaSample_Release(sample);
+
+    hr = IMediaControl_Stop(control);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+    hr = IMemAllocator_GetBuffer(testsink->sink.pAllocator, &sample, NULL, NULL, 0);
+    ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#x.\n", hr);
+
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink->sink.pin.IPin_iface);
 
@@ -1500,7 +1518,8 @@ static void test_filter_state(IMediaControl *control)
     ok(state == State_Stopped, "Got state %u.\n", state);
 }
 
-static void test_sample_processing(IMediaControl *control, IMemInputPin *input)
+static void test_sample_processing(IMediaControl *control, IMemInputPin *input,
+        struct testfilter *testsink)
 {
     REFERENCE_TIME start, stop;
     IMemAllocator *allocator;
@@ -1863,7 +1882,7 @@ static void test_connect_pin(void)
     ok(hr == S_OK, "Got hr %#x.\n", hr);
 
     test_filter_state(control);
-    test_sample_processing(control, meminput);
+    test_sample_processing(control, meminput, &testsink);
 
     /* Streaming event tests are more interesting if multiple source pins are
      * connected. */
@@ -2007,7 +2026,7 @@ static void test_connect_pin(void)
 
     ok(!testdmo_input_mt_set, "Input type should not be set.\n");
 
-    test_source_allocator(graph, source, &testsink);
+    test_source_allocator(graph, control, source, &testsink);
 
     IPin_Release(sink);
     IPin_Release(source);




More information about the wine-cvs mailing list