Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
gstvideoencoder: make sure the buffer is writable before modifying me…
  • Loading branch information
alatiera authored and GStreamer Marge Bot committed Apr 20, 2021
1 parent dd12c9b commit df88b10
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gst-libs/gst/video/gstvideoencoder.c
Expand Up @@ -2563,6 +2563,9 @@ gst_video_encoder_finish_frame (GstVideoEncoder * encoder,
frame->distance_from_sync = priv->distance_from_sync;
priv->distance_from_sync++;

/* We need a writable buffer for the metadata changes below */
frame->output_buffer = gst_buffer_make_writable (frame->output_buffer);

GST_BUFFER_PTS (frame->output_buffer) = frame->pts;
GST_BUFFER_DTS (frame->output_buffer) = frame->dts;
GST_BUFFER_DURATION (frame->output_buffer) = frame->duration;
Expand Down Expand Up @@ -2709,6 +2712,9 @@ gst_video_encoder_finish_subframe (GstVideoEncoder * encoder,

gst_video_encoder_infer_dts_unlocked (encoder, frame);

/* We need a writable buffer for the metadata changes below */
subframe_buffer = gst_buffer_make_writable (subframe_buffer);

GST_BUFFER_PTS (subframe_buffer) = frame->pts;
GST_BUFFER_DTS (subframe_buffer) = frame->dts;
GST_BUFFER_DURATION (subframe_buffer) = frame->duration;
Expand Down

0 comments on commit df88b10

Please sign in to comment.