From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mf/evr.c | 26 ++++++++++++++++++++++++-- dlls/mf/tests/mf.c | 1 - 2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index b035b8b601b..d9808504733 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -279,6 +279,8 @@ static ULONG WINAPI video_stream_sink_Release(IMFStreamSink *iface) struct video_stream *stream = impl_from_IMFStreamSink(iface); ULONG refcount = InterlockedDecrement(&stream->refcount);
+ TRACE("%p, refcount %lu.\n", iface, refcount); + if (!refcount) { if (stream->event_queue) @@ -1745,6 +1747,28 @@ static HRESULT WINAPI video_renderer_InitializeRenderer(IMFVideoRenderer *iface,
TRACE("%p, %p, %p.\n", iface, mixer, presenter);
+ EnterCriticalSection(&renderer->cs); + + if (renderer->mixer) + { + video_renderer_release_services(renderer); + IMFTransform_Release(renderer->mixer); + renderer->mixer = NULL; + } + + if (renderer->presenter) + { + video_renderer_release_presenter_services(renderer); + IMFVideoPresenter_Release(renderer->presenter); + renderer->presenter = NULL; + } + + if (renderer->device_manager) + { + IUnknown_Release(renderer->device_manager); + renderer->device_manager = NULL; + } + if (mixer) IMFTransform_AddRef(mixer); else if (FAILED(hr = video_renderer_create_mixer(NULL, &mixer))) @@ -1762,8 +1786,6 @@ static HRESULT WINAPI video_renderer_InitializeRenderer(IMFVideoRenderer *iface, return hr; }
- EnterCriticalSection(&renderer->cs); - if (renderer->flags & EVR_SHUT_DOWN) hr = MF_E_SHUTDOWN; else diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index ab380d1c475..adc6f7134d5 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -4765,7 +4765,6 @@ static void test_evr(void) IMFMediaSink_Release(sink);
ref = IMFVideoRenderer_Release(video_renderer); - todo_wine ok(ref == 0, "Release returned %ld\n", ref);
hr = MFCreateVideoRendererActivate(NULL, NULL);