mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
vtenc: fix memory leak
The pixel buffer release callback is called if the void * dataPtr given to the CVPixelBufferCreateWithPlanarBytes is not NULL. According to the documentation dataPtr is supposed to be a "plane description block" but no specific type is given. https://bugzilla.gnome.org/show_bug.cgi?id=711847
This commit is contained in:
parent
e77a93f6a8
commit
e1601406a5
1 changed files with 15 additions and 4 deletions
|
@ -99,6 +99,10 @@ static GstVTEncFrame *gst_vtenc_frame_new (GstBuffer * buf,
|
|||
GstVideoInfo * videoinfo);
|
||||
static void gst_vtenc_frame_free (GstVTEncFrame * frame);
|
||||
|
||||
static void gst_pixel_buffer_release_cb (void *releaseRefCon,
|
||||
const void *dataPtr, size_t dataSize, size_t numberOfPlanes,
|
||||
const void *planeAddresses[]);
|
||||
|
||||
static GstStaticCaps sink_caps =
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ NV12, I420 }"));
|
||||
|
||||
|
@ -812,15 +816,13 @@ gst_vtenc_encode_frame (GstVTEnc * self, GstBuffer * buf)
|
|||
cv_ret = CVPixelBufferCreateWithPlanarBytes (NULL,
|
||||
self->negotiated_width, self->negotiated_height,
|
||||
pixel_format_type,
|
||||
NULL,
|
||||
frame,
|
||||
GST_VIDEO_FRAME_SIZE (&frame->videoframe),
|
||||
num_planes,
|
||||
plane_base_addresses,
|
||||
plane_widths,
|
||||
plane_heights,
|
||||
plane_bytes_per_row,
|
||||
(CVPixelBufferReleasePlanarBytesCallback) gst_vtenc_frame_free, frame,
|
||||
NULL, &pbuf);
|
||||
plane_bytes_per_row, gst_pixel_buffer_release_cb, frame, NULL, &pbuf);
|
||||
if (cv_ret != kCVReturnSuccess) {
|
||||
gst_vtenc_frame_free (frame);
|
||||
goto cv_error;
|
||||
|
@ -965,6 +967,15 @@ gst_vtenc_frame_free (GstVTEncFrame * frame)
|
|||
g_slice_free (GstVTEncFrame, frame);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_pixel_buffer_release_cb (void *releaseRefCon, const void *dataPtr,
|
||||
size_t dataSize, size_t numberOfPlanes, const void *planeAddresses[])
|
||||
{
|
||||
GstVTEncFrame *frame = (GstVTEncFrame *) releaseRefCon;
|
||||
|
||||
gst_vtenc_frame_free (frame);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_vtenc_register (GstPlugin * plugin,
|
||||
const GstVTEncoderDetails * codec_details)
|
||||
|
|
Loading…
Reference in a new issue