From: Brendan McGrath <bmcgrath@codeweavers.com> --- dlls/amstream/ddrawstream.c | 9 +++++++++ dlls/amstream/tests/amstream.c | 4 ---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index 29e17f54542..9f5b1fe2c4f 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -92,6 +92,7 @@ struct ddraw_sample struct list entry; HRESULT update_hr; bool pending; + bool needs_mt; }; static HRESULT ddrawstreamsample_create(struct ddraw_stream *parent, IDirectDrawSurface *surface, @@ -2136,6 +2137,7 @@ static ULONG WINAPI media_sample_Release(IMediaSample *iface) if (!refcount) { IDirectDrawSurface_Unlock(sample->surface, NULL); + sample->needs_mt = false; WakeConditionVariable(&sample->update_cv); @@ -2288,6 +2290,12 @@ static HRESULT WINAPI media_sample_GetMediaType(IMediaSample *iface, AM_MEDIA_TY TRACE("sample %p, ret_mt %p.\n", sample, ret_mt); + if (!sample->needs_mt) + { + *ret_mt = NULL; + return S_FALSE; + } + /* Note that this usually matches the media type we pass to QueryAccept(), * but not if there's a sub-rect. * That's amstream just breaking the DirectShow rules. @@ -2415,6 +2423,7 @@ static HRESULT ddrawstreamsample_create(struct ddraw_stream *parent, IDirectDraw object->ref = 1; object->parent = parent; object->mmstream = parent->parent; + object->needs_mt = true; InitializeConditionVariable(&object->update_cv); IAMMediaStream_AddRef(&parent->IAMMediaStream_iface); if (object->mmstream) diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 064aa777185..eb9c8f3e745 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -8998,9 +8998,7 @@ static void test_ddrawstream_mem_allocator(void) /* Confirm that because sample3 has been released, we no longer get the media type */ sample_mt = (AM_MEDIA_TYPE*)0xc0ffee; hr = IMediaSample_GetMediaType(media_sample3, &sample_mt); - todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr); - todo_wine ok(sample_mt == NULL, "Got sample_mt %p.\n", sample_mt); /* Check that we still get MediaType on a second call to sample1 */ @@ -9101,9 +9099,7 @@ static void test_ddrawstream_mem_allocator(void) sample_mt = (AM_MEDIA_TYPE*)0xc0ffee; hr = IMediaSample_GetMediaType(media_sample1, &sample_mt); - todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr); - todo_wine ok(sample_mt == NULL, "Got sample_mt %p.\n", sample_mt); start = end = 0xdeadbeef; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10583