mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-15 21:32:57 +00:00
winegstreamer: Release requested samples if they are too small.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
This commit is contained in:
parent
7187965a75
commit
7e046aa49e
|
@ -150,6 +150,7 @@ static GstMemory *wg_allocator_alloc(GstAllocator *gst_allocator, gsize size,
|
||||||
GstAllocationParams *params)
|
GstAllocationParams *params)
|
||||||
{
|
{
|
||||||
WgAllocator *allocator = (WgAllocator *)gst_allocator;
|
WgAllocator *allocator = (WgAllocator *)gst_allocator;
|
||||||
|
struct wg_sample *sample;
|
||||||
WgMemory *memory;
|
WgMemory *memory;
|
||||||
|
|
||||||
GST_LOG("allocator %p, size %#zx, params %p", allocator, size, params);
|
GST_LOG("allocator %p, size %#zx, params %p", allocator, size, params);
|
||||||
|
@ -162,7 +163,12 @@ static GstMemory *wg_allocator_alloc(GstAllocator *gst_allocator, gsize size,
|
||||||
|
|
||||||
pthread_mutex_lock(&allocator->mutex);
|
pthread_mutex_lock(&allocator->mutex);
|
||||||
|
|
||||||
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);
|
list_add_tail(&allocator->memory_list, &memory->entry);
|
||||||
|
|
||||||
pthread_mutex_unlock(&allocator->mutex);
|
pthread_mutex_unlock(&allocator->mutex);
|
||||||
|
|
|
@ -310,15 +310,10 @@ static bool transform_append_element(struct wg_transform *transform, GstElement
|
||||||
static struct wg_sample *transform_request_sample(gsize size, void *context)
|
static struct wg_sample *transform_request_sample(gsize size, void *context)
|
||||||
{
|
{
|
||||||
struct wg_transform *transform = context;
|
struct wg_transform *transform = context;
|
||||||
struct wg_sample *sample;
|
|
||||||
|
|
||||||
GST_LOG("size %#zx, context %p", size, transform);
|
GST_LOG("size %#zx, context %p", size, transform);
|
||||||
|
|
||||||
sample = InterlockedExchangePointer((void **)&transform->output_wg_sample, NULL);
|
return InterlockedExchangePointer((void **)&transform->output_wg_sample, NULL);
|
||||||
if (!sample || sample->max_size < size)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return sample;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS wg_transform_create(void *args)
|
NTSTATUS wg_transform_create(void *args)
|
||||||
|
|
Loading…
Reference in a new issue