videoencoder: Release video frame when ->handle return ERROR or DROPPED

https://bugzilla.gnome.org/show_bug.cgi?id=760666
This commit is contained in:
Thibault Saunier 2016-01-15 13:35:22 +00:00
parent 62053852de
commit 63517d0ed3

View file

@ -212,7 +212,9 @@ static void gst_video_encoder_init (GstVideoEncoder * enc,
GstVideoEncoderClass * klass); GstVideoEncoderClass * klass);
static void gst_video_encoder_finalize (GObject * object); static void gst_video_encoder_finalize (GObject * object);
static void
gst_video_encoder_release_frame (GstVideoEncoder * enc,
GstVideoCodecFrame * frame);
static gboolean gst_video_encoder_setcaps (GstVideoEncoder * enc, static gboolean gst_video_encoder_setcaps (GstVideoEncoder * enc,
GstCaps * caps); GstCaps * caps);
static GstCaps *gst_video_encoder_sink_getcaps (GstVideoEncoder * encoder, static GstCaps *gst_video_encoder_sink_getcaps (GstVideoEncoder * encoder,
@ -1479,6 +1481,11 @@ gst_video_encoder_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
ret = klass->handle_frame (encoder, frame); ret = klass->handle_frame (encoder, frame);
if (ret == GST_VIDEO_ENCODER_FLOW_DROPPED || ret == GST_FLOW_ERROR) {
GST_INFO_OBJECT (encoder, "Dropping frame %p", frame);
gst_video_encoder_release_frame (encoder, frame);
}
done: done:
GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder); GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);