From: "Rémi Bernon" Subject: [PATCH v5 4/5] winegstreamer: Release requested samples if they are too small. Message-Id: Date: Thu, 30 Jun 2022 12:33:44 +0000 In-Reply-To: References: From: Rémi Bernon Signed-off-by: Rémi Bernon --- dlls/winegstreamer/wg_allocator.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dlls/winegstreamer/wg_allocator.c b/dlls/winegstreamer/wg_allocator.c index 53ea5d08c8e..46343db8aae 100644 --- a/dlls/winegstreamer/wg_allocator.c +++ b/dlls/winegstreamer/wg_allocator.c @@ -80,9 +80,6 @@ static struct wg_sample *default_request_sample(gsize size, void *context) return NULL; allocator->next_sample = NULL; - if (sample->max_size < size) - return NULL; - return sample; } @@ -165,6 +162,7 @@ static GstMemory *wg_allocator_alloc(GstAllocator *gst_allocator, gsize size, GstAllocationParams *params) { WgAllocator *allocator = (WgAllocator *)gst_allocator; + struct wg_sample *sample; WgMemory *memory; GST_LOG("allocator %p, size %#zx, params %p", allocator, size, params); @@ -177,7 +175,12 @@ static GstMemory *wg_allocator_alloc(GstAllocator *gst_allocator, gsize size, GST_OBJECT_LOCK(allocator); - memory->sample = allocator->request_sample(size, allocator->request_sample_context); + sample = allocator->request_sample(size, allocator->request_sample_context); + if (sample->max_size < size) + InterlockedDecrement(&sample->refcount); + else + memory->sample = sample; + list_add_tail(&allocator->memory_list, &memory->entry); GST_OBJECT_UNLOCK(allocator); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/302