Zebediah Figura : strmbase/renderer: Share pin and filter reference counts.

Alexandre Julliard julliard at winehq.org
Tue Jun 18 17:21:46 CDT 2019


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Jun 17 20:41:55 2019 -0500

strmbase/renderer: Share pin and filter reference counts.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/qedit/tests/nullrenderer.c   | 10 +++++-----
 dlls/quartz/tests/dsoundrender.c  |  8 +++-----
 dlls/quartz/tests/videorenderer.c |  8 +++-----
 dlls/quartz/tests/vmr7.c          |  4 ++--
 dlls/quartz/tests/vmr9.c          |  4 ++--
 dlls/strmbase/renderer.c          | 18 +++++++++++++++---
 6 files changed, 30 insertions(+), 22 deletions(-)

diff --git a/dlls/qedit/tests/nullrenderer.c b/dlls/qedit/tests/nullrenderer.c
index a45f30a..d39b28d 100644
--- a/dlls/qedit/tests/nullrenderer.c
+++ b/dlls/qedit/tests/nullrenderer.c
@@ -122,9 +122,9 @@ static void test_enum_pins(void)
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     ref = get_refcount(filter);
-    todo_wine ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
     ref = get_refcount(pins[0]);
-    todo_wine ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
     ref = get_refcount(enum1);
     ok(ref == 1, "Got unexpected refcount %d.\n", ref);
     IPin_Release(pins[0]);
@@ -226,7 +226,7 @@ static void test_pin_info(void)
     hr = IBaseFilter_FindPin(filter, sink_id, &pin);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     ref = get_refcount(filter);
-    todo_wine ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
     ref = get_refcount(pin);
     ok(ref == 2, "Got unexpected refcount %d.\n", ref);
 
@@ -236,9 +236,9 @@ static void test_pin_info(void)
     ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir);
     ok(!lstrcmpW(info.achName, sink_id), "Got name %s.\n", wine_dbgstr_w(info.achName));
     ref = get_refcount(filter);
-    todo_wine ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
     ref = get_refcount(pin);
-    todo_wine ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
     IBaseFilter_Release(info.pFilter);
 
     hr = IPin_QueryDirection(pin, &dir);
diff --git a/dlls/quartz/tests/dsoundrender.c b/dlls/quartz/tests/dsoundrender.c
index 44c7119..cf7b0e3 100644
--- a/dlls/quartz/tests/dsoundrender.c
+++ b/dlls/quartz/tests/dsoundrender.c
@@ -288,10 +288,8 @@ static void test_enum_pins(void)
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     ref = get_refcount(filter);
-todo_wine
     ok(ref == 3, "Got unexpected refcount %d.\n", ref);
     ref = get_refcount(pins[0]);
-todo_wine
     ok(ref == 3, "Got unexpected refcount %d.\n", ref);
     ref = get_refcount(enum1);
     ok(ref == 1, "Got unexpected refcount %d.\n", ref);
@@ -399,7 +397,7 @@ static void test_pin_info(void)
     hr = IBaseFilter_FindPin(filter, sink_id, &pin);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     ref = get_refcount(filter);
-    todo_wine ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
     ref = get_refcount(pin);
     ok(ref == 2, "Got unexpected refcount %d.\n", ref);
 
@@ -409,9 +407,9 @@ static void test_pin_info(void)
     ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir);
     ok(!lstrcmpW(info.achName, sink_id), "Got name %s.\n", wine_dbgstr_w(info.achName));
     ref = get_refcount(filter);
-    todo_wine ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
     ref = get_refcount(pin);
-    todo_wine ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
     IBaseFilter_Release(info.pFilter);
 
     hr = IPin_QueryDirection(pin, &dir);
diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c
index fdd4dfb..0b9ea3f 100644
--- a/dlls/quartz/tests/videorenderer.c
+++ b/dlls/quartz/tests/videorenderer.c
@@ -221,10 +221,8 @@ static void test_enum_pins(void)
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     ref = get_refcount(filter);
-todo_wine
     ok(ref == 3, "Got unexpected refcount %d.\n", ref);
     ref = get_refcount(pins[0]);
-todo_wine
     ok(ref == 3, "Got unexpected refcount %d.\n", ref);
     ref = get_refcount(enum1);
     ok(ref == 1, "Got unexpected refcount %d.\n", ref);
@@ -329,7 +327,7 @@ static void test_pin_info(void)
     hr = IBaseFilter_FindPin(filter, sink_id, &pin);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     ref = get_refcount(filter);
-    todo_wine ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
     ref = get_refcount(pin);
     ok(ref == 2, "Got unexpected refcount %d.\n", ref);
 
@@ -340,9 +338,9 @@ static void test_pin_info(void)
 todo_wine
     ok(!lstrcmpW(info.achName, sink_name), "Got name %s.\n", wine_dbgstr_w(info.achName));
     ref = get_refcount(filter);
-    todo_wine ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
     ref = get_refcount(pin);
-    todo_wine ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
     IBaseFilter_Release(info.pFilter);
 
     hr = IPin_QueryDirection(pin, &dir);
diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c
index ee80590..e702be7 100644
--- a/dlls/quartz/tests/vmr7.c
+++ b/dlls/quartz/tests/vmr7.c
@@ -427,9 +427,9 @@ static void test_enum_pins(void)
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     ref = get_refcount(filter);
-    todo_wine ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
     ref = get_refcount(pins[0]);
-    todo_wine ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
     ref = get_refcount(enum1);
     ok(ref == 1, "Got unexpected refcount %d.\n", ref);
     IPin_Release(pins[0]);
diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c
index 13f6e19..d14a970 100644
--- a/dlls/quartz/tests/vmr9.c
+++ b/dlls/quartz/tests/vmr9.c
@@ -435,9 +435,9 @@ static void test_enum_pins(void)
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     ref = get_refcount(filter);
-    todo_wine ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
     ref = get_refcount(pins[0]);
-    todo_wine ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
     ref = get_refcount(enum1);
     ok(ref == 1, "Got unexpected refcount %d.\n", ref);
     IPin_Release(pins[0]);
diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c
index b1b318f..36e934f 100644
--- a/dlls/strmbase/renderer.c
+++ b/dlls/strmbase/renderer.c
@@ -45,6 +45,18 @@ static const IQualityControlVtbl Renderer_QualityControl_Vtbl = {
     QualityControlImpl_SetSink
 };
 
+static ULONG WINAPI BaseRenderer_InputPin_AddRef(IPin *iface)
+{
+    BaseInputPin *pin = impl_BaseInputPin_from_IPin(iface);
+    return IBaseFilter_AddRef(pin->pin.pinInfo.pFilter);
+}
+
+static ULONG WINAPI BaseRenderer_InputPin_Release(IPin *iface)
+{
+    BaseInputPin *pin = impl_BaseInputPin_from_IPin(iface);
+    return IBaseFilter_Release(pin->pin.pinInfo.pFilter);
+}
+
 static HRESULT WINAPI BaseRenderer_InputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
 {
     BaseInputPin *This = impl_BaseInputPin_from_IPin(iface);
@@ -164,8 +176,8 @@ static HRESULT WINAPI BaseRenderer_InputPin_EndFlush(IPin * iface)
 static const IPinVtbl BaseRenderer_InputPin_Vtbl =
 {
     BaseInputPinImpl_QueryInterface,
-    BasePinImpl_AddRef,
-    BaseInputPinImpl_Release,
+    BaseRenderer_InputPin_AddRef,
+    BaseRenderer_InputPin_Release,
     BaseInputPinImpl_Connect,
     BaseRenderer_InputPin_ReceiveConnection,
     BaseRenderer_InputPin_Disconnect,
@@ -298,7 +310,7 @@ void strmbase_renderer_cleanup(BaseRenderer *filter)
         IPin_Release(peer);
     }
     IPin_Disconnect(&filter->pInputPin->pin.IPin_iface);
-    IPin_Release(&filter->pInputPin->pin.IPin_iface);
+    BaseInputPin_Destroy(filter->pInputPin);
 
     if (filter->pPosition)
         IUnknown_Release(filter->pPosition);




More information about the wine-cvs mailing list