strmbase/transform: Share pin and filter reference counts.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-06-16 19:35:03 -05:00 committed by Alexandre Julliard
parent 08473519e9
commit 7f3d463b45
3 changed files with 36 additions and 20 deletions

View File

@ -229,10 +229,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);
@ -243,10 +241,8 @@ todo_wine
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);
@ -383,7 +379,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);
@ -394,9 +390,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);

View File

@ -254,10 +254,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);
@ -268,10 +266,8 @@ todo_wine
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);
@ -408,7 +404,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);
@ -418,9 +414,9 @@ static void test_pin_info(void)
ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir);
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);

View File

@ -153,9 +153,11 @@ static void transform_destroy(BaseFilter *iface)
IPin_Release(peer);
}
IPin_Disconnect(filter->ppPins[i]);
IPin_Release(filter->ppPins[i]);
}
BaseInputPin_Destroy(impl_BaseInputPin_from_IPin(filter->ppPins[0]));
BaseOutputPin_Destroy(impl_BaseOutputPin_from_IPin(filter->ppPins[1]));
CoTaskMemFree(filter->ppPins);
filter->csReceive.DebugInfo->Spare[0] = 0;
@ -379,7 +381,17 @@ HRESULT WINAPI TransformFilterImpl_Notify(TransformFilter *iface, IBaseFilter *s
return QualityControlImpl_Notify((IQualityControl*)iface->qcimpl, sender, qm);
}
/** IBaseFilter implementation **/
static ULONG WINAPI TransformFilter_InputPin_AddRef(IPin *iface)
{
BaseInputPin *pin = impl_BaseInputPin_from_IPin(iface);
return IBaseFilter_AddRef(pin->pin.pinInfo.pFilter);
}
static ULONG WINAPI TransformFilter_InputPin_Release(IPin *iface)
{
BaseInputPin *pin = impl_BaseInputPin_from_IPin(iface);
return IBaseFilter_Release(pin->pin.pinInfo.pFilter);
}
static HRESULT WINAPI TransformFilter_InputPin_EndOfStream(IPin * iface)
{
@ -504,8 +516,8 @@ static HRESULT WINAPI TransformFilter_InputPin_NewSegment(IPin * iface, REFERENC
static const IPinVtbl TransformFilter_InputPin_Vtbl =
{
BaseInputPinImpl_QueryInterface,
BasePinImpl_AddRef,
BaseInputPinImpl_Release,
TransformFilter_InputPin_AddRef,
TransformFilter_InputPin_Release,
BaseInputPinImpl_Connect,
TransformFilter_InputPin_ReceiveConnection,
TransformFilter_InputPin_Disconnect,
@ -543,11 +555,23 @@ static HRESULT WINAPI transform_source_QueryInterface(IPin *iface, REFIID iid, v
return S_OK;
}
static ULONG WINAPI transform_source_AddRef(IPin *iface)
{
BaseOutputPin *pin = impl_BaseOutputPin_from_IPin(iface);
return IBaseFilter_AddRef(pin->pin.pinInfo.pFilter);
}
static ULONG WINAPI transform_source_Release(IPin *iface)
{
BaseOutputPin *pin = impl_BaseOutputPin_from_IPin(iface);
return IBaseFilter_Release(pin->pin.pinInfo.pFilter);
}
static const IPinVtbl TransformFilter_OutputPin_Vtbl =
{
transform_source_QueryInterface,
BasePinImpl_AddRef,
BaseOutputPinImpl_Release,
transform_source_AddRef,
transform_source_Release,
BaseOutputPinImpl_Connect,
BaseOutputPinImpl_ReceiveConnection,
BaseOutputPinImpl_Disconnect,