mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
videoencoder: Ensure buffers don't disappear early
The frames are the owners of the buffers
This commit is contained in:
parent
4b946e8cee
commit
cb6b835d11
1 changed files with 6 additions and 3 deletions
|
@ -1489,10 +1489,13 @@ gst_video_encoder_finish_frame (GstVideoEncoder * encoder,
|
||||||
if (encoder_class->pre_push)
|
if (encoder_class->pre_push)
|
||||||
ret = encoder_class->pre_push (encoder, frame);
|
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)
|
if (ret == GST_FLOW_OK)
|
||||||
ret = gst_pad_push (encoder->srcpad, frame->output_buffer);
|
ret = gst_pad_push (encoder->srcpad, gst_buffer_ref (frame->output_buffer));
|
||||||
|
|
||||||
frame->output_buffer = NULL;
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
/* handed out */
|
/* handed out */
|
||||||
|
|
Loading…
Reference in a new issue