gst-libav: 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 20:19:06 +00:00 committed by GStreamer Marge Bot
parent f5977dae15
commit 8a047a619e
3 changed files with 14 additions and 14 deletions

View file

@ -382,7 +382,7 @@ static void
gst_ffmpegaudenc_free_avpacket (gpointer pkt)
{
av_packet_unref ((AVPacket *) pkt);
g_slice_free (AVPacket, pkt);
g_free (pkt);
}
typedef struct
@ -405,7 +405,7 @@ buffer_info_free (void *opaque, guint8 * data)
av_freep (&info->ext_data);
av_freep (&info->ext_data_array);
}
g_slice_free (BufferInfo, info);
g_free (info);
}
static GstFlowReturn
@ -425,7 +425,7 @@ gst_ffmpegaudenc_send_frame (GstFFMpegAudEnc * ffmpegaudenc, GstBuffer * buffer)
ctx = ffmpegaudenc->context;
if (buffer != NULL) {
BufferInfo *buffer_info = g_slice_new0 (BufferInfo);
BufferInfo *buffer_info = g_new0 (BufferInfo, 1);
guint8 *audio_in;
guint in_size;
@ -579,7 +579,7 @@ gst_ffmpegaudenc_receive_packet (GstFFMpegAudEnc * ffmpegaudenc,
ctx = ffmpegaudenc->context;
pkt = g_slice_new0 (AVPacket);
pkt = g_new0 (AVPacket, 1);
res = avcodec_receive_packet (ctx, pkt);
@ -619,7 +619,7 @@ gst_ffmpegaudenc_receive_packet (GstFFMpegAudEnc * ffmpegaudenc,
*got_packet = TRUE;
} else {
GST_LOG_OBJECT (ffmpegaudenc, "no output produced");
g_slice_free (AVPacket, pkt);
g_free (pkt);
ret = GST_FLOW_OK;
*got_packet = FALSE;
}

View file

@ -723,7 +723,7 @@ gst_ffmpegviddec_video_frame_new (GstFFMpegVidDec * ffmpegdec,
{
GstFFMpegVidDecVideoFrame *dframe;
dframe = g_slice_new0 (GstFFMpegVidDecVideoFrame);
dframe = g_new0 (GstFFMpegVidDecVideoFrame, 1);
dframe->ffmpegdec = ffmpegdec;
dframe->frame = frame;
@ -747,7 +747,7 @@ gst_ffmpegviddec_video_frame_free (GstFFMpegVidDec * ffmpegdec,
if (frame->avbuffer) {
av_buffer_unref (&frame->avbuffer);
}
g_slice_free (GstFFMpegVidDecVideoFrame, frame);
g_free (frame);
}
static void

View file

@ -484,7 +484,7 @@ static void
gst_ffmpegvidenc_free_avpacket (gpointer pkt)
{
av_packet_unref ((AVPacket *) pkt);
g_slice_free (AVPacket, pkt);
g_free (pkt);
}
typedef struct
@ -500,7 +500,7 @@ buffer_info_free (void *opaque, guint8 * data)
gst_video_frame_unmap (&info->vframe);
gst_buffer_unref (info->buffer);
g_slice_free (BufferInfo, info);
g_free (info);
}
static enum AVStereo3DType
@ -591,14 +591,14 @@ gst_ffmpegvidenc_send_frame (GstFFMpegVidEnc * ffmpegenc,
if (GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME (frame))
picture->pict_type = AV_PICTURE_TYPE_I;
buffer_info = g_slice_new0 (BufferInfo);
buffer_info = g_new0 (BufferInfo, 1);
buffer_info->buffer = gst_buffer_ref (frame->input_buffer);
if (!gst_video_frame_map (&buffer_info->vframe, info, frame->input_buffer,
GST_MAP_READ)) {
GST_ERROR_OBJECT (ffmpegenc, "Failed to map input buffer");
gst_buffer_unref (buffer_info->buffer);
g_slice_free (BufferInfo, buffer_info);
g_free (buffer_info);
gst_video_codec_frame_unref (frame);
goto done;
}
@ -677,15 +677,15 @@ gst_ffmpegvidenc_receive_packet (GstFFMpegVidEnc * ffmpegenc,
*got_packet = FALSE;
pkt = g_slice_new0 (AVPacket);
pkt = g_new0 (AVPacket, 1);
res = avcodec_receive_packet (ffmpegenc->context, pkt);
if (res == AVERROR (EAGAIN)) {
g_slice_free (AVPacket, pkt);
g_free (pkt);
goto done;
} else if (res == AVERROR_EOF) {
g_slice_free (AVPacket, pkt);
g_free (pkt);
ret = GST_FLOW_EOS;
goto done;
} else if (res < 0) {