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, ...@@ -275,36 +275,40 @@ HRESULT WINAPI BaseRendererImpl_QueryInterface(IBaseFilter* iface, REFIID riid,
return BaseFilterImpl_QueryInterface(iface, riid, ppv); return BaseFilterImpl_QueryInterface(iface, riid, ppv);
} }
ULONG WINAPI BaseRendererImpl_Release(IBaseFilter* iface) void strmbase_renderer_cleanup(BaseRenderer *filter)
{ {
BaseRenderer *This = impl_from_IBaseFilter(iface); IPin *peer;
ULONG refCount = InterlockedDecrement(&This->filter.refCount);
if (!refCount) if (SUCCEEDED(IPin_ConnectedTo(&filter->pInputPin->pin.IPin_iface, &peer)))
{ {
IPin *pConnectedTo; IPin_Disconnect(peer);
IPin_Release(peer);
}
IPin_Disconnect(&filter->pInputPin->pin.IPin_iface);
IPin_Release(&filter->pInputPin->pin.IPin_iface);
if (SUCCEEDED(IPin_ConnectedTo(&This->pInputPin->pin.IPin_iface, &pConnectedTo))) if (filter->pPosition)
{ IUnknown_Release(filter->pPosition);
IPin_Disconnect(pConnectedTo);
IPin_Release(pConnectedTo); filter->csRenderLock.DebugInfo->Spare[0] = 0;
} DeleteCriticalSection(&filter->csRenderLock);
IPin_Disconnect(&This->pInputPin->pin.IPin_iface);
IPin_Release(&This->pInputPin->pin.IPin_iface);
if (This->pPosition) BaseRendererImpl_ClearPendingSample(filter);
IUnknown_Release(This->pPosition); 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);
This->csRenderLock.DebugInfo->Spare[0] = 0; if (!refCount)
DeleteCriticalSection(&This->csRenderLock); 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; return refCount;
} }
......
...@@ -623,6 +623,7 @@ HRESULT WINAPI BaseRendererImpl_ClearPendingSample(BaseRenderer *iface); ...@@ -623,6 +623,7 @@ HRESULT WINAPI BaseRendererImpl_ClearPendingSample(BaseRenderer *iface);
HRESULT WINAPI strmbase_renderer_init(BaseRenderer *filter, const IBaseFilterVtbl *vtbl, HRESULT WINAPI strmbase_renderer_init(BaseRenderer *filter, const IBaseFilterVtbl *vtbl,
IUnknown *outer, const CLSID *clsid, const WCHAR *sink_name, DWORD_PTR debug_info, IUnknown *outer, const CLSID *clsid, const WCHAR *sink_name, DWORD_PTR debug_info,
const BaseRendererFuncTable *func_table); const BaseRendererFuncTable *func_table);
void strmbase_renderer_cleanup(BaseRenderer *filter);
#ifdef __IBasicAudio_FWD_DEFINED__ #ifdef __IBasicAudio_FWD_DEFINED__
typedef struct tagBasicAudio 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