From: Sebastian Dröge Date: Tue, 19 Jun 2012 08:34:49 +0000 (+0100) Subject: videoencoder: Ensure buffers don't disappear early X-Git-Tag: 1.19.3~511^2~6317 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cb6b835d11314935f19cb6a53cf1eb629abe6566;p=platform%2Fupstream%2Fgstreamer.git videoencoder: Ensure buffers don't disappear early The frames are the owners of the buffers --- diff --git a/gst-libs/gst/video/gstvideoencoder.c b/gst-libs/gst/video/gstvideoencoder.c index 18a6e8020b..6ae20e5c28 100644 --- a/gst-libs/gst/video/gstvideoencoder.c +++ b/gst-libs/gst/video/gstvideoencoder.c @@ -1489,10 +1489,13 @@ gst_video_encoder_finish_frame (GstVideoEncoder * encoder, if (encoder_class->pre_push) ret = encoder_class->pre_push (encoder, frame); + /* A reference always needs to be owned by the frame on the buffer. + * For that reason, we use a complete sub-buffer (zero-cost) to push + * downstream. + * The original buffer will be free-ed only when downstream AND the + * current implementation are done with the frame. */ if (ret == GST_FLOW_OK) - ret = gst_pad_push (encoder->srcpad, frame->output_buffer); - - frame->output_buffer = NULL; + ret = gst_pad_push (encoder->srcpad, gst_buffer_ref (frame->output_buffer)); done: /* handed out */