When we fill a bitstream buffer the buffer might be too small to hold the entire frame. Only resize to the filled size, preventing the following assertion to happen. gst_buffer_resize_range: assertion 'bufmax >= bufoffs + offset + size' failed Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5100>