mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 05:01:23 +00:00
avaudenc: Avoid double-freeing frame's extended data
This occured when attempting to encode 16 channel audio, would crash on the first buffer. We only need to store ext_data, old ext_data_array (frame->extended_data) is already freed by `av_frame_unref`. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6375>
This commit is contained in:
parent
9048bea3d3
commit
4295e1dd30
1 changed files with 2 additions and 3 deletions
|
@ -403,7 +403,7 @@ typedef struct
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
|
|
||||||
guint8 **ext_data_array, *ext_data;
|
guint8 *ext_data;
|
||||||
} BufferInfo;
|
} BufferInfo;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -416,7 +416,6 @@ buffer_info_free (void *opaque, guint8 * data)
|
||||||
gst_buffer_unref (info->buffer);
|
gst_buffer_unref (info->buffer);
|
||||||
} else {
|
} else {
|
||||||
av_freep (&info->ext_data);
|
av_freep (&info->ext_data);
|
||||||
av_freep (&info->ext_data_array);
|
|
||||||
}
|
}
|
||||||
g_free (info);
|
g_free (info);
|
||||||
}
|
}
|
||||||
|
@ -473,7 +472,7 @@ gst_ffmpegaudenc_send_frame (GstFFMpegAudEnc * ffmpegaudenc, GstBuffer * buffer)
|
||||||
av_buffer_create (NULL, 0, buffer_info_free, buffer_info, 0);
|
av_buffer_create (NULL, 0, buffer_info_free, buffer_info, 0);
|
||||||
|
|
||||||
if (info->channels > AV_NUM_DATA_POINTERS) {
|
if (info->channels > AV_NUM_DATA_POINTERS) {
|
||||||
buffer_info->ext_data_array = frame->extended_data =
|
frame->extended_data =
|
||||||
av_malloc_array (info->channels, sizeof (uint8_t *));
|
av_malloc_array (info->channels, sizeof (uint8_t *));
|
||||||
} else {
|
} else {
|
||||||
frame->extended_data = frame->data;
|
frame->extended_data = frame->data;
|
||||||
|
|
Loading…
Reference in a new issue