diff --git a/gst-libs/gst/video/gstvideoencoder.c b/gst-libs/gst/video/gstvideoencoder.c index eb9d186774..0f85cd9a4d 100644 --- a/gst-libs/gst/video/gstvideoencoder.c +++ b/gst-libs/gst/video/gstvideoencoder.c @@ -340,10 +340,6 @@ gst_video_encoder_reset (GstVideoEncoder * encoder, gboolean hard) priv->drained = TRUE; - g_list_foreach (priv->frames, (GFunc) gst_video_codec_frame_unref, NULL); - g_list_free (priv->frames); - priv->frames = NULL; - priv->bytes = 0; priv->time = 0; @@ -389,6 +385,10 @@ gst_video_encoder_reset (GstVideoEncoder * encoder, gboolean hard) encoder->priv->current_frame_events); } + g_list_foreach (priv->frames, (GFunc) gst_video_codec_frame_unref, NULL); + g_list_free (priv->frames); + priv->frames = NULL; + GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder); return ret;