[gst-devel] alignment issues

Ronald S. Bultje R.S.Bultje at students.uu.nl
Wed Apr 7 05:32:23 CEST 2004

Hi Daniel,

On Tue, 2004-04-06 at 21:43, Daniel Gazard wrote: 
> Here is patches (diff were made from the 0.8.0 version) that I use to fix
> these alignment problems. You can find them at the following address:
> http://www.epita.fr/~gazard_d/gst-patchs/

I'll modify them slightly. The 8-bit reading functions (...) should be
replaced by a single one (without LE/BE). The functions in your "don't
support unaligned mem access" seem odd to me, since you bitshift guchar
and then cast the end result to the required type (e.g. guint64). As far
as I know, this is not allowed: you should cast first, then bitshift
(else, the bitshift will use a default 32bit length on popular archs,
therefore overflowing and losing information). So I'd propose changing
them to:

# define GST_READ_UINT64_BE(data)      (((guint64) data[0]) << 56 | \
                                        ((guint64) data[1]) << 48 | \
                                        ((guint64) data[2]) << 40 | \
                                        ((guint64) data[3]) << 32 | \
                                        ((guint64) data[4]) << 24 | \
                                        ((guint64) data[5]) << 16 | \
                                        ((guint64) data[6]) <<  8 | \
                                        ((guint64) data[7])        ))

Same for the others. I personally don't care much for the GST_PUCHAR()
and GST_GUINT64() macros, is there any reason why it was in there? The
above looks much more readable to me than your macros. ;).

Then, you seem to be doing something weird with GST_DISABLE_LOADSAFE in
the udpsink/tcpsink elements, can you elaborate on that? It seems like
you're disabling some _link() functions, which isn't a good idea.

Anyway, thanks for the patch. If you want, please provide a new patch.
Else I'll queue this somewhere on bugzilla and apply myself as soon as I
find some time to go over it and change the above.


More information about the gstreamer-devel mailing list