videoencoder: Add a reference to frame passed to subclass

We have one reference owned by the internal frame list and one reference
passed to the subclass.
This commit is contained in:
Edward Hervey 2012-05-01 16:11:58 +02:00 committed by Sebastian Dröge
parent 8217575af1
commit 67a4c0c7b2

View file

@ -1185,6 +1185,7 @@ gst_video_encoder_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
GST_LOG_OBJECT (encoder, "passing frame pfn %d to subclass",
frame->presentation_frame_number);
gst_video_codec_frame_ref (frame);
ret = klass->handle_frame (encoder, frame);
done:
@ -1496,7 +1497,9 @@ 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);
gst_video_codec_frame_unref (frame);
GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);