[gst-devel] alignment issues

Daniel Gazard daniel.gazard at free.fr
Sat Apr 3 09:59:04 CEST 2004


I'm currently playing with gstreamer on an ARM9 based system and it
had exhibit several alignment issues in a few plugins. Here is the
typical peace of code which may cause problem (from
gst-plugins-0.8.0/gst/mpegstream/gstmpegpacketize.c:find_start_code): 
code = GUINT32_FROM_BE (*((guint32 *) (buf)));

On ARM system (I don't know exactly what about other systems but it
seems to be OK on x86), this require buf is an aligned address
(i.e. multiple of 4) which is not necessary the case since buf is a
guchar*.

For the moment I replaced all the snippets of code similar to the one
above by a something like:
memcpy (&code, (guchar*) buf, sizeof (code));
code = GUINT32_FROM_BE (code);

I'm not sure it is the good way to solve that type of problem however
it had the advantage to works pretty well for my use.

I identified potential problems in the following files (from
the gst-plugins-0.8.0 tarball):

gst-libs/gst/riff/riff-read.c
gst/asfdemux/gstasfdemux.c
gst/cdxaparse/gstcdxaparse.c
gst/qtdemux/qtdemux.c
gst/realmedia/rmdemux.c
gst/tags/gstvorbistag.c

May be there are other similar problems elsewhere. If someone is
interested, I can send my patches (I have to clean up the code
before). 




More information about the gstreamer-devel mailing list