mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
kms: drop use of GSlice allocator and remove unnecessary check
g_new0() will never return NULL but just abort if it can't allocate memory (same for g_slice_new). Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3784>
This commit is contained in:
parent
35405de344
commit
85476eab08
1 changed files with 4 additions and 8 deletions
|
@ -234,7 +234,7 @@ gst_kms_allocator_free (GstAllocator * allocator, GstMemory * mem)
|
||||||
kmsmem = (GstKMSMemory *) mem;
|
kmsmem = (GstKMSMemory *) mem;
|
||||||
|
|
||||||
gst_kms_allocator_memory_reset (alloc, kmsmem);
|
gst_kms_allocator_memory_reset (alloc, kmsmem);
|
||||||
g_slice_free (GstKMSMemory, kmsmem);
|
g_free (kmsmem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -460,16 +460,14 @@ gst_kms_allocator_bo_alloc (GstAllocator * allocator, GstVideoInfo * vinfo)
|
||||||
GstKMSMemory *kmsmem;
|
GstKMSMemory *kmsmem;
|
||||||
GstMemory *mem;
|
GstMemory *mem;
|
||||||
|
|
||||||
kmsmem = g_slice_new0 (GstKMSMemory);
|
kmsmem = g_new0 (GstKMSMemory, 1);
|
||||||
if (!kmsmem)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
alloc = GST_KMS_ALLOCATOR (allocator);
|
alloc = GST_KMS_ALLOCATOR (allocator);
|
||||||
|
|
||||||
mem = GST_MEMORY_CAST (kmsmem);
|
mem = GST_MEMORY_CAST (kmsmem);
|
||||||
|
|
||||||
if (!gst_kms_allocator_memory_create (alloc, kmsmem, vinfo)) {
|
if (!gst_kms_allocator_memory_create (alloc, kmsmem, vinfo)) {
|
||||||
g_slice_free (GstKMSMemory, kmsmem);
|
g_free (kmsmem);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,9 +496,7 @@ gst_kms_allocator_dmabuf_import (GstAllocator * allocator, gint * prime_fds,
|
||||||
|
|
||||||
g_return_val_if_fail (n_planes <= GST_VIDEO_MAX_PLANES, FALSE);
|
g_return_val_if_fail (n_planes <= GST_VIDEO_MAX_PLANES, FALSE);
|
||||||
|
|
||||||
kmsmem = g_slice_new0 (GstKMSMemory);
|
kmsmem = g_new0 (GstKMSMemory, 1);
|
||||||
if (!kmsmem)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
mem = GST_MEMORY_CAST (kmsmem);
|
mem = GST_MEMORY_CAST (kmsmem);
|
||||||
gst_memory_init (mem, GST_MEMORY_FLAG_NO_SHARE, allocator, NULL,
|
gst_memory_init (mem, GST_MEMORY_FLAG_NO_SHARE, allocator, NULL,
|
||||||
|
|
Loading…
Reference in a new issue