mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 06:26:23 +00:00
rmutils: fix byteswapping
fix the byteswapping code that was wrong because of the side effects of the READ/WRITE macros. Fixes #599676
This commit is contained in:
parent
0a36965808
commit
3784de031d
1 changed files with 5 additions and 3 deletions
|
@ -124,7 +124,7 @@ gst_rm_utils_read_tags (const guint8 * data, guint datalen,
|
||||||
GstBuffer *
|
GstBuffer *
|
||||||
gst_rm_utils_descramble_dnet_buffer (GstBuffer * buf)
|
gst_rm_utils_descramble_dnet_buffer (GstBuffer * buf)
|
||||||
{
|
{
|
||||||
guint8 *data, *end;
|
guint8 *data, *end, tmp;
|
||||||
|
|
||||||
buf = gst_buffer_make_writable (buf);
|
buf = gst_buffer_make_writable (buf);
|
||||||
|
|
||||||
|
@ -132,8 +132,10 @@ gst_rm_utils_descramble_dnet_buffer (GstBuffer * buf)
|
||||||
data = GST_BUFFER_DATA (buf);
|
data = GST_BUFFER_DATA (buf);
|
||||||
end = GST_BUFFER_DATA (buf) + GST_BUFFER_SIZE (buf);
|
end = GST_BUFFER_DATA (buf) + GST_BUFFER_SIZE (buf);
|
||||||
while ((data + 1) < end) {
|
while ((data + 1) < end) {
|
||||||
/* byte-swap in an alignment-safe way */
|
/* byte-swap */
|
||||||
GST_WRITE_UINT16_BE (data, GST_READ_UINT16_LE (data));
|
tmp = data[0];
|
||||||
|
data[0] = data[1];
|
||||||
|
data[1] = tmp;
|
||||||
data += sizeof (guint16);
|
data += sizeof (guint16);
|
||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
|
|
Loading…
Reference in a new issue