mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 11:32:38 +00:00
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:
parent
4119246081
commit
4b946e8cee
1 changed files with 6 additions and 2 deletions
|
@ -1995,8 +1995,12 @@ gst_video_decoder_finish_frame (GstVideoDecoder * decoder,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
output_buffer = gst_buffer_make_writable (frame->output_buffer);
|
/* A reference always needs to be owned by the frame on the buffer.
|
||||||
frame->output_buffer = NULL;
|
* 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);
|
GST_BUFFER_FLAG_UNSET (output_buffer, GST_BUFFER_FLAG_DELTA_UNIT);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue