mpegpsmux: 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:46:53 +00:00 committed by GStreamer Marge Bot
parent 2b4b23d2a2
commit 20e6735d20
3 changed files with 9 additions and 9 deletions

View file

@ -49,7 +49,7 @@ static inline gint bits_initwrite( bits_buffer_t *p_buffer,
p_buffer->p_data = p_data; p_buffer->p_data = p_data;
if( !p_buffer->p_data ) if( !p_buffer->p_data )
{ {
if( !( p_buffer->p_data = g_slice_alloc0( i_size ) ) ) if( !( p_buffer->p_data = g_malloc0( i_size ) ) )
return -1; return -1;
} }
p_buffer->p_data[0] = 0; p_buffer->p_data[0] = 0;

View file

@ -71,7 +71,7 @@ psmux_new (void)
{ {
PsMux *mux; PsMux *mux;
mux = g_slice_new0 (PsMux); mux = g_new0 (PsMux, 1);
mux->pts = -1; /* uninitialized values */ mux->pts = -1; /* uninitialized values */
mux->pack_hdr_pts = -1; mux->pack_hdr_pts = -1;
@ -147,7 +147,7 @@ psmux_free (PsMux * mux)
if (mux->psm != NULL) if (mux->psm != NULL)
gst_buffer_unref (mux->psm); gst_buffer_unref (mux->psm);
g_slice_free (PsMux, mux); g_free (mux);
} }
/** /**

View file

@ -67,7 +67,7 @@ static void psmux_stream_find_pts_dts_within (PsMuxStream * stream, guint bound,
PsMuxStream * PsMuxStream *
psmux_stream_new (PsMux * mux, PsMuxStreamType stream_type) psmux_stream_new (PsMux * mux, PsMuxStreamType stream_type)
{ {
PsMuxStream *stream = g_slice_new0 (PsMuxStream); PsMuxStream *stream = g_new0 (PsMuxStream, 1);
PsMuxStreamIdInfo *info = &(mux->id_info); PsMuxStreamIdInfo *info = &(mux->id_info);
stream->stream_type = stream_type; stream->stream_type = stream_type;
@ -147,7 +147,7 @@ psmux_stream_new (PsMux * mux, PsMuxStreamType stream_type)
if (stream->stream_id == 0) { if (stream->stream_id == 0) {
g_critical ("Number of elementary streams of type %04x exceeds maximum", g_critical ("Number of elementary streams of type %04x exceeds maximum",
stream->stream_type); stream->stream_type);
g_slice_free (PsMuxStream, stream); g_free (stream);
return NULL; return NULL;
} }
@ -211,7 +211,7 @@ psmux_stream_free (PsMuxStream * stream)
if (psmux_stream_bytes_in_buffer (stream)) { if (psmux_stream_bytes_in_buffer (stream)) {
g_warning ("Freeing stream with data not yet processed"); g_warning ("Freeing stream with data not yet processed");
} }
g_slice_free (PsMuxStream, stream); g_free (stream);
} }
/* Advance the current packet stream position by len bytes. /* Advance the current packet stream position by len bytes.
@ -237,7 +237,7 @@ psmux_stream_consume (PsMuxStream * stream, guint len)
gst_buffer_unmap (stream->cur_buffer->buf, &stream->cur_buffer->map); gst_buffer_unmap (stream->cur_buffer->buf, &stream->cur_buffer->map);
gst_buffer_unref (stream->cur_buffer->buf); gst_buffer_unref (stream->cur_buffer->buf);
g_slice_free (PsMuxStreamBuffer, stream->cur_buffer); g_free (stream->cur_buffer);
stream->cur_buffer = NULL; stream->cur_buffer = NULL;
} }
} }
@ -494,13 +494,13 @@ psmux_stream_add_data (PsMuxStream * stream, GstBuffer * buffer,
g_return_if_fail (stream != NULL); g_return_if_fail (stream != NULL);
packet = g_slice_new (PsMuxStreamBuffer); packet = g_new (PsMuxStreamBuffer, 1);
packet->buf = buffer; packet->buf = buffer;
if (!gst_buffer_map (packet->buf, &packet->map, GST_MAP_READ)) { if (!gst_buffer_map (packet->buf, &packet->map, GST_MAP_READ)) {
GST_ERROR ("Failed to map buffer for reading"); GST_ERROR ("Failed to map buffer for reading");
gst_buffer_unref (packet->buf); gst_buffer_unref (packet->buf);
g_slice_free (PsMuxStreamBuffer, packet); g_free (packet);
return; return;
} }