mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 07:08:23 +00:00
scenechange: fix memory leak
A reference to the last buffer(oldbuf) was kept leading to a memory leak on stop. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7666>
This commit is contained in:
parent
d71dd64717
commit
b736ac5bb4
1 changed files with 11 additions and 4 deletions
|
@ -92,6 +92,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_scene_change_debug_category);
|
||||||
|
|
||||||
static GstFlowReturn gst_scene_change_transform_frame_ip (GstVideoFilter *
|
static GstFlowReturn gst_scene_change_transform_frame_ip (GstVideoFilter *
|
||||||
filter, GstVideoFrame * frame);
|
filter, GstVideoFrame * frame);
|
||||||
|
static gboolean gst_scenechange_stop (GstBaseTransform * base);
|
||||||
|
|
||||||
#undef TESTING
|
#undef TESTING
|
||||||
#ifdef TESTING
|
#ifdef TESTING
|
||||||
|
@ -119,6 +120,7 @@ static void
|
||||||
gst_scene_change_class_init (GstSceneChangeClass * klass)
|
gst_scene_change_class_init (GstSceneChangeClass * klass)
|
||||||
{
|
{
|
||||||
GstVideoFilterClass *video_filter_class = GST_VIDEO_FILTER_CLASS (klass);
|
GstVideoFilterClass *video_filter_class = GST_VIDEO_FILTER_CLASS (klass);
|
||||||
|
GstBaseTransformClass *trans_class = GST_BASE_TRANSFORM_CLASS (klass);
|
||||||
|
|
||||||
gst_element_class_add_pad_template (GST_ELEMENT_CLASS (klass),
|
gst_element_class_add_pad_template (GST_ELEMENT_CLASS (klass),
|
||||||
gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
|
gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
|
||||||
|
@ -135,6 +137,7 @@ gst_scene_change_class_init (GstSceneChangeClass * klass)
|
||||||
video_filter_class->transform_frame_ip =
|
video_filter_class->transform_frame_ip =
|
||||||
GST_DEBUG_FUNCPTR (gst_scene_change_transform_frame_ip);
|
GST_DEBUG_FUNCPTR (gst_scene_change_transform_frame_ip);
|
||||||
|
|
||||||
|
trans_class->stop = GST_DEBUG_FUNCPTR (gst_scenechange_stop);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -142,7 +145,6 @@ gst_scene_change_init (GstSceneChange * scenechange)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static double
|
static double
|
||||||
get_frame_score (GstVideoFrame * f1, GstVideoFrame * f2)
|
get_frame_score (GstVideoFrame * f1, GstVideoFrame * f2)
|
||||||
{
|
{
|
||||||
|
@ -259,10 +261,15 @@ gst_scene_change_transform_frame_ip (GstVideoFilter * filter,
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_scenechange_stop (GstBaseTransform * base)
|
||||||
|
{
|
||||||
|
GstSceneChange *scenechange = GST_SCENE_CHANGE (base);
|
||||||
|
|
||||||
|
gst_clear_buffer (&scenechange->oldbuf);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef TESTING
|
#ifdef TESTING
|
||||||
/* This is from ds's personal collection. No, you can't have it. */
|
/* This is from ds's personal collection. No, you can't have it. */
|
||||||
|
|
Loading…
Reference in a new issue