Commit 9ff3db52 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

strmbase: Factor out strmbase_renderer_cleanup().

parent 042e0625
......@@ -275,36 +275,40 @@ HRESULT WINAPI BaseRendererImpl_QueryInterface(IBaseFilter* iface, REFIID riid,
return BaseFilterImpl_QueryInterface(iface, riid, ppv);
}
ULONG WINAPI BaseRendererImpl_Release(IBaseFilter* iface)
void strmbase_renderer_cleanup(BaseRenderer *filter)
{
BaseRenderer *This = impl_from_IBaseFilter(iface);
ULONG refCount = InterlockedDecrement(&This->filter.refCount);
IPin *peer;
if (!refCount)
if (SUCCEEDED(IPin_ConnectedTo(&filter->pInputPin->pin.IPin_iface, &peer)))
{
IPin *pConnectedTo;
if (SUCCEEDED(IPin_ConnectedTo(&This->pInputPin->pin.IPin_iface, &pConnectedTo)))
{
IPin_Disconnect(pConnectedTo);
IPin_Release(pConnectedTo);
IPin_Disconnect(peer);
IPin_Release(peer);
}
IPin_Disconnect(&This->pInputPin->pin.IPin_iface);
IPin_Release(&This->pInputPin->pin.IPin_iface);
IPin_Disconnect(&filter->pInputPin->pin.IPin_iface);
IPin_Release(&filter->pInputPin->pin.IPin_iface);
if (This->pPosition)
IUnknown_Release(This->pPosition);
if (filter->pPosition)
IUnknown_Release(filter->pPosition);
This->csRenderLock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->csRenderLock);
filter->csRenderLock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&filter->csRenderLock);
BaseRendererImpl_ClearPendingSample(filter);
CloseHandle(filter->evComplete);
CloseHandle(filter->ThreadSignal);
CloseHandle(filter->RenderEvent);
QualityControlImpl_Destroy(filter->qcimpl);
BaseFilter_Destroy(&filter->filter);
}
ULONG WINAPI BaseRendererImpl_Release(IBaseFilter* iface)
{
BaseRenderer *This = impl_from_IBaseFilter(iface);
ULONG refCount = InterlockedDecrement(&This->filter.refCount);
if (!refCount)
strmbase_renderer_cleanup(This);
BaseRendererImpl_ClearPendingSample(This);
CloseHandle(This->evComplete);
CloseHandle(This->ThreadSignal);
CloseHandle(This->RenderEvent);
QualityControlImpl_Destroy(This->qcimpl);
BaseFilter_Destroy(&This->filter);
}
return refCount;
}
......
......@@ -623,6 +623,7 @@ HRESULT WINAPI BaseRendererImpl_ClearPendingSample(BaseRenderer *iface);
HRESULT WINAPI strmbase_renderer_init(BaseRenderer *filter, const IBaseFilterVtbl *vtbl,
IUnknown *outer, const CLSID *clsid, const WCHAR *sink_name, DWORD_PTR debug_info,
const BaseRendererFuncTable *func_table);
void strmbase_renderer_cleanup(BaseRenderer *filter);
#ifdef __IBasicAudio_FWD_DEFINED__
typedef struct tagBasicAudio
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment