quartz/avidec: Don't send ICM_DECOMPRESS_BEGIN or ICM_DECOMPRESS_END messages if the source is disconnected.

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-19 17:24:12 -06:00 committed by Alexandre Julliard
parent e7d088a629
commit cf7717b830
2 changed files with 17 additions and 12 deletions

View File

@ -565,6 +565,9 @@ static HRESULT avi_decompressor_init_stream(struct strmbase_filter *iface)
LRESULT res;
HRESULT hr;
if (!filter->source.pin.peer)
return S_OK;
filter->late = -1;
source_format = (VIDEOINFOHEADER *)filter->sink.pin.mt.pbFormat;
@ -574,7 +577,7 @@ static HRESULT avi_decompressor_init_stream(struct strmbase_filter *iface)
return E_FAIL;
}
if (filter->source.pin.peer && FAILED(hr = IMemAllocator_Commit(filter->source.pAllocator)))
if (FAILED(hr = IMemAllocator_Commit(filter->source.pAllocator)))
ERR("Failed to commit allocator, hr %#x.\n", hr);
return S_OK;
@ -585,14 +588,16 @@ static HRESULT avi_decompressor_cleanup_stream(struct strmbase_filter *iface)
struct avi_decompressor *filter = impl_from_strmbase_filter(iface);
LRESULT res;
if (!filter->source.pin.peer)
return S_OK;
if (filter->hvid && (res = ICDecompressEnd(filter->hvid)))
{
ERR("ICDecompressEnd() failed, error %ld.\n", res);
return E_FAIL;
}
if (filter->source.pin.peer)
IMemAllocator_Decommit(filter->source.pAllocator);
IMemAllocator_Decommit(filter->source.pAllocator);
return S_OK;
}

View File

@ -692,25 +692,25 @@ static void test_unconnected_filter_state(void)
ok(state == State_Stopped, "Got state %u.\n", state);
hr = IBaseFilter_Pause(filter);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(state == State_Paused, "Got state %u.\n", state);
ok(state == State_Paused, "Got state %u.\n", state);
hr = IBaseFilter_Run(filter, 0);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(state == State_Running, "Got state %u.\n", state);
ok(state == State_Running, "Got state %u.\n", state);
hr = IBaseFilter_Pause(filter);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(state == State_Paused, "Got state %u.\n", state);
ok(state == State_Paused, "Got state %u.\n", state);
hr = IBaseFilter_Stop(filter);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@ -720,11 +720,11 @@ static void test_unconnected_filter_state(void)
ok(state == State_Stopped, "Got state %u.\n", state);
hr = IBaseFilter_Run(filter, 0);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(state == State_Running, "Got state %u.\n", state);
ok(state == State_Running, "Got state %u.\n", state);
hr = IBaseFilter_Stop(filter);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@ -956,7 +956,7 @@ static void test_connect_pin(void)
ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
hr = IMediaControl_Pause(control);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
hr = IMediaControl_Stop(control);