videodecoder: Ensure buffers don't disappear early

The frames are the owners of the buffers. In cases where a decoder
would keep around reference frames, we need to ensure they don't
disappear early.
To handle this, we pass downstream a complete sub-buffer of the output
buffer, ensuring that the buffer will only be released when downstream
is done with it *AND* the frame is no longer used.

Conflicts:

	gst-libs/gst/video/gstvideodecoder.c
This commit is contained in:
Edward Hervey 2012-04-26 18:43:16 +02:00 committed by Sebastian Dröge
parent 4119246081
commit 4b946e8cee

View file

@ -1995,8 +1995,12 @@ gst_video_decoder_finish_frame (GstVideoDecoder * decoder,
goto done;
}
output_buffer = gst_buffer_make_writable (frame->output_buffer);
frame->output_buffer = NULL;
/* 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. */
output_buffer = gst_buffer_ref (frame->output_buffer);
GST_BUFFER_FLAG_UNSET (output_buffer, GST_BUFFER_FLAG_DELTA_UNIT);