-- v2: mfmediaengine: Implement RemoveAllEffects(). mfmediaengine/tests: Add tests for RemoveAllEffects().
From: Bernhard Kölbl bkoelbl@codeweavers.com
Signed-off-by: Bernhard Kölbl bkoelbl@codeweavers.com --- dlls/mfmediaengine/tests/mfmediaengine.c | 28 +++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index aa9de414fcb..5e2fc3099a8 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -1823,6 +1823,9 @@ static void test_effect(void) hr = ID3D11Device_CreateTexture2D(device, &desc, NULL, &texture); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+ hr = IMFMediaEngineEx_RemoveAllEffects(media_engine_ex); + todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = passthrough_mft_create(0, &video_effect); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
@@ -1837,6 +1840,22 @@ static void test_effect(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); EXPECT_REF(&video_effect2->IMFTransform_iface, 2);
+ hr = IMFMediaEngineEx_RemoveAllEffects(media_engine_ex); + todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine EXPECT_REF(&video_effect->IMFTransform_iface, 1); + todo_wine EXPECT_REF(&video_effect2->IMFTransform_iface, 1); + + if (FAILED(hr)) /* Temporary skip */ + goto done; + + hr = IMFMediaEngineEx_InsertVideoEffect(media_engine_ex, (IUnknown *)&video_effect->IMFTransform_iface, FALSE); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine EXPECT_REF(&video_effect->IMFTransform_iface, 2); + + hr = IMFMediaEngineEx_InsertVideoEffect(media_engine_ex, (IUnknown *)&video_effect2->IMFTransform_iface, FALSE); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine EXPECT_REF(&video_effect2->IMFTransform_iface, 2); + hr = passthrough_mft_create(0, &audio_effect); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
@@ -1891,8 +1910,11 @@ done: { IMFMediaEngineEx_Shutdown(media_engine_ex);
+ hr = IMFMediaEngineEx_RemoveAllEffects(media_engine_ex); + todo_wine ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr); + ref = IMFMediaEngineEx_Release(media_engine_ex); - todo_wine ok(!ref, "Unexpected ref %lu.\n", ref); + ok(!ref, "Unexpected ref %lu.\n", ref); }
if (texture) @@ -1914,12 +1936,12 @@ done: if (video_effect2) { ref = IMFTransform_Release(&video_effect2->IMFTransform_iface); - todo_wine ok(!ref, "Unexpected ref %lu.\n", ref); + ok(!ref, "Unexpected ref %lu.\n", ref); } if (video_effect) { ref = IMFTransform_Release(&video_effect->IMFTransform_iface); - todo_wine ok(!ref, "Unexpected ref %lu.\n", ref); + ok(!ref, "Unexpected ref %lu.\n", ref); }
IMFMediaEngineNotify_Release(¬ify->IMFMediaEngineNotify_iface);
From: Bernhard Kölbl bkoelbl@codeweavers.com
Signed-off-by: Bernhard Kölbl bkoelbl@codeweavers.com --- dlls/mfmediaengine/main.c | 12 ++++++++++-- dlls/mfmediaengine/tests/mfmediaengine.c | 23 ++++++++++------------- 2 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index 925d9c3566e..8d7ab4eeec7 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -2719,9 +2719,17 @@ static HRESULT WINAPI media_engine_InsertAudioEffect(IMFMediaEngineEx *iface, IU
static HRESULT WINAPI media_engine_RemoveAllEffects(IMFMediaEngineEx *iface) { - FIXME("%p stub.\n", iface); + struct media_engine *engine = impl_from_IMFMediaEngineEx(iface);
- return E_NOTIMPL; + TRACE("%p.\n", iface); + + if (engine->flags & FLAGS_ENGINE_SHUT_DOWN) + return MF_E_SHUTDOWN; + + media_engine_clear_effects(&engine->audio_effects); + media_engine_clear_effects(&engine->video_effects); + + return S_OK; }
static HRESULT WINAPI media_engine_SetTimelineMarkerTimer(IMFMediaEngineEx *iface, double timeout) diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index 5e2fc3099a8..bba9a0c5904 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -1824,7 +1824,7 @@ static void test_effect(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMFMediaEngineEx_RemoveAllEffects(media_engine_ex); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = passthrough_mft_create(0, &video_effect); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -1841,20 +1841,17 @@ static void test_effect(void) EXPECT_REF(&video_effect2->IMFTransform_iface, 2);
hr = IMFMediaEngineEx_RemoveAllEffects(media_engine_ex); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine EXPECT_REF(&video_effect->IMFTransform_iface, 1); - todo_wine EXPECT_REF(&video_effect2->IMFTransform_iface, 1); - - if (FAILED(hr)) /* Temporary skip */ - goto done; + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + EXPECT_REF(&video_effect->IMFTransform_iface, 1); + EXPECT_REF(&video_effect2->IMFTransform_iface, 1);
hr = IMFMediaEngineEx_InsertVideoEffect(media_engine_ex, (IUnknown *)&video_effect->IMFTransform_iface, FALSE); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine EXPECT_REF(&video_effect->IMFTransform_iface, 2); + EXPECT_REF(&video_effect->IMFTransform_iface, 2);
hr = IMFMediaEngineEx_InsertVideoEffect(media_engine_ex, (IUnknown *)&video_effect2->IMFTransform_iface, FALSE); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine EXPECT_REF(&video_effect2->IMFTransform_iface, 2); + EXPECT_REF(&video_effect2->IMFTransform_iface, 2);
hr = passthrough_mft_create(0, &audio_effect); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -1911,10 +1908,10 @@ done: IMFMediaEngineEx_Shutdown(media_engine_ex);
hr = IMFMediaEngineEx_RemoveAllEffects(media_engine_ex); - todo_wine ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr);
ref = IMFMediaEngineEx_Release(media_engine_ex); - ok(!ref, "Unexpected ref %lu.\n", ref); + todo_wine ok(!ref, "Unexpected ref %lu.\n", ref); }
if (texture) @@ -1936,12 +1933,12 @@ done: if (video_effect2) { ref = IMFTransform_Release(&video_effect2->IMFTransform_iface); - ok(!ref, "Unexpected ref %lu.\n", ref); + todo_wine ok(!ref, "Unexpected ref %lu.\n", ref); } if (video_effect) { ref = IMFTransform_Release(&video_effect->IMFTransform_iface); - ok(!ref, "Unexpected ref %lu.\n", ref); + todo_wine ok(!ref, "Unexpected ref %lu.\n", ref); }
IMFMediaEngineNotify_Release(¬ify->IMFMediaEngineNotify_iface);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=135003
Your paranoid android.
=== w864 (32 bit report) ===
mfmediaengine: mfmediaengine.c:1889: Test failed: Unexpected processing count 0. mfmediaengine.c:1890: Test failed: Unexpected processing count 0. mfmediaengine.c:1894: Test failed: Unexpected processing count 0. mfmediaengine.c:1895: Test failed: Unexpected processing count 0.
=== w1064v1809 (32 bit report) ===
mfmediaengine: mfmediaengine.c:1925: Test failed: Unexpected ref 4.
=== w11pro64_amd (64 bit report) ===
mfmediaengine: mfmediaengine.c:1914: Test failed: Unexpected ref 1.
v2: - Add check for shutdown state.
Now locking is missing. Also looks like tests fail occasionally.
On Wed Jul 19 14:29:28 2023 +0000, Nikolay Sivov wrote:
Now locking is missing. Also looks like tests fail occasionally.
About the tests, is it really possible to make them consistent? My guess is that Windows sometimes has issues cleaning up, but this, imho, doesn't mean we shouldn't avoid testing for proper cleanup in Wine. So in other words, idk how to address this without deleting the tests, which I think is not good.
On Wed Jul 19 14:29:28 2023 +0000, Bernhard Kölbl wrote:
About the tests, is it really possible to make them consistent? My guess is that Windows sometimes has issues cleaning up, but this, imho, doesn't mean we shouldn't avoid testing for proper cleanup in Wine. So in other words, idk how to address this without deleting the tests, which I think is not good.
That's something to figure out.
On Wed Jul 19 14:36:56 2023 +0000, Nikolay Sivov wrote:
That's something to figure out.
Iirc, doing a little sleep, like 50, did make it very consistent.