rtmp2: drop use of GSlice

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3695>
This commit is contained in:
Tim-Philipp Müller 2023-01-08 18:39:59 +00:00 committed by GStreamer Marge Bot
parent 71890cc2f1
commit 3d9f3bfd66
7 changed files with 17 additions and 17 deletions

View file

@ -2,7 +2,7 @@
deleting and recreating stream, which drops clients. deleting and recreating stream, which drops clients.
- Move AMF parser/serializer to GstRtmpMeta? - Move AMF parser/serializer to GstRtmpMeta?
- Move AMF nodes from g_slice to GstMiniObject? - Move AMF nodes to GstMiniObject?
- First video frame that comes from Wowza seems to be out-of-order; librtmp - First video frame that comes from Wowza seems to be out-of-order; librtmp
does not have this problem does not have this problem

View file

@ -156,7 +156,7 @@ node_new (GstAmfType type)
init_static (); init_static ();
node = g_slice_alloc0 (sizeof *node); node = g_malloc0 (sizeof *node);
node->type = type; node->type = type;
switch (type) { switch (type) {
@ -295,7 +295,7 @@ gst_amf_node_free (gpointer ptr)
break; break;
} }
g_slice_free (GstAmfNode, node); g_free (node);
} }
GstAmfType GstAmfType

View file

@ -690,7 +690,7 @@ gst_rtmp_chunk_streams_new (void)
init_debug (); init_debug ();
cstreams = g_slice_new (GstRtmpChunkStreams); cstreams = g_new (GstRtmpChunkStreams, 1);
cstreams->array = g_array_new (FALSE, TRUE, sizeof (GstRtmpChunkStream)); cstreams->array = g_array_new (FALSE, TRUE, sizeof (GstRtmpChunkStream));
g_array_set_clear_func (cstreams->array, g_array_set_clear_func (cstreams->array,
(GDestroyNotify) gst_rtmp_chunk_stream_clear); (GDestroyNotify) gst_rtmp_chunk_stream_clear);
@ -702,7 +702,7 @@ gst_rtmp_chunk_streams_free (gpointer ptr)
{ {
GstRtmpChunkStreams *cstreams = ptr; GstRtmpChunkStreams *cstreams = ptr;
g_clear_pointer (&cstreams->array, g_array_unref); g_clear_pointer (&cstreams->array, g_array_unref);
g_slice_free (GstRtmpChunkStreams, cstreams); g_free (cstreams);
} }
GstRtmpChunkStream * GstRtmpChunkStream *

View file

@ -336,7 +336,7 @@ typedef struct
static ConnectTaskData * static ConnectTaskData *
connect_task_data_new (const GstRtmpLocation * location) connect_task_data_new (const GstRtmpLocation * location)
{ {
ConnectTaskData *data = g_slice_new0 (ConnectTaskData); ConnectTaskData *data = g_new0 (ConnectTaskData, 1);
gst_rtmp_location_copy (&data->location, location); gst_rtmp_location_copy (&data->location, location);
return data; return data;
} }
@ -351,7 +351,7 @@ connect_task_data_free (gpointer ptr)
g_signal_handler_disconnect (data->connection, data->error_handler_id); g_signal_handler_disconnect (data->connection, data->error_handler_id);
} }
g_clear_object (&data->connection); g_clear_object (&data->connection);
g_slice_free (ConnectTaskData, data); g_free (data);
} }
static GRegex *auth_regex = NULL; static GRegex *auth_regex = NULL;
@ -1074,7 +1074,7 @@ static StreamTaskData *
stream_task_data_new (GstRtmpConnection * connection, const gchar * stream, stream_task_data_new (GstRtmpConnection * connection, const gchar * stream,
gboolean publish) gboolean publish)
{ {
StreamTaskData *data = g_slice_new0 (StreamTaskData); StreamTaskData *data = g_new0 (StreamTaskData, 1);
data->connection = g_object_ref (connection); data->connection = g_object_ref (connection);
data->stream = g_strdup (stream); data->stream = g_strdup (stream);
data->publish = publish; data->publish = publish;
@ -1090,7 +1090,7 @@ stream_task_data_free (gpointer ptr)
g_signal_handler_disconnect (data->connection, data->error_handler_id); g_signal_handler_disconnect (data->connection, data->error_handler_id);
} }
g_clear_object (&data->connection); g_clear_object (&data->connection);
g_slice_free (StreamTaskData, data); g_free (data);
} }
static void static void

View file

@ -156,7 +156,7 @@ static Transaction *
transaction_new (gdouble transaction_id, GstRtmpCommandCallback func, transaction_new (gdouble transaction_id, GstRtmpCommandCallback func,
gpointer user_data) gpointer user_data)
{ {
Transaction *data = g_slice_new (Transaction); Transaction *data = g_new (Transaction, 1);
data->transaction_id = transaction_id; data->transaction_id = transaction_id;
data->func = func; data->func = func;
data->user_data = user_data; data->user_data = user_data;
@ -167,7 +167,7 @@ static void
transaction_free (gpointer ptr) transaction_free (gpointer ptr)
{ {
Transaction *data = ptr; Transaction *data = ptr;
g_slice_free (Transaction, data); g_free (data);
} }
typedef struct typedef struct
@ -182,7 +182,7 @@ static ExpectedCommand *
expected_command_new (guint32 stream_id, const gchar * command_name, expected_command_new (guint32 stream_id, const gchar * command_name,
GstRtmpCommandCallback func, gpointer user_data) GstRtmpCommandCallback func, gpointer user_data)
{ {
ExpectedCommand *data = g_slice_new (ExpectedCommand); ExpectedCommand *data = g_new (ExpectedCommand, 1);
data->stream_id = stream_id; data->stream_id = stream_id;
data->command_name = g_strdup (command_name); data->command_name = g_strdup (command_name);
data->func = func; data->func = func;
@ -195,7 +195,7 @@ expected_command_free (gpointer ptr)
{ {
ExpectedCommand *data = ptr; ExpectedCommand *data = ptr;
g_free (data->command_name); g_free (data->command_name);
g_slice_free (ExpectedCommand, data); g_free (data);
} }
enum enum

View file

@ -93,7 +93,7 @@ handshake_random_data (void)
static HandshakeData * static HandshakeData *
handshake_data_new (gboolean strict) handshake_data_new (gboolean strict)
{ {
HandshakeData *data = g_slice_new0 (HandshakeData); HandshakeData *data = g_new0 (HandshakeData, 1);
data->random_bytes = handshake_random_data (); data->random_bytes = handshake_random_data ();
data->strict = strict; data->strict = strict;
return data; return data;
@ -104,7 +104,7 @@ handshake_data_free (gpointer ptr)
{ {
HandshakeData *data = ptr; HandshakeData *data = ptr;
g_clear_pointer (&data->random_bytes, g_bytes_unref); g_clear_pointer (&data->random_bytes, g_bytes_unref);
g_slice_free (HandshakeData, data); g_free (data);
} }
static gboolean static gboolean

View file

@ -167,7 +167,7 @@ typedef struct
static WriteAllBufferData * static WriteAllBufferData *
write_all_buffer_data_new (GstBuffer * buffer) write_all_buffer_data_new (GstBuffer * buffer)
{ {
WriteAllBufferData *data = g_slice_new0 (WriteAllBufferData); WriteAllBufferData *data = g_new0 (WriteAllBufferData, 1);
data->buffer = gst_buffer_ref (buffer); data->buffer = gst_buffer_ref (buffer);
return data; return data;
} }
@ -180,7 +180,7 @@ write_all_buffer_data_free (gpointer ptr)
gst_buffer_unmap (data->buffer, &data->map); gst_buffer_unmap (data->buffer, &data->map);
} }
g_clear_pointer (&data->buffer, gst_buffer_unref); g_clear_pointer (&data->buffer, gst_buffer_unref);
g_slice_free (WriteAllBufferData, data); g_free (data);
} }
void void