[PATCH 1/4] quartz/avidec: Don't send ICM_DECOMPRESS_BEGIN or ICM_DECOMPRESS_END messages if the source is disconnected.

Zebediah Figura z.figura12 at gmail.com
Thu Nov 19 17:24:12 CST 2020


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/quartz/avidec.c       | 11 ++++++++---
 dlls/quartz/tests/avidec.c | 18 +++++++++---------
 2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/dlls/quartz/avidec.c b/dlls/quartz/avidec.c
index 72f69ef7c5a..4995276dbfc 100644
--- a/dlls/quartz/avidec.c
+++ b/dlls/quartz/avidec.c
@@ -565,6 +565,9 @@ static HRESULT avi_decompressor_init_stream(struct strmbase_filter *iface)
     LRESULT res;
     HRESULT hr;
 
+    if (!filter->source.pin.peer)
+        return S_OK;
+
     filter->late = -1;
 
     source_format = (VIDEOINFOHEADER *)filter->sink.pin.mt.pbFormat;
@@ -574,7 +577,7 @@ static HRESULT avi_decompressor_init_stream(struct strmbase_filter *iface)
         return E_FAIL;
     }
 
-    if (filter->source.pin.peer && FAILED(hr = IMemAllocator_Commit(filter->source.pAllocator)))
+    if (FAILED(hr = IMemAllocator_Commit(filter->source.pAllocator)))
         ERR("Failed to commit allocator, hr %#x.\n", hr);
 
     return S_OK;
@@ -585,14 +588,16 @@ static HRESULT avi_decompressor_cleanup_stream(struct strmbase_filter *iface)
     struct avi_decompressor *filter = impl_from_strmbase_filter(iface);
     LRESULT res;
 
+    if (!filter->source.pin.peer)
+        return S_OK;
+
     if (filter->hvid && (res = ICDecompressEnd(filter->hvid)))
     {
         ERR("ICDecompressEnd() failed, error %ld.\n", res);
         return E_FAIL;
     }
 
-    if (filter->source.pin.peer)
-        IMemAllocator_Decommit(filter->source.pAllocator);
+    IMemAllocator_Decommit(filter->source.pAllocator);
 
     return S_OK;
 }
diff --git a/dlls/quartz/tests/avidec.c b/dlls/quartz/tests/avidec.c
index ddfe22ed797..8717e107106 100644
--- a/dlls/quartz/tests/avidec.c
+++ b/dlls/quartz/tests/avidec.c
@@ -692,25 +692,25 @@ static void test_unconnected_filter_state(void)
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(state == State_Paused, "Got state %u.\n", state);
+    ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(state == State_Running, "Got state %u.\n", state);
+    ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(state == State_Paused, "Got state %u.\n", state);
+    ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -720,11 +720,11 @@ static void test_unconnected_filter_state(void)
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(state == State_Running, "Got state %u.\n", state);
+    ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -956,7 +956,7 @@ static void test_connect_pin(void)
     ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
     hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
     ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
     hr = IMediaControl_Stop(control);
-- 
2.29.2




More information about the wine-devel mailing list