In reset_and_get_data and reset_and_get_buffer, it fails to include
the trailing bits less than 8. So, when the bit_size is not byte
aligned, the trailing bits are lost in the return buffer.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/886>
data = bitwriter->data;
if (bitwriter->owned)
- data = g_memdup2 (data, bitwriter->bit_size >> 3);
+ data = g_memdup2 (data, GST_ROUND_UP_8 (bitwriter->bit_size) >> 3);
gst_bit_writer_reset (bitwriter);
return data;
g_return_val_if_fail (bitwriter != NULL, NULL);
- size = bitwriter->bit_size >> 3;
+ size = GST_ROUND_UP_8 (bitwriter->bit_size) >> 3;
data = gst_bit_writer_reset_and_get_data (bitwriter);
/* we cannot rely on buffers allocated externally, thus let's dup