quartz: Immediately return failure from IFilterGraph::RemoveFilter() if IPin::Disconnect() fails.

Do not try to stop the filter.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-11-15 11:04:37 -06:00 committed by Alexandre Julliard
parent be1ccdf73f
commit bd1174e125
2 changed files with 22 additions and 26 deletions

View File

@ -704,14 +704,11 @@ static HRESULT WINAPI FilterGraph2_RemoveFilter(IFilterGraph2 *iface, IBaseFilte
TRACE("(%p/%p)->(%p)\n", This, iface, pFilter);
/* FIXME: check graph is stopped */
LIST_FOR_EACH_ENTRY(entry, &This->filters, struct filter, entry)
{
if (entry->filter == pFilter)
{
IEnumPins *penumpins = NULL;
FILTER_STATE state;
if (This->defaultclock && This->refClockProvider == pFilter)
{
@ -726,31 +723,30 @@ static HRESULT WINAPI FilterGraph2_RemoveFilter(IFilterGraph2 *iface, IBaseFilte
IPin *ppin;
while(IEnumPins_Next(penumpins, 1, &ppin, NULL) == S_OK)
{
IPin *victim = NULL;
HRESULT h;
IPin_ConnectedTo(ppin, &victim);
if (victim)
{
h = IPin_Disconnect(victim);
TRACE("Disconnect other side: %08x\n", h);
if (h == VFW_E_NOT_STOPPED)
{
PIN_INFO pinfo;
IPin_QueryPinInfo(victim, &pinfo);
IPin *peer = NULL;
HRESULT hr;
IBaseFilter_GetState(pinfo.pFilter, 0, &state);
if (state == State_Running)
IBaseFilter_Pause(pinfo.pFilter);
IBaseFilter_Stop(pinfo.pFilter);
IBaseFilter_Release(pinfo.pFilter);
h = IPin_Disconnect(victim);
TRACE("Disconnect retry: %08x\n", h);
IPin_ConnectedTo(ppin, &peer);
if (peer)
{
if (FAILED(hr = IPin_Disconnect(peer)))
{
WARN("Failed to disconnect peer %p, hr %#x.\n", peer, hr);
IPin_Release(peer);
IPin_Release(ppin);
IEnumPins_Release(penumpins);
return hr;
}
IPin_Release(victim);
}
h = IPin_Disconnect(ppin);
TRACE("Disconnect 2: %08x\n", h);
IPin_Release(peer);
if (FAILED(hr = IPin_Disconnect(ppin)))
{
WARN("Failed to disconnect pin %p, hr %#x.\n", ppin, hr);
IPin_Release(ppin);
IEnumPins_Release(penumpins);
return hr;
}
}
IPin_Release(ppin);
}
IEnumPins_Release(penumpins);

View File

@ -3130,7 +3130,7 @@ todo_wine
source_pin.require_stopped_disconnect = TRUE;
hr = IFilterGraph2_RemoveFilter(graph, &source.IBaseFilter_iface);
todo_wine ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
@ -3139,7 +3139,7 @@ todo_wine
source_pin.require_stopped_disconnect = FALSE;
sink_pin.require_stopped_disconnect = TRUE;
hr = IFilterGraph2_RemoveFilter(graph, &source.IBaseFilter_iface);
todo_wine ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
ok(sink_pin.peer == &source_pin.IPin_iface, "Got peer %p.\n", sink_pin.peer);