gst-omx: drop use of GSlice allocator

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3784>
This commit is contained in:
Tim-Philipp Müller 2023-01-24 19:53:40 +00:00 committed by GStreamer Marge Bot
parent 0d9bdf238c
commit cae6c6c73a
4 changed files with 25 additions and 25 deletions

View file

@ -82,7 +82,7 @@ gst_omx_core_acquire (const gchar * filename)
core = g_hash_table_lookup (core_handles, filename); core = g_hash_table_lookup (core_handles, filename);
if (!core) { if (!core) {
core = g_slice_new0 (GstOMXCore); core = g_new0 (GstOMXCore, 1);
g_mutex_init (&core->lock); g_mutex_init (&core->lock);
core->user_count = 0; core->user_count = 0;
g_hash_table_insert (core_handles, g_strdup (filename), core); g_hash_table_insert (core_handles, g_strdup (filename), core);
@ -189,7 +189,7 @@ error:
{ {
g_hash_table_remove (core_handles, filename); g_hash_table_remove (core_handles, filename);
g_mutex_clear (&core->lock); g_mutex_clear (&core->lock);
g_slice_free (GstOMXCore, core); g_free (core);
G_UNLOCK (core_handles); G_UNLOCK (core_handles);
@ -231,7 +231,7 @@ gst_omx_component_flush_messages (GstOMXComponent * comp)
g_mutex_lock (&comp->messages_lock); g_mutex_lock (&comp->messages_lock);
while ((msg = g_queue_pop_head (&comp->messages))) { while ((msg = g_queue_pop_head (&comp->messages))) {
g_slice_free (GstOMXMessage, msg); g_free (msg);
} }
g_mutex_unlock (&comp->messages_lock); g_mutex_unlock (&comp->messages_lock);
} }
@ -436,7 +436,7 @@ gst_omx_component_handle_messages (GstOMXComponent * comp)
} }
} }
g_slice_free (GstOMXMessage, msg); g_free (msg);
g_mutex_lock (&comp->messages_lock); g_mutex_lock (&comp->messages_lock);
} }
@ -655,7 +655,7 @@ EventHandler (OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_EVENTTYPE eEvent,
switch (cmd) { switch (cmd) {
case OMX_CommandStateSet:{ case OMX_CommandStateSet:{
GstOMXMessage *msg = g_slice_new (GstOMXMessage); GstOMXMessage *msg = g_new (GstOMXMessage, 1);
msg->type = GST_OMX_MESSAGE_STATE_SET; msg->type = GST_OMX_MESSAGE_STATE_SET;
msg->content.state_set.state = nData2; msg->content.state_set.state = nData2;
@ -668,7 +668,7 @@ EventHandler (OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_EVENTTYPE eEvent,
break; break;
} }
case OMX_CommandFlush:{ case OMX_CommandFlush:{
GstOMXMessage *msg = g_slice_new (GstOMXMessage); GstOMXMessage *msg = g_new (GstOMXMessage, 1);
msg->type = GST_OMX_MESSAGE_FLUSH; msg->type = GST_OMX_MESSAGE_FLUSH;
msg->content.flush.port = nData2; msg->content.flush.port = nData2;
@ -680,7 +680,7 @@ EventHandler (OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_EVENTTYPE eEvent,
} }
case OMX_CommandPortEnable: case OMX_CommandPortEnable:
case OMX_CommandPortDisable:{ case OMX_CommandPortDisable:{
GstOMXMessage *msg = g_slice_new (GstOMXMessage); GstOMXMessage *msg = g_new (GstOMXMessage, 1);
msg->type = GST_OMX_MESSAGE_PORT_ENABLE; msg->type = GST_OMX_MESSAGE_PORT_ENABLE;
msg->content.port_enable.port = nData2; msg->content.port_enable.port = nData2;
@ -715,7 +715,7 @@ EventHandler (OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_EVENTTYPE eEvent,
break; break;
} }
msg = g_slice_new (GstOMXMessage); msg = g_new (GstOMXMessage, 1);
msg->type = GST_OMX_MESSAGE_ERROR; msg->type = GST_OMX_MESSAGE_ERROR;
msg->content.error.error = error_type; msg->content.error.error = error_type;
@ -728,7 +728,7 @@ EventHandler (OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_EVENTTYPE eEvent,
} }
case OMX_EventPortSettingsChanged: case OMX_EventPortSettingsChanged:
{ {
GstOMXMessage *msg = g_slice_new (GstOMXMessage); GstOMXMessage *msg = g_new (GstOMXMessage, 1);
OMX_U32 index; OMX_U32 index;
if (!(comp->hacks & if (!(comp->hacks &
@ -756,7 +756,7 @@ EventHandler (OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_EVENTTYPE eEvent,
case OMX_EventBufferFlag:{ case OMX_EventBufferFlag:{
GstOMXMessage *msg; GstOMXMessage *msg;
msg = g_slice_new (GstOMXMessage); msg = g_new (GstOMXMessage, 1);
msg->type = GST_OMX_MESSAGE_BUFFER_FLAG; msg->type = GST_OMX_MESSAGE_BUFFER_FLAG;
msg->content.buffer_flag.port = nData1; msg->content.buffer_flag.port = nData1;
@ -871,7 +871,7 @@ EmptyBufferDone (OMX_HANDLETYPE hComponent, OMX_PTR pAppData,
comp = buf->port->comp; comp = buf->port->comp;
msg = g_slice_new (GstOMXMessage); msg = g_new (GstOMXMessage, 1);
msg->type = GST_OMX_MESSAGE_BUFFER_DONE; msg->type = GST_OMX_MESSAGE_BUFFER_DONE;
msg->content.buffer_done.component = hComponent; msg->content.buffer_done.component = hComponent;
msg->content.buffer_done.app_data = pAppData; msg->content.buffer_done.app_data = pAppData;
@ -910,7 +910,7 @@ FillBufferDone (OMX_HANDLETYPE hComponent, OMX_PTR pAppData,
comp = buf->port->comp; comp = buf->port->comp;
msg = g_slice_new (GstOMXMessage); msg = g_new (GstOMXMessage, 1);
msg->type = GST_OMX_MESSAGE_BUFFER_DONE; msg->type = GST_OMX_MESSAGE_BUFFER_DONE;
msg->content.buffer_done.component = hComponent; msg->content.buffer_done.component = hComponent;
msg->content.buffer_done.app_data = pAppData; msg->content.buffer_done.app_data = pAppData;
@ -947,7 +947,7 @@ gst_omx_component_new (GstObject * parent, const gchar * core_name,
if (!core) if (!core)
return NULL; return NULL;
comp = g_slice_new0 (GstOMXComponent); comp = g_new0 (GstOMXComponent, 1);
comp->core = core; comp->core = core;
gst_mini_object_init (GST_MINI_OBJECT_CAST (comp), 0, gst_mini_object_init (GST_MINI_OBJECT_CAST (comp), 0,
@ -968,7 +968,7 @@ gst_omx_component_new (GstObject * parent, const gchar * core_name,
component_name, core_name, err); component_name, core_name, err);
gst_omx_core_release (core); gst_omx_core_release (core);
g_free (comp->name); g_free (comp->name);
g_slice_free (GstOMXComponent, comp); g_free (comp);
return NULL; return NULL;
} }
GST_DEBUG_OBJECT (parent, GST_DEBUG_OBJECT (parent,
@ -1039,7 +1039,7 @@ gst_omx_component_free (GstOMXComponent * comp)
g_assert (port->buffers == NULL); g_assert (port->buffers == NULL);
g_assert (g_queue_get_length (&port->pending_buffers) == 0); g_assert (g_queue_get_length (&port->pending_buffers) == 0);
g_slice_free (GstOMXPort, port); g_free (port);
} }
g_ptr_array_unref (comp->ports); g_ptr_array_unref (comp->ports);
comp->ports = NULL; comp->ports = NULL;
@ -1059,7 +1059,7 @@ gst_omx_component_free (GstOMXComponent * comp)
g_free (comp->name); g_free (comp->name);
comp->name = NULL; comp->name = NULL;
g_slice_free (GstOMXComponent, comp); g_free (comp);
} }
GstOMXComponent * GstOMXComponent *
@ -1305,7 +1305,7 @@ gst_omx_component_add_port (GstOMXComponent * comp, guint32 index)
return NULL; return NULL;
} }
port = g_slice_new0 (GstOMXPort); port = g_new0 (GstOMXPort, 1);
port->comp = comp; port->comp = comp;
port->index = index; port->index = index;
@ -2579,7 +2579,7 @@ gst_omx_port_allocate_buffers_unlocked (GstOMXPort * port,
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
GstOMXBuffer *buf; GstOMXBuffer *buf;
buf = g_slice_new0 (GstOMXBuffer); buf = g_new0 (GstOMXBuffer, 1);
buf->port = port; buf->port = port;
buf->used = FALSE; buf->used = FALSE;
buf->settings_cookie = port->settings_cookie; buf->settings_cookie = port->settings_cookie;
@ -2903,7 +2903,7 @@ gst_omx_port_deallocate_buffers_unlocked (GstOMXPort * port)
err = tmp; err = tmp;
} }
} }
g_slice_free (GstOMXBuffer, buf); g_free (buf);
} }
g_queue_clear (&port->pending_buffers); g_queue_clear (&port->pending_buffers);
g_ptr_array_unref (port->buffers); g_ptr_array_unref (port->buffers);

View file

@ -126,7 +126,7 @@ gst_omx_memory_new (GstOMXAllocator * allocator, GstOMXBuffer * omx_buf,
size = maxsize - offset; size = maxsize - offset;
} }
mem = g_slice_new0 (GstOMXMemory); mem = g_new0 (GstOMXMemory, 1);
gst_memory_init (GST_MEMORY_CAST (mem), flags, (GstAllocator *) allocator, gst_memory_init (GST_MEMORY_CAST (mem), flags, (GstAllocator *) allocator,
parent, maxsize, align, offset, size); parent, maxsize, align, offset, size);
@ -528,7 +528,7 @@ gst_omx_allocator_free (GstAllocator * allocator, GstMemory * mem)
if (omem->foreign_mem) if (omem->foreign_mem)
gst_memory_unref (omem->foreign_mem); gst_memory_unref (omem->foreign_mem);
g_slice_free (GstOMXMemory, omem); g_free (omem);
} }
static void static void

View file

@ -137,7 +137,7 @@ gst_omx_video_get_supported_colorformats (GstOMXPort * port,
f = gst_omx_video_get_format_from_omx (param.eColorFormat); f = gst_omx_video_get_format_from_omx (param.eColorFormat);
if (f != GST_VIDEO_FORMAT_UNKNOWN) { if (f != GST_VIDEO_FORMAT_UNKNOWN) {
m = g_slice_new (GstOMXVideoNegotiationMap); m = g_new (GstOMXVideoNegotiationMap, 1);
m->format = f; m->format = f;
m->type = param.eColorFormat; m->type = param.eColorFormat;
negotiation_map = g_list_append (negotiation_map, m); negotiation_map = g_list_append (negotiation_map, m);
@ -177,7 +177,7 @@ gst_omx_video_get_caps_for_map (GList * map)
void void
gst_omx_video_negotiation_map_free (GstOMXVideoNegotiationMap * m) gst_omx_video_negotiation_map_free (GstOMXVideoNegotiationMap * m)
{ {
g_slice_free (GstOMXVideoNegotiationMap, m); g_free (m);
} }
GstVideoCodecFrame * GstVideoCodecFrame *

View file

@ -718,7 +718,7 @@ gst_omx_try_importing_buffer (GstOMXVideoDec * self, GstBufferPool * pool,
goto out; goto out;
} }
*frame = g_slice_new0 (GstVideoFrame); *frame = g_new0 (GstVideoFrame, 1);
is_mapped = gst_video_frame_map (*frame, v_info, buffer, flags); is_mapped = gst_video_frame_map (*frame, v_info, buffer, flags);
if (!is_mapped) { if (!is_mapped) {
@ -740,7 +740,7 @@ out:
if (*frame) { if (*frame) {
if (is_mapped) if (is_mapped)
gst_video_frame_unmap (*frame); gst_video_frame_unmap (*frame);
g_slice_free (GstVideoFrame, *frame); g_free (*frame);
*frame = NULL; *frame = NULL;
} }
gst_buffer_unref (buffer); gst_buffer_unref (buffer);