From 86b36c34632e026397d0202c89f7e6fe90477f78 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 4 Jun 2012 10:46:13 +0200 Subject: [PATCH] videoencoder: Don't unref frame twice if not in the list --- gst-libs/gst/video/gstvideoencoder.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gst-libs/gst/video/gstvideoencoder.c b/gst-libs/gst/video/gstvideoencoder.c index 5633369..0405f04 100644 --- a/gst-libs/gst/video/gstvideoencoder.c +++ b/gst-libs/gst/video/gstvideoencoder.c @@ -1496,10 +1496,14 @@ gst_video_encoder_finish_frame (GstVideoEncoder * encoder, done: /* handed out */ - priv->frames = g_list_remove (priv->frames, frame); - /* Remove the reference from the list and the reference that - * was provided to us */ - gst_video_codec_frame_unref (frame); + + /* unref once from the list */ + l = g_list_find (priv->frames, frame); + if (l) { + gst_video_codec_frame_unref (frame); + priv->frames = g_list_delete_link (priv->frames, l); + } + /* unref because this function takes ownership */ gst_video_codec_frame_unref (frame); GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder); -- 2.7.4