baseparse: Add missing gst_buffer_make_writable
authorJan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com>
Mon, 27 Nov 2023 11:29:08 +0000 (12:29 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Mon, 27 Nov 2023 15:23:07 +0000 (15:23 +0000)
commita2533d2556e388ce6f04337553bd069ecb7afb51
tree73f408210c386cd63971d8838e87286a08830508
parent36f653fdc53b03cbeeee0a3c758572e726a6b60b
baseparse: Add missing gst_buffer_make_writable

When the subclass attempts to finish without an explicit `out_buffer`,
we take a buffer from our adapter. We need to make this buffer writable
before copying the metadata.

This led to data races such as in the following pipeline, which randomly
messed up the buffer PTS:

    gst-launch-1.0 -e audiotestsrc timestamp-offset=5555 num-buffers=100 \
      ! opusenc ! tee name=t ! queue ! opusparse ! fakesink silent=0 \
      t. ! queue ! opusparse ! fakesink silent=0 -v | grep '0000, dur'

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5720>
subprojects/gstreamer/libs/gst/base/gstbaseparse.c