From f91f4348356285ede39915f0d10ffae11c4871e5 Mon Sep 17 00:00:00 2001 From: Anton Baskanov Date: Mon, 2 May 2022 19:28:28 +0700 Subject: [PATCH] winegstreamer: Commit allocator on pause in MPEG audio decoder. Signed-off-by: Anton Baskanov Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/quartz/tests/mpegaudio.c | 2 +- dlls/winegstreamer/quartz_transform.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/dlls/quartz/tests/mpegaudio.c b/dlls/quartz/tests/mpegaudio.c index a2d20b52d9d..296f5f479a0 100644 --- a/dlls/quartz/tests/mpegaudio.c +++ b/dlls/quartz/tests/mpegaudio.c @@ -1005,7 +1005,7 @@ static void test_source_allocator(IFilterGraph2 *graph, IMediaControl *control, ok(hr == S_OK, "Got hr %#lx.\n", hr); hr = IMemAllocator_GetBuffer(testsink->sink.pAllocator, &sample, NULL, NULL, 0); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); if (hr == S_OK) IMediaSample_Release(sample); diff --git a/dlls/winegstreamer/quartz_transform.c b/dlls/winegstreamer/quartz_transform.c index 183fb823d40..375c549aad5 100644 --- a/dlls/winegstreamer/quartz_transform.c +++ b/dlls/winegstreamer/quartz_transform.c @@ -66,10 +66,37 @@ static void transform_destroy(struct strmbase_filter *iface) free(filter); } +static HRESULT transform_init_stream(struct strmbase_filter *iface) +{ + struct transform *filter = impl_from_strmbase_filter(iface); + HRESULT hr; + + if (filter->source.pin.peer) + { + hr = IMemAllocator_Commit(filter->source.pAllocator); + if (FAILED(hr)) + ERR("Failed to commit allocator, hr %#lx.\n", hr); + } + + return S_OK; +} + +static HRESULT transform_cleanup_stream(struct strmbase_filter *iface) +{ + struct transform *filter = impl_from_strmbase_filter(iface); + + if (filter->source.pin.peer) + IMemAllocator_Decommit(filter->source.pAllocator); + + return S_OK; +} + static const struct strmbase_filter_ops filter_ops = { .filter_get_pin = transform_get_pin, .filter_destroy = transform_destroy, + .filter_init_stream = transform_init_stream, + .filter_cleanup_stream = transform_cleanup_stream, }; static HRESULT transform_sink_query_accept(struct strmbase_pin *pin, const AM_MEDIA_TYPE *mt)