mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +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/1272>
This commit is contained in:
parent
7cec3538f5
commit
68f6730221
1 changed files with 2 additions and 2 deletions
|
@ -200,7 +200,7 @@ gst_bit_writer_reset_and_get_data (GstBitWriter * bitwriter)
|
||||||
|
|
||||||
data = bitwriter->data;
|
data = bitwriter->data;
|
||||||
if (bitwriter->owned)
|
if (bitwriter->owned)
|
||||||
data = g_memdup (data, bitwriter->bit_size >> 3);
|
data = g_memdup (data, GST_ROUND_UP_8 (bitwriter->bit_size) >> 3);
|
||||||
gst_bit_writer_reset (bitwriter);
|
gst_bit_writer_reset (bitwriter);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
@ -226,7 +226,7 @@ gst_bit_writer_reset_and_get_buffer (GstBitWriter * bitwriter)
|
||||||
|
|
||||||
g_return_val_if_fail (bitwriter != NULL, NULL);
|
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);
|
data = gst_bit_writer_reset_and_get_data (bitwriter);
|
||||||
|
|
||||||
/* we cannot rely on buffers allocated externally, thus let's dup
|
/* we cannot rely on buffers allocated externally, thus let's dup
|
||||||
|
|
Loading…
Reference in a new issue