From: Ziqing Hui zhui@codeweavers.com
--- dlls/qasf/dmowrapper.c | 19 +++++++------------ dlls/qasf/tests/dmowrapper.c | 11 ----------- 2 files changed, 7 insertions(+), 23 deletions(-)
diff --git a/dlls/qasf/dmowrapper.c b/dlls/qasf/dmowrapper.c index 8d2d24cc12f..4b9c3507160 100644 --- a/dlls/qasf/dmowrapper.c +++ b/dlls/qasf/dmowrapper.c @@ -245,17 +245,16 @@ static HRESULT get_output_samples(struct dmo_wrapper *filter) static HRESULT process_output(struct dmo_wrapper *filter, IMediaObject *dmo) { DMO_OUTPUT_DATA_BUFFER *buffers = filter->buffers; + HRESULT hr = S_OK, process_hr; DWORD status, i; BOOL more_data; - HRESULT hr;
do { more_data = FALSE;
- hr = IMediaObject_ProcessOutput(dmo, DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER, - filter->source_count, buffers, &status); - if (hr != S_OK) + if (FAILED(process_hr = IMediaObject_ProcessOutput(dmo, DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER, + filter->source_count, buffers, &status))) break;
for (i = 0; i < filter->source_count; ++i) @@ -284,7 +283,7 @@ static HRESULT process_output(struct dmo_wrapper *filter, IMediaObject *dmo)
if (IMediaSample_GetActualDataLength(sample)) { - if (FAILED(hr = IMemInputPin_Receive(filter->sources[i].pin.pMemInputPin, sample))) + if ((hr = IMemInputPin_Receive(filter->sources[i].pin.pMemInputPin, sample)) != S_OK) { WARN("Downstream sink returned %#lx.\n", hr); release_output_samples(filter); @@ -305,9 +304,9 @@ static HRESULT WINAPI dmo_wrapper_sink_Receive(struct strmbase_sink *iface, IMed struct dmo_wrapper *filter = impl_from_strmbase_filter(iface->pin.filter); DWORD index = iface - filter->sinks; REFERENCE_TIME start = 0, stop = 0; - HRESULT process_hr, hr; IMediaObject *dmo; DWORD flags = 0; + HRESULT hr;
if (filter->filter.state == State_Stopped) return VFW_E_WRONG_STATE; @@ -329,11 +328,8 @@ static HRESULT WINAPI dmo_wrapper_sink_Receive(struct strmbase_sink *iface, IMed * states that we should call ProcessOutput() again in this case. */ if (FAILED(hr = get_output_samples(filter))) goto out; - if (FAILED(process_hr = process_output(filter, dmo))) - { - hr = process_hr; + if ((hr = process_output(filter, dmo)) != S_OK) goto out; - } }
if (FAILED(hr = get_output_samples(filter))) @@ -357,8 +353,7 @@ static HRESULT WINAPI dmo_wrapper_sink_Receive(struct strmbase_sink *iface, IMed goto out; }
- if (FAILED(process_hr = process_output(filter, dmo))) - hr = process_hr; + hr = process_output(filter, dmo);
out: filter->input_buffer.sample = NULL; diff --git a/dlls/qasf/tests/dmowrapper.c b/dlls/qasf/tests/dmowrapper.c index afea0b86a4c..4ade744d105 100644 --- a/dlls/qasf/tests/dmowrapper.c +++ b/dlls/qasf/tests/dmowrapper.c @@ -1766,13 +1766,9 @@ static void test_sample_processing(IMediaControl *control, IMemInputPin *input, /* Test Receive if downstream Receive return S_FALSE. */ sink_receive_hr = S_FALSE; hr = IMemInputPin_Receive(input, sample); - todo_wine ok(hr == S_FALSE, "Receive returned %#lx.\n", hr); - todo_wine ok(got_ProcessInput == 0, "Got %u calls to ProcessInput().\n", got_ProcessInput); - todo_wine ok(got_ProcessOutput == 1, "Got %u calls to ProcessOutput().\n", got_ProcessOutput); - todo_wine ok(got_Receive == 1, "Got %u calls to Receive().\n", got_Receive); ok(got_Discontinuity == 1, "Got %u calls to Discontinuity().\n", got_Discontinuity); got_ProcessInput = got_ProcessOutput = got_Receive = got_Discontinuity = 0; @@ -1785,7 +1781,6 @@ static void test_sample_processing(IMediaControl *control, IMemInputPin *input, ok(hr == S_OK, "Receive returned %#lx.\n", hr); ok(got_ProcessInput == 1, "Got %u calls to ProcessInput().\n", got_ProcessInput); ok(got_ProcessOutput == 2, "Got %u calls to ProcessOutput().\n", got_ProcessOutput); - todo_wine ok(got_Receive == 2, "Got %u calls to Receive().\n", got_Receive); ok(got_Discontinuity == 1, "Got %u calls to Discontinuity().\n", got_Discontinuity); got_ProcessInput = got_ProcessOutput = got_Receive = got_Discontinuity = 0; @@ -1793,11 +1788,8 @@ static void test_sample_processing(IMediaControl *control, IMemInputPin *input, /* Test Receive if ProcessOutput fails. */ process_output_hr = E_FAIL; hr = IMemInputPin_Receive(input, sample); - todo_wine ok(hr == S_OK, "Receive returned %#lx.\n", hr); - todo_wine ok(got_ProcessInput == 1, "Got %u calls to ProcessInput().\n", got_ProcessInput); - todo_wine ok(got_ProcessOutput == 2, "Got %u calls to ProcessOutput().\n", got_ProcessOutput); ok(got_Receive == 0, "Got %u calls to Receive().\n", got_Receive); ok(got_Discontinuity == 1, "Got %u calls to Discontinuity().\n", got_Discontinuity); @@ -1806,11 +1798,8 @@ static void test_sample_processing(IMediaControl *control, IMemInputPin *input, /* Test Receive if ProcessOutput needs more inputs. */ process_output_hr = MF_E_TRANSFORM_NEED_MORE_INPUT; hr = IMemInputPin_Receive(input, sample); - todo_wine ok(hr == S_OK, "Receive returned %#lx.\n", hr); - todo_wine ok(got_ProcessInput == 1, "Got %u calls to ProcessInput().\n", got_ProcessInput); - todo_wine ok(got_ProcessOutput == 2, "Got %u calls to ProcessOutput().\n", got_ProcessOutput); ok(got_Receive == 0, "Got %u calls to Receive().\n", got_Receive); ok(got_Discontinuity == 1, "Got %u calls to Discontinuity().\n", got_Discontinuity);