mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 06:26:23 +00:00
bitwriter: Fix the trailing bits lost when getting its data.
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>
This commit is contained in:
parent
c6acee201e
commit
81cf9754e3
1 changed files with 2 additions and 2 deletions
|
@ -202,7 +202,7 @@ gst_bit_writer_reset_and_get_data (GstBitWriter * bitwriter)
|
|||
|
||||
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;
|
||||
|
@ -228,7 +228,7 @@ gst_bit_writer_reset_and_get_buffer (GstBitWriter * bitwriter)
|
|||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue