From ae8d0cf3acfaf79d8479647a55bd44b8453d07df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 24 Jul 2017 16:48:17 +0300 Subject: [PATCH] videodecoder: Make sure we have an actually writable buffer when modifying metadata avviddec keeps references to the buffers internally for example, in which case we need to do a shallow copy of the buffer. --- gst-libs/gst/video/gstvideodecoder.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gst-libs/gst/video/gstvideodecoder.c b/gst-libs/gst/video/gstvideodecoder.c index 7f0b569d61..d5d6263640 100644 --- a/gst-libs/gst/video/gstvideodecoder.c +++ b/gst-libs/gst/video/gstvideodecoder.c @@ -3010,7 +3010,9 @@ gst_video_decoder_finish_frame (GstVideoDecoder * decoder, goto done; } - output_buffer = frame->output_buffer; + /* We need a writable buffer for the metadata changes below */ + output_buffer = frame->output_buffer = + gst_buffer_make_writable (frame->output_buffer); GST_BUFFER_FLAG_UNSET (output_buffer, GST_BUFFER_FLAG_DELTA_UNIT); @@ -3040,9 +3042,7 @@ gst_video_decoder_finish_frame (GstVideoDecoder * decoder, /* Get an additional ref to the buffer, which is going to be pushed * downstream, the original ref is owned by the frame - * - * 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