From 0be8d149659c95afe81443a81cc9bb378b2b8534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 25 Apr 2013 16:13:10 +0200 Subject: [PATCH] videodecoder: Try harder to push writable buffers downstream For this release the corresponding GstVideoCodecFrame before pushing the buffer. The buffer will now be writable unless the subclass still holds another reference to the buffer or the frame. --- gst-libs/gst/video/gstvideodecoder.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/video/gstvideodecoder.c b/gst-libs/gst/video/gstvideodecoder.c index ed546ff200..21935560ed 100644 --- a/gst-libs/gst/video/gstvideodecoder.c +++ b/gst-libs/gst/video/gstvideodecoder.c @@ -2446,6 +2446,14 @@ gst_video_decoder_finish_frame (GstVideoDecoder * decoder, * FIXME: clip_and_push_buf() changes buffer metadata but the buffer * might have a refcount > 1 */ output_buffer = gst_buffer_ref (output_buffer); + + /* Release frame so the buffer is writable when we push it downstream + * if possible, i.e. if the subclass does not hold additional references + * to the frame + */ + gst_video_decoder_release_frame (decoder, frame); + frame = NULL; + if (decoder->output_segment.rate < 0.0) { GST_LOG_OBJECT (decoder, "queued frame"); priv->output_queued = g_list_prepend (priv->output_queued, output_buffer); @@ -2454,7 +2462,8 @@ gst_video_decoder_finish_frame (GstVideoDecoder * decoder, } done: - gst_video_decoder_release_frame (decoder, frame); + if (frame) + gst_video_decoder_release_frame (decoder, frame); GST_VIDEO_DECODER_STREAM_UNLOCK (decoder); return ret; }