mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 01:45:33 +00:00
av{aud,vid}enc: Create wrapped output buffers with GST_MEMORY_FLAG_READONLY
libav might still have references to the buffers itself and uses a writability system similar to ours based on reference counts.
This commit is contained in:
parent
6998d982c7
commit
45ab256e54
2 changed files with 6 additions and 6 deletions
|
@ -587,8 +587,8 @@ gst_ffmpegaudenc_encode_audio (GstFFMpegAudEnc * ffmpegaudenc,
|
|||
GST_LOG_OBJECT (ffmpegaudenc, "pushing size %d", pkt->size);
|
||||
|
||||
outbuf =
|
||||
gst_buffer_new_wrapped_full (0, pkt->data, pkt->size, 0, pkt->size,
|
||||
pkt, gst_ffmpegaudenc_free_avpacket);
|
||||
gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY, pkt->data,
|
||||
pkt->size, 0, pkt->size, pkt, gst_ffmpegaudenc_free_avpacket);
|
||||
|
||||
codec = ffmpegaudenc->context->codec;
|
||||
if ((codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE) || !buffer) {
|
||||
|
|
|
@ -673,8 +673,8 @@ gst_ffmpegvidenc_handle_frame (GstVideoEncoder * encoder,
|
|||
frame = gst_video_encoder_get_oldest_frame (encoder);
|
||||
|
||||
outbuf =
|
||||
gst_buffer_new_wrapped_full (0, pkt->data, pkt->size, 0, pkt->size, pkt,
|
||||
gst_ffmpegvidenc_free_avpacket);
|
||||
gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY, pkt->data,
|
||||
pkt->size, 0, pkt->size, pkt, gst_ffmpegvidenc_free_avpacket);
|
||||
frame->output_buffer = outbuf;
|
||||
|
||||
/* buggy codec may not set coded_frame */
|
||||
|
@ -748,8 +748,8 @@ gst_ffmpegvidenc_flush_buffers (GstFFMpegVidEnc * ffmpegenc, gboolean send)
|
|||
|
||||
if (send && have_data) {
|
||||
outbuf =
|
||||
gst_buffer_new_wrapped_full (0, pkt->data, pkt->size, 0, pkt->size,
|
||||
pkt->data, gst_ffmpegvidenc_free_avpacket);
|
||||
gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY, pkt->data,
|
||||
pkt->size, 0, pkt->size, pkt->data, gst_ffmpegvidenc_free_avpacket);
|
||||
frame->output_buffer = outbuf;
|
||||
|
||||
if (ffmpegenc->context->coded_frame->key_frame)
|
||||
|
|
Loading…
Reference in a new issue